mirror of
https://github.com/hs-web/hsweb-framework.git
synced 2026-05-07 21:55:57 +08:00
fix(基础功能): 解决根节点id可能为空的问题 (#224)
This commit is contained in:
@@ -184,11 +184,6 @@ public interface TreeSupportEntity<PK> extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(root.getChildren())) {
|
||||
target.add(root);
|
||||
return;
|
||||
}
|
||||
|
||||
//尝试设置id
|
||||
PK parentId = root.getId();
|
||||
if (parentId == null) {
|
||||
@@ -196,6 +191,11 @@ public interface TreeSupportEntity<PK> extends Entity {
|
||||
root.setId(parentId);
|
||||
}
|
||||
|
||||
if (CollectionUtils.isEmpty(root.getChildren())) {
|
||||
target.add(root);
|
||||
return;
|
||||
}
|
||||
|
||||
//所有节点处理队列
|
||||
Queue<T> queue = new LinkedList<>();
|
||||
queue.add(root);
|
||||
|
||||
Reference in New Issue
Block a user