想要层层获取科室下的人员数量需要先递归获取到科室树结构
- 先获取科室结构
//递归生成树状结构数据
List<DeptTreeApiVO> trees = new ArrayList<>();
//查找顶级科室
Set<Long> deptIdSet = new HashSet<>();
deptPoList.forEach(d->deptIdSet.add(d.getDeptId()));
List<DeptPO> rootDeptList = new ArrayList<>();
deptPoList.forEach(d->{
if (!deptIdSet.contains(d.getParentId())){
rootDeptList.add(d);
}
});