瀏覽代碼

巡检区域、计划增加查询数据不为空判断

fuyuhchuan 1 年之前
父節點
當前提交
7479e23f67

+ 3 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -256,7 +256,9 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         queryWrapperOne.select(PatrolInspectionArea::getId, PatrolInspectionArea::getAreaName)
                 .eq(PatrolInspectionArea::getId, planSonList.get(0).getAreaId());
         List<PatrolInspectionArea> areaList = patrolInspectionAreaService.list(queryWrapperOne);
-
+        if (areaList.isEmpty()) {
+            throw new BusinessException("巡检区域不存在");
+        }
         PatrolInspectionRecord patrolInspectionRecord = new PatrolInspectionRecord();
         patrolInspectionRecord.setSiteNubmber(planRecordVo.getSiteNubmber());
         patrolInspectionRecord.setSiteType(planRecordVo.getSiteType());

+ 4 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionRecordServiceImpl.java

@@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.core.toolkit.StringUtils;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.usky.common.core.bean.CommonPage;
+import com.usky.common.core.exception.BusinessException;
 import com.usky.common.mybatis.core.AbstractCrudService;
 import com.usky.common.security.utils.SecurityUtils;
 import com.usky.fire.domain.*;
@@ -93,7 +94,9 @@ public class PatrolInspectionRecordServiceImpl extends AbstractCrudService<Patro
         queryWrapper.eq(PatrolInspectionRecord::getTenantId, SecurityUtils.getTenantId())
                 .eq(PatrolInspectionRecord::getId, id);
         List<PatrolInspectionRecord> patrolInspectionRecordList = this.list(queryWrapper);
-
+        if (patrolInspectionRecordList.isEmpty()) {
+            throw new BusinessException("巡检记录不存在");
+        }
         //上传图片查询
         LambdaQueryWrapper<PatrolInspectionRecordPicture> queryWrapperOne = Wrappers.lambdaQuery();
         queryWrapperOne.eq(PatrolInspectionRecordPicture::getRecordId, id);