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

import com.jeeplus.common.utils.excel.ImportExcel;
import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.sg.annualmaterialreport.entity.NewMaterialReport;
import com.jeeplus.modules.sg.annualmaterialreport.mapper.NewMaterialReportMapper;
import org.apache.poi.openxml4j.exceptions.InvalidFormatException;
import org.apache.poi.ss.usermodel.Row;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;


/**
 * 新年度物资上报services
 * @author QY
 */
@Service
@Transactional(readOnly = true)
public class NewMaterialReportService extends CrudService<NewMaterialReportMapper, NewMaterialReport> {


	@Override
	public NewMaterialReport get(String id) {
		return super.get(id);
	}

	@Override
	public List<NewMaterialReport> findList(NewMaterialReport entity) {
		return super.findList(entity);
	}

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

	@Override
	@Transactional(readOnly = false)
	public void save(NewMaterialReport entity) {
		super.save(entity);
	}

	/**
	 * 通过获取多文件的项目名称，查询存在的项目信息，提示
	 * */
	public List<NewMaterialReport> findByList(List<String> list){
		return mapper.findByList(list);
	}

	/**
	 * 通过储备项目名称修改对应的数据
	 */
	@Transactional(readOnly = false)
	public void updateList(List<NewMaterialReport> list) {
		for (NewMaterialReport n :
				list) {
			n.preInsert();
		}
		mapper.updateList(list);
	}


}