部门树状结构调整格式

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("所有企业下部门树状所有数据")
@PostMapping("/listAllTree")
public MultiResponse<List<DepartmentTreeInfoCO>> listAllTree() {
public MultiResponse<DepartmentTreeInfoCO> listAllTree() {
return MultiResponse.of(departmentService.listAllTree());
}

View File

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

View File

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