package cn.com.goldenwater.dcproj.service.impl.ducha; import cn.com.goldenwater.dcproj.dao.BisInspHystpBldfltDao; import cn.com.goldenwater.dcproj.model.BisInspHystpBldflt; import cn.com.goldenwater.dcproj.param.BisInspHystpBldfltParam; import cn.com.goldenwater.dcproj.service.BisInspHystpBldfltService; 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 BisInspHystpBldfltServiceImpl extends AbstractCrudService implements BisInspHystpBldfltService { @Autowired private BisInspHystpBldfltDao bisInspHystpBldfltDao; @Autowired private BisInspHystpService bisInspHystpService; public BisInspHystpBldfltServiceImpl(BisInspHystpBldfltDao bisInspHystpBldfltDao) { super(bisInspHystpBldfltDao); this.bisInspHystpBldfltDao = bisInspHystpBldfltDao; } @Override public int insert(BisInspHystpBldflt bisInspHystpBldflt) { String uuid = UuidUtil.uuid(); // 生成uuid bisInspHystpBldflt.setId(uuid); bisInspHystpBldflt.setIntm(new Date()); bisInspHystpBldflt.setUptm(new Date()); bisInspHystpBldflt.setDataStat("0"); return this.bisInspHystpBldfltDao.insert(bisInspHystpBldflt); } @Override public int update(BisInspHystpBldflt bisInspHystpBldflt) { // 获取子表 BisInspHystpBldflt child = get(bisInspHystpBldflt.getRgstrId()); if (child == null) { throw new CheckException("未找到此登记表下的子表"); } // 更新子表 bisInspHystpBldflt.setId(child.getId()); bisInspHystpBldflt.setUptm(new Date()); int ret = bisInspHystpBldfltDao.update(bisInspHystpBldflt); // 更新登记表状态 Map map = new HashMap<>(3); map.put("rgstrId", bisInspHystpBldflt.getRgstrId()); map.put("param", "bldflt"); map.put("state", bisInspHystpBldflt.getState()); bisInspHystpService.updateState(map); return ret; } @Override public int delete(String id) { return this.bisInspHystpBldfltDao.delete(id); } }