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

import com.jeeplus.core.persistence.Page;
import com.jeeplus.core.service.CrudService;
import com.jeeplus.modules.sg.managementcenter.activiti.entity.ConstructionUpload;
import com.jeeplus.modules.sg.managementcenter.activiti.entity.PersonnelManagement;
import com.jeeplus.modules.sg.managementcenter.activiti.entity.UploadImages;
import com.jeeplus.modules.sg.managementcenter.activiti.mapper.PersonnelManagementMapper;
import com.jeeplus.modules.sg.managementcenter.activiti.mapper.UploadImagesMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * 图片Service
 *
 * @author
 * @version 2019-11-08
 */
@Service
@Transactional(readOnly = true)
public class UploadImagesService extends CrudService<UploadImagesMapper, UploadImages> {

	@Autowired
	private UploadImagesMapper uploadImagesMapper;

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

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

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

	@Override
	public List<UploadImages> findAllList(UploadImages entity) {
		return super.findAllList(entity);
	}

	@Transactional(readOnly = false)
	public void insert(UploadImages entity) {
		entity.preInsert();
		uploadImagesMapper.insert(entity);
	}

	public Page<UploadImages> findMaterialImg(Page<UploadImages> page, UploadImages entity) {
		dataRuleFilter(entity);
		entity.setPage(page);
		page.setList(mapper.findMaterialImg(entity));
		return page;
	}

	//施工交底流程
	public UploadImages findJdById(String procInsId) {
		return uploadImagesMapper.findJdById(procInsId);
	}

	//领料流程
	public UploadImages findWzById(String procInsId) {
		return uploadImagesMapper.findWzById(procInsId);
	}

	//施工验收流程
	public UploadImages findSgById(String procInsId) {
		return uploadImagesMapper.findSgById(procInsId);
	}

	@Transactional(readOnly = false)
	public void saveUpload(UploadImages uploadImages) {
		uploadImagesMapper.saveUpload(uploadImages);
	}

	public List<ConstructionUpload> findConList(ConstructionUpload constructionUpload) {
		return uploadImagesMapper.findConList(constructionUpload);
	}

	public Page<ConstructionUpload> findConPage(Page<ConstructionUpload> page, ConstructionUpload entity) {
		dataRuleFilter(entity);
		entity.setPage(page);
		page.setList(uploadImagesMapper.findConList(entity));
		return page;
	}

	@Transactional(readOnly = false)
	public void conUpdateSave(ConstructionUpload constructionUpload) {
		constructionUpload.preInsert();
		uploadImagesMapper.conUpdateSave(constructionUpload);
	}

	/**
	 * 修改政策处理上传政策书及缴费单
	 */
	@Transactional(readOnly = false)
	public void updateConUpload(ConstructionUpload constructionUpload) {
		uploadImagesMapper.updateConUpload(constructionUpload);
	}

	/**
	 * 通过id获取政策处理上传政策书及缴费单
	 */
	public ConstructionUpload getConUpload(ConstructionUpload constructionUpload) {
		return uploadImagesMapper.getConUpload(constructionUpload);
	}

	@Transactional(readOnly = false)
	public void delConUpload(ConstructionUpload constructionUpload) {
		uploadImagesMapper.delConUpload(constructionUpload);
	}
}