Browse Source

添加部门id为空判断、巡检人员状态限查询时制存在多个人员userid相同时返回第一条

fuyuhchuan 1 year ago
parent
commit
73dcac9b47

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

@@ -73,7 +73,9 @@ public class PatrolInspectionAttendanceServiceImpl extends AbstractCrudService<P
         for (PatrolInspectionAttendance attendance : attendancePage.getRecords()) {
             Map<String, Object> map = new HashMap<>();
             map.put("id", attendance.getId());
-            map.put("deptName", getDeptName(attendance.getDeptId()));
+            Long deptId = attendance.getDeptId();
+            String deptName = deptId != null ? getDeptName(deptId) : "";
+            map.put("deptName", deptName);
             map.put("tenantId", attendance.getTenantId());
             map.put("operator", attendance.getOperator());
             map.put("operatorId", attendance.getOperatorId());

+ 2 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPersonnelServiceImpl.java

@@ -232,7 +232,8 @@ public class PatrolInspectionPersonnelServiceImpl extends AbstractCrudService<Pa
      */
     public PatrolInspectionPersonnel getStatus(){
         LambdaQueryWrapper<PatrolInspectionPersonnel> wrapper = Wrappers.lambdaQuery();
-        wrapper.eq(PatrolInspectionPersonnel::getUserId,SecurityUtils.getUserId());
+        wrapper.eq(PatrolInspectionPersonnel::getUserId,SecurityUtils.getUserId())
+                .last("LIMIT 1");
         return baseMapper.selectOne(wrapper);
     }