/**
 * 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.Construction;
import com.jeeplus.modules.sg.managementcenter.activiti.entity.Disclose;
import com.jeeplus.modules.sg.managementcenter.activiti.mapper.ConstructionMapper;
import com.jeeplus.modules.sg.managementcenter.activiti.mapper.DiscloseMapper;
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 DiscloseService extends CrudService<DiscloseMapper, Disclose> {

	@Autowired
	private DiscloseMapper discloseMapper;

	@Override
	public Disclose get(Disclose entity) {
		return super.get(entity);
	}

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

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

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

	@Override
	public void delete(Disclose entity) {
		super.delete(entity);
	}

	@Transactional(readOnly = false)
	public int newInsert(List<Disclose> disclose) {
		for (Disclose d : disclose) {
			d.preInsert();
		}
		return discloseMapper.newInsert(disclose);
	}

	@Transactional(readOnly = false)
	public int updateById(Disclose disclose) {
		disclose.preUpdate();
		return discloseMapper.updateById(disclose);
	}

	public int findByProcInsId(String procInsId) {
		return discloseMapper.findByProcInsId(procInsId);
	}

	@Transactional(readOnly = false)
	public void updateDiscloseByProcInsId(Construction construction) {
		discloseMapper.updateDiscloseByProcInsId(construction);
	}

	@Transactional(readOnly = false)
	public void insertDiscloseRole(Construction construction) {
		discloseMapper.insertDiscloseRole(construction);
	}
}