public static List<RuleDict> getSub(String id, List<RuleDict> allRuleDict) {
List<RuleDict> children = allRuleDict.stream()
.filter(RuleDict -> RuleDict.getParentId().equals(id))
.collect(Collectors.toList());
List<RuleDict> result = new ArrayList<>(children);
if (CollectionUtils.isNotEmpty(children)) {
for (RuleDict item : children) {
result.addAll(getSub(item.getId(), allRuleDict));
}
}
List<RuleDict> collect = result.stream().filter(ruleDict -> ruleDict.getIsLeaf().equals(1)).collect(Collectors.toList());
return collect;
}
根据id,获取所有子部门列表(包括隔代子部门,一直到叶子节点)
最新推荐文章于 2022-12-22 16:20:03 发布