Pārlūkot izejas kodu

巡检项添加设备分类的查询

lipenghui 1 mēnesi atpakaļ
vecāks
revīzija
2b8f106e16

+ 5 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/inspect/IotInspectItemMapper.java

@@ -11,6 +11,9 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import org.apache.ibatis.annotations.Mapper;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+import java.util.Set;
+
 /**
  * 巡检项 Mapper
  *
@@ -19,7 +22,7 @@ import org.apache.ibatis.annotations.Param;
 @Mapper
 public interface IotInspectItemMapper extends BaseMapperX<IotInspectItemDO> {
 
-    default PageResult<IotInspectItemDO> selectPage(IotInspectItemPageReqVO reqVO) {
+    default PageResult<IotInspectItemDO> selectPage(IotInspectItemPageReqVO reqVO, Set<Long> classifies) {
         return selectPage(reqVO, new LambdaQueryWrapperX<IotInspectItemDO>()
                 .likeIfPresent(IotInspectItemDO::getItem, reqVO.getItem())
                 .eqIfPresent(IotInspectItemDO::getStandard, reqVO.getStandard())
@@ -27,7 +30,7 @@ public interface IotInspectItemMapper extends BaseMapperX<IotInspectItemDO> {
                 .eqIfPresent(IotInspectItemDO::getRemark, reqVO.getRemark())
                 .betweenIfPresent(IotInspectItemDO::getCreateTime, reqVO.getCreateTime())
                 .eqIfPresent(IotInspectItemDO::getDeptId, reqVO.getDeptId())
-                .eqIfPresent(IotInspectItemDO::getDeviceClassify, reqVO.getDeviceClassify())
+                .inIfPresent(IotInspectItemDO::getDeviceClassify, classifies)
                 .eqIfPresent(IotInspectItemDO::getDeviceId, reqVO.getDeviceId())
                 .orderByDesc(IotInspectItemDO::getId));
     }

+ 7 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/inspect/IotInspectItemServiceImpl.java

@@ -21,7 +21,7 @@ import org.springframework.validation.annotation.Validated;
 
 import javax.annotation.Resource;
 
-import java.util.Objects;
+import java.util.*;
 
 import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
 import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_INSPECT_ITEM_NOT_EXISTS;
@@ -86,7 +86,12 @@ public class IotInspectItemServiceImpl implements IotInspectItemService {
 
     @Override
     public PageResult<IotInspectItemDO> getIotInspectItemPage(IotInspectItemPageReqVO pageReqVO) {
-        return iotInspectItemMapper.selectPage(pageReqVO);
+        Set<Long> classifies = new HashSet<>();
+        if (Objects.nonNull(pageReqVO.getDeviceClassify())) {
+            classifies = iotProductClassifyService.getChildIotProductClassifyList(pageReqVO.getDeviceClassify());
+            classifies.add(pageReqVO.getDeviceClassify());
+        }
+        return iotInspectItemMapper.selectPage(pageReqVO, classifies);
     }
 
     @Override