Skip to content

Commit

Permalink
fix(基础功能): 解决根节点id可能为空的问题 (#224)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyouji authored Aug 17, 2023
1 parent e918889 commit ce655e7
Showing 1 changed file with 5 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,18 +184,18 @@ static <T extends TreeSupportEntity<PK>, PK> void expandTree2List(T root, List<T
}
}

if (CollectionUtils.isEmpty(root.getChildren())) {
target.add(root);
return;
}

//尝试设置id
PK parentId = root.getId();
if (parentId == null) {
parentId = idGenerator.generate();
root.setId(parentId);
}

if (CollectionUtils.isEmpty(root.getChildren())) {
target.add(root);
return;
}

//所有节点处理队列
Queue<T> queue = new LinkedList<>();
queue.add(root);
Expand Down

0 comments on commit ce655e7

Please sign in to comment.