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