zhangjian
2023-09-23 2a18523931228c78ae359997986d004a39545d51
ard-work/src/main/java/com/ruoyi/alarmpoints/well/service/impl/ArdAlarmpointsWellServiceImpl.java
@@ -6,6 +6,7 @@
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWell;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellDeptVo;
import com.ruoyi.alarmpoints.well.domain.ArdAlarmpointsWellParam;
import com.ruoyi.alarmpoints.well.mapper.ArdAlarmpointsWellMapper;
import com.ruoyi.alarmpoints.well.service.IArdAlarmpointsWellService;
@@ -94,7 +95,7 @@
    @Override
    @Transactional
    public int insertArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
        boolean wellIdExists = ardAlarmpointsWellMapper.checkWellIdExists(ardAlarmpointsWell.getWellId());
        boolean wellIdExists = checkWellIdExists(ardAlarmpointsWell);
        if(wellIdExists)
        {
            throw new RuntimeException("井号已存在");
@@ -115,7 +116,7 @@
    @Override
    @Transactional
    public int updateArdAlarmpointsWell(ArdAlarmpointsWell ardAlarmpointsWell) {
        boolean wellIdExists = ardAlarmpointsWellMapper.checkWellIdExists(ardAlarmpointsWell.getWellId());
        boolean wellIdExists = checkWellIdExists(ardAlarmpointsWell);
        if(wellIdExists)
        {
            throw new RuntimeException("井号已存在");
@@ -230,7 +231,25 @@
            }
        }
    }
    /**
     * 核对井号是否唯一
     *
     * @param wellId 需要核对的井号
     * @return 结果
     */
    @Override
    public Boolean checkWellIdExists(ArdAlarmpointsWell well) {
        // 校验:wellId
        String id = (well.getId() == null) ? "" : well.getId();
        String wellId = well.getWellId();
        ArdAlarmpointsWell ardAlarmpointsWell = ardAlarmpointsWellMapper.checkWellIdExists(wellId);
        String infoId = (ardAlarmpointsWell == null) ? "" : (ardAlarmpointsWell.getId());
        if ((ardAlarmpointsWell != null) && !((infoId).equals(id))) {
            //已存在
            return true;
        }
        return false;
    }
    @Override
    public List<ArdAlarmpointsWell> wellByDeptList(List<Long> deptList) {
@@ -273,4 +292,9 @@
        List<ArdAlarmpointsWell> list = ardAlarmpointsWellMapper.selectList(queryWrapper);
        return new PageInfo<>(list);
    }
    @Override
    public List<ArdAlarmpointsWellDeptVo> wellListDept(List<Long> deptList) {
        return ardAlarmpointsWellMapper.wellListDept(deptList);
    }
}