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

import java.util.List;

import com.jeeplus.modules.sg.audit.information.entity.Information;
import com.jeeplus.modules.sg.audit.material.entity.Material;
import com.jeeplus.modules.sg.audit.material.mapper.MaterialMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;

/**
 * 项目管理Service
 * @author
 * @version
 */
@Service
@Transactional(readOnly = true)
public class MaterialService extends CrudService<MaterialMapper, Material> {

	@Autowired
	private MaterialMapper materialMapper;

	public Material get(String id) {
		Material material = super.get(id);
		return material;
	}

	public List<Material> findList(Material material) {
		return super.findList(material);
	}

	public Page<Material> findPage(Page<Material> page, Material entity) {
		return super.findPage(page, entity);
	}

	public List<Material> projectNeed(List<Material> list) {
		return materialMapper.projectNeed(list);
	}

	@Override
	public List<Material> findListBy(List<Material> entity) {
		return super.findListBy(entity);
	}

	@Transactional(readOnly = false)
	public void save(Material entity) {
		entity.preInsert();
		materialMapper.insert(entity);
	}


	@Transactional(readOnly = false)
	public void saveMater(List<Material> entity) {
		materialMapper.saveMater(entity);
	}

	public Material findByProIn(String projectId,String infoId) {
		return materialMapper.findByProIn(projectId, infoId);
	}

	@Transactional(readOnly = false)
	public Integer updateInfo(Material material) {
		material.setIsBackNo(0);
		return materialMapper.updateInfo(material);
	}

	public Material findByMaterialId(Material material){
		return materialMapper.findByMaterialId(material);
	}

	public List<Material> findInformation(List<Material> list) {
		return materialMapper.findInformation(list);
	}

	public Information findNeedInfor(Material information) {
		return materialMapper.findNeedInfor(information);
	}

	public Material idFormId(Material material) {
		return materialMapper.idFormId(material);
	}

	@Transactional(readOnly = false)
	public void updateNeed(Information information) {
		materialMapper.updateNeed(information);
	}

	@Transactional(readOnly = false)
	public void updateStatus(List<Material> materialList) {
		materialMapper.updateStatus(materialList);
	}

	public List<Material> findIsBack(List<Material> list) {
		return materialMapper.findIsBack(list);
	}

	public  List<Material> findProId(List<Information> list) {
		return materialMapper.findProId(list);
	}


	public  List<Information> proIdName(List<Material> list) {
		return materialMapper.proIdName(list);
	}

	public List<Material> findMateial(Information information) {
		return materialMapper.findMateial(information);
	}

	public List<Material> findStatus() {
		return materialMapper.findStatus();
	}

	public String findNeedBack(String id) {
		return materialMapper.findNeedBack(id);
	}

}