部门树状结构调整格式

main
zhaokai 2025-11-21 11:10:31 +08:00
parent c00c0c9155
commit 60028814fc
4 changed files with 7 additions and 6 deletions

View File

@ -92,7 +92,7 @@ public class DepartmentController {
} }
@ApiOperation("所有企业下部门树状所有数据") @ApiOperation("所有企业下部门树状所有数据")
@PostMapping("/listAllTree") @PostMapping("/listAllTree")
public MultiResponse<List<DepartmentTreeInfoCO>> listAllTree() { public MultiResponse<DepartmentTreeInfoCO> listAllTree() {
return MultiResponse.of(departmentService.listAllTree()); return MultiResponse.of(departmentService.listAllTree());
} }

View File

@ -144,7 +144,7 @@ public class DepartmentQueryExe {
return departmentCoConvertor.converDOsToCOs(list); return departmentCoConvertor.converDOsToCOs(list);
} }
public Collection<List<DepartmentTreeInfoCO>> listAllTree() { public List<DepartmentTreeInfoCO> listAllTree() {
List<DepartmentDO> pageResponse = departmentRepository.listAllTree(); List<DepartmentDO> pageResponse = departmentRepository.listAllTree();
if (CollUtil.isEmpty(pageResponse)) { if (CollUtil.isEmpty(pageResponse)) {
@ -160,16 +160,17 @@ public class DepartmentQueryExe {
//GBS部门根节点父部门是tenantId //GBS部门根节点父部门是tenantId
//按照企业分组 //按照企业分组
List<List<DepartmentTreeInfoCO>> result1= new ArrayList<>(); List<List<DepartmentTreeInfoCO>> result1= new ArrayList<>();
List<DepartmentTreeInfoCO> result2= new ArrayList<>();
Map<Long, List<DepartmentTreeInfoCO>> corpMap = examCenterCOS.stream().collect(Collectors.groupingBy(DepartmentTreeInfoCO::getCorpinfoId)); Map<Long, List<DepartmentTreeInfoCO>> corpMap = examCenterCOS.stream().collect(Collectors.groupingBy(DepartmentTreeInfoCO::getCorpinfoId));
corpMap.forEach((corpId, list) -> { corpMap.forEach((corpId, list) -> {
List<DepartmentTreeInfoCO> departmentTreeInfoCOS = Tools.buildEntityTree(list, "id", "parentId", "childrenList", 0L); List<DepartmentTreeInfoCO> departmentTreeInfoCOS = Tools.buildEntityTree(list, "id", "parentId", "childrenList", 0L);
if(CollUtil.isNotEmpty(departmentTreeInfoCOS)){ if(CollUtil.isNotEmpty(departmentTreeInfoCOS)){
result1.add(departmentTreeInfoCOS); result2.addAll(departmentTreeInfoCOS);
} }
}); });
return result1; return result2;
} }
} }

View File

@ -83,7 +83,7 @@ public class DepartmentServiceImpl implements DepartmentServiceI {
} }
@Override @Override
public Collection<List<DepartmentTreeInfoCO>> listAllTree() { public List<DepartmentTreeInfoCO> listAllTree() {
return departmentQueryExe.listAllTree(); return departmentQueryExe.listAllTree();
} }
} }

View File

@ -36,6 +36,6 @@ public interface DepartmentServiceI {
List<DepartmentCO> getDeptList(); List<DepartmentCO> getDeptList();
Collection<List<DepartmentTreeInfoCO>> listAllTree(); List<DepartmentTreeInfoCO> listAllTree();
} }