Przeglądaj źródła

提交成套排序

lipenghui 1 miesiąc temu
rodzic
commit
4cf1a6aafa

+ 11 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/devicegroup/IotDeviceGroupController.java

@@ -124,8 +124,17 @@ public class IotDeviceGroupController {
     @Operation(summary = "获得某设备的成套信息")
     @Parameter(name = "id", description = "编号", required = true, example = "1024")
     @PreAuthorize("@ss.hasPermission('rq:iot-device-group:query')")
-    public CommonResult<PageResult<IotDeviceGroupDetailDO>> getDeviceGroup(@Valid IotDeviceGroupDetailPageReqVO reqVO) {
+    public CommonResult<PageResult<IotDeviceGroupDetailRespVO>> getDeviceGroup(@Valid IotDeviceGroupDetailPageReqVO reqVO) {
         PageResult<IotDeviceGroupDetailDO> deviceGroupList = iotDeviceGroupService.getDeviceGroupList(reqVO);
-        return success(deviceGroupList);
+        List<IotDeviceGroupDetailRespVO> collect = deviceGroupList.getList().stream().map(e -> {
+            IotDeviceGroupDetailRespVO bean = BeanUtil.toBean(e, IotDeviceGroupDetailRespVO.class);
+            IotDeviceGroupDO iotDeviceGroup = iotDeviceGroupService.getIotDeviceGroup(e.getGroupId());
+            if (iotDeviceGroup != null) {
+                bean.setGroupName(iotDeviceGroup.getName());
+            }
+            return bean;
+        }).collect(Collectors.toList());
+        return success(new PageResult<>(collect, deviceGroupList.getTotal()));
+//        return success(deviceGroupList);
     }
 }

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/devicegroup/IotDeviceGroupDetailRespVO.java

@@ -48,4 +48,6 @@ public class IotDeviceGroupDetailRespVO {
     @ExcelProperty("创建时间")
     private LocalDateTime createTime;
 
+    private String groupName;
+
 }

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/devicegroup/IotDeviceGroupDetailMapper.java

@@ -27,7 +27,7 @@ public interface IotDeviceGroupDetailMapper extends BaseMapperX<IotDeviceGroupDe
                 .eqIfPresent(IotDeviceGroupDetailDO::getRemark, reqVO.getRemark())
                 .eqIfPresent(IotDeviceGroupDetailDO::getDeptId, reqVO.getDeptId())
                 .betweenIfPresent(IotDeviceGroupDetailDO::getCreateTime, reqVO.getCreateTime())
-                .orderByDesc(IotDeviceGroupDetailDO::getId));
+                .orderByDesc(IotDeviceGroupDetailDO::getIfMaster));
     }
 
 }

+ 1 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/devicegroup/IotDeviceGroupServiceImpl.java

@@ -119,6 +119,7 @@ public class IotDeviceGroupServiceImpl implements IotDeviceGroupService {
 //        IotDeviceGroupDetailPageReqVO pageReqVO = new IotDeviceGroupDetailPageReqVO();
         IotDeviceGroupDetailPageReqVO pageReqVO = new IotDeviceGroupDetailPageReqVO();
         pageReqVO.setGroupId(groupId);
+        pageReqVO.setDeviceCode(reqVO.getDeviceCode());
         PageResult<IotDeviceGroupDetailDO> iotDeviceGroupDetailDOPageResult = iotDeviceGroupDetailMapper.selectPage(pageReqVO);
         return iotDeviceGroupDetailDOPageResult;
     }