package cn.com.goldenwater.dcproj.service.impl.ducha; import cn.com.goldenwater.dcproj.dao.BisInspHystpSafDao; import cn.com.goldenwater.dcproj.model.BisInspHystpSaf; import cn.com.goldenwater.dcproj.param.BisInspHystpSafParam; import cn.com.goldenwater.dcproj.service.BisInspHystpSafService; import cn.com.goldenwater.core.service.AbstractCrudService; import cn.com.goldenwater.dcproj.service.BisInspHystpService; import cn.com.goldenwater.target.CheckException; import com.github.pagehelper.PageHelper; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import cn.com.goldenwater.id.util.UuidUtil; import java.util.HashMap; import java.util.List; import java.util.Date; import java.util.Map; /** * @author lhc * @date 2022-3-23 */ @Service @Transactional public class BisInspHystpSafServiceImpl extends AbstractCrudService implements BisInspHystpSafService { @Autowired private BisInspHystpSafDao bisInspHystpSafDao; @Autowired private BisInspHystpService bisInspHystpService; public BisInspHystpSafServiceImpl(BisInspHystpSafDao bisInspHystpSafDao) { super(bisInspHystpSafDao); this.bisInspHystpSafDao = bisInspHystpSafDao; } @Override public int insert(BisInspHystpSaf bisInspHystpSaf) { String uuid = UuidUtil.uuid(); // 生成uuid bisInspHystpSaf.setId(uuid); bisInspHystpSaf.setIntm(new Date()); bisInspHystpSaf.setUptm(new Date()); bisInspHystpSaf.setDataStat("0"); return this.bisInspHystpSafDao.insert(bisInspHystpSaf); } @Override public int update(BisInspHystpSaf bisInspHystpSaf) { BisInspHystpSaf child = get(bisInspHystpSaf.getRgstrId()); if (child == null) { throw new CheckException("未找到此登记表下的子表"); } // 更新子表 bisInspHystpSaf.setId(child.getId()); bisInspHystpSaf.setUptm(new Date()); int ret = bisInspHystpSafDao.update(bisInspHystpSaf); // 更新登记表状态 Map map = new HashMap<>(3); map.put("rgstrId", bisInspHystpSaf.getRgstrId()); map.put("param", "saf"); map.put("state", bisInspHystpSaf.getState()); bisInspHystpService.updateState(map); return ret; } @Override public int delete(String id) { return this.bisInspHystpSafDao.delete(id); } }