/**
 * Copyright &copy; 2015-2020 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.modules.oa.service;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.oa.entity.OaNotifyMaterial;
import com.jeeplus.modules.oa.mapper.OaNotifyMaterialMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 请假表单Service
 * @author lgf
 * @version 2018-06-12
 */
@Service
@Transactional(readOnly = true)
public class OaNotifyMaterialService extends CrudService<OaNotifyMaterialMapper, OaNotifyMaterial> {
    @Autowired
	private OaNotifyMaterialMapper oaNotifyMaterialMapper;

	public OaNotifyMaterial get(String id) {
		OaNotifyMaterial oaNotifyMaterial = super.get(id);
		return oaNotifyMaterial;
	}
	
	public List<OaNotifyMaterial> findList(OaNotifyMaterial oaNotifyMaterial) {
		return super.findList(oaNotifyMaterial);
	}

	public Page<OaNotifyMaterial> find(Page<OaNotifyMaterial> page, OaNotifyMaterial oaNotifyMaterial) {
		oaNotifyMaterial.setPage(page);
		page.setList(mapper.findList(oaNotifyMaterial));
		return page;
	}

	@Transactional(readOnly = false)
	public void save(OaNotifyMaterial oaNotifyMaterial) {
		super.save(oaNotifyMaterial);
	}
	
	@Transactional(readOnly = false)
	public void delete(OaNotifyMaterial oaNotifyMaterial) {
		super.delete(oaNotifyMaterial);
	}

	@Transactional(readOnly = false)
	public void saveList(List<OaNotifyMaterial> oaNotifyMaterials) {
		for (OaNotifyMaterial oaNotifyMaterial:oaNotifyMaterials){
			oaNotifyMaterial.preInsert();
		}
		oaNotifyMaterialMapper.insertList(oaNotifyMaterials);
	}
}