Browse Source

fix:新增排序条件

zhuyapeng 2 years ago
parent
commit
ac7d2bff0c

+ 7 - 6
smsb-customer-manager-app/src/main/java/com/inspur/customer/service/org/SmsbDepartmentServiceImpl.java

@@ -356,15 +356,16 @@ public class SmsbDepartmentServiceImpl extends ServiceImpl<SmsbDepartmentMapper
         // 1. 获取对应部门树
         SmsbDepartmentCO department = this.queryDepartment(departmentCmd.getTenant() , departmentCmd.getOrg());
         DeviceDepartmentSimpleDto deviceDepartmentSimpleDto = new DeviceDepartmentSimpleDto();
+        Integer orderFlag = departmentCmd.getOrderFlag();
         // 2. 获取部门-List<设备id> map
         if(StringUtils.isEmpty(departmentCmd.getOrg()) && department.getId() == null){
             // 根节点为租户,该租户下未被分配的设备
-            deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceUnboundSimple(departmentCmd.getTenant() , departmentCmd.getActivate()));
+            deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceUnboundSimple(departmentCmd.getTenant() , departmentCmd.getActivate(),orderFlag));
         }else {
             // 根节点为部门
-            deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceBindSimple(department.getPath() , departmentCmd.getActivate()));
+            deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceBindSimple(department.getPath() , departmentCmd.getActivate(),orderFlag ));
         }
-        deviceDepartmentSimpleDto.setChildren(childRecurrenceHandleSimple(department.getChildren() , departmentCmd.getActivate()));
+        deviceDepartmentSimpleDto.setChildren(childRecurrenceHandleSimple(department.getChildren() , departmentCmd.getActivate(), orderFlag));
         // 3. 组装设备信息并返回
         deviceDepartmentSimpleDto.setTenant(department.getTenant());
         return deviceDepartmentSimpleDto;
@@ -376,14 +377,14 @@ public class SmsbDepartmentServiceImpl extends ServiceImpl<SmsbDepartmentMapper
      * @param activate
      * @return
      */
-    private List<DeviceDepartmentSimpleDto> childRecurrenceHandleSimple(List<SmsbDepartmentCO> children , Boolean activate){
+    private List<DeviceDepartmentSimpleDto> childRecurrenceHandleSimple(List<SmsbDepartmentCO> children , Boolean activate, Integer orderFlag){
         List<DeviceDepartmentSimpleDto> childrenList = Lists.newArrayList();
         if(!CollectionUtils.isEmpty(children)){
             children.forEach(child->{
                 DeviceDepartmentSimpleDto deviceDepartmentSimpleDto = new DeviceDepartmentSimpleDto();
                 BeanUtils.copyProperties(child , deviceDepartmentSimpleDto);
-                deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceBind(child.getPath() , activate));
-                deviceDepartmentSimpleDto.setChildren(childRecurrenceHandleSimple(child.getChildren() , activate));
+                deviceDepartmentSimpleDto.setDevices(deviceService.ListDeviceBindSimple(child.getPath() , activate,orderFlag));
+                deviceDepartmentSimpleDto.setChildren(childRecurrenceHandleSimple(child.getChildren() , activate,orderFlag));
                 childrenList.add(deviceDepartmentSimpleDto);
             });
         }

+ 2 - 3
smsb-customer-manager-client/src/main/java/com/inspur/customer/object/org/DeviceDepartmentCmd.java

@@ -1,9 +1,6 @@
 package com.inspur.customer.object.org;
 
 import lombok.Data;
-import org.apache.commons.lang3.StringUtils;
-
-import java.io.Serializable;
 
 /**
  * @Author wangbo13
@@ -23,4 +20,6 @@ public class DeviceDepartmentCmd extends OperationAuthority {
      * 设备是否激活
      */
     private Boolean activate;
+
+    private Integer orderFlag;
 }