Przeglądaj źródła

事故事件上报

Zimo 15 godzin temu
rodzic
commit
c83e10f521

+ 4 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/qhse/accident/IotAccidentReportMapper.java

@@ -8,6 +8,8 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.accident.IotAccidentRepor
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.apache.ibatis.annotations.Mapper;
 
+import java.util.Set;
+
 /**
  * QHSE事故上报 Mapper
  *
@@ -16,13 +18,13 @@ import org.apache.ibatis.annotations.Mapper;
 @Mapper
 public interface IotAccidentReportMapper extends BaseMapperX<IotAccidentReportDO> {
 
-    default PageResult<IotAccidentReportDO> selectPage(IotAccidentReportPageReqVO reqVO) {
+    default PageResult<IotAccidentReportDO> selectPage(IotAccidentReportPageReqVO reqVO, Set<Long> ids) {
         LambdaQueryWrapperX<IotAccidentReportDO> queryWrapperX = new LambdaQueryWrapperX<IotAccidentReportDO>()
                 .betweenIfPresent(IotAccidentReportDO::getActualTime, reqVO.getActualTime())
                 .eqIfPresent(IotAccidentReportDO::getAccidentGrade, reqVO.getAccidentGrade())
                 .eqIfPresent(IotAccidentReportDO::getAccidentType, reqVO.getAccidentType())
                 .eqIfPresent(IotAccidentReportDO::getAccidentAddress, reqVO.getAccidentAddress())
-                .eqIfPresent(IotAccidentReportDO::getDeptId, reqVO.getDeptId())
+                .inIfPresent(IotAccidentReportDO::getDeptId, ids)
                 .likeIfPresent(IotAccidentReportDO::getDeptName, reqVO.getDeptName())
                 .eqIfPresent(IotAccidentReportDO::getDutyPerson, reqVO.getDutyPerson())
                 .eqIfPresent(IotAccidentReportDO::getLossSituation, reqVO.getLossSituation())

+ 7 - 5
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/qhse/accident/IotAccidentReportServiceImpl.java

@@ -29,10 +29,7 @@ import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
-import java.util.Collections;
-import java.util.List;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 
@@ -244,7 +241,12 @@ public class IotAccidentReportServiceImpl implements IotAccidentReportService {
 
     @Override
     public PageResult<IotAccidentReportDO> getIotAccidentReportPage(IotAccidentReportPageReqVO pageReqVO) {
-        return iotAccidentReportMapper.selectPage(pageReqVO);
+        Set<Long> ids = new HashSet<>();
+        if (Objects.nonNull(pageReqVO.getDeptId())) {
+            ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
+            ids.add(pageReqVO.getDeptId());
+        }
+        return iotAccidentReportMapper.selectPage(pageReqVO, ids);
     }
 
     @Override