摘要
使用递归实现查询下级节点,直接上代码
/**
* @Author: 石银博
* @Description: 获取该节点所有下级部门(不包含该节点部门)
* @DateTime: 2022/8/18 15:30
* @Params: deptCodes 部门id
* @Return
*/
private List<ZzDepartment> getAllChildrenNodeByParent(List<String> deptCodes){
List<ZzDepartment> departments = zzDepartmentMapper.getChildrenNodeByDeptCode(deptCodes);
if (!CollectionUtils.isEmpty(departments)){
List<String> collect = departments.stream().map(item -> item.getDeptCode()).collect(Collectors.toList());
departments.addAll(getAllChildrenNodeByParent(collect));
return departments;
}else {
return Lists.newArrayList();
}
}
标签:下级,List,departments,collect,deptCodes,Java,节点
From: https://www.cnblogs.com/simplejavahome/p/16599523.html