生成树结构数据
生成树结构数据
private List<SysDept> getChild(int parentKey, List<SysDept> deptList) {
List<SysDept> childrenList = new ArrayList();
if (!CollectionUtils.isEmpty(deptList)) {
Iterator var4 = deptList.iterator();
SysDept node;
while(var4.hasNext()) {
node = (SysDept)var4.next();
if (Objects.equals(node.getDeptParentId(), parentKey)) {
childrenList.add(node);
}
}
var4 = childrenList.iterator();
while(var4.hasNext()) {
node = (SysDept)var4.next();
List<SysDept> child = this.getChild(node.getDeptId(), deptList);
List<SysDept> old = node.getChildren();
old.addAll(child);
node.setChildren(old);
}
}
return childrenList;
}

被折叠的 条评论
为什么被折叠?



