|
|
@@ -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);
|
|
|
});
|
|
|
}
|