From ce655e7fcbb8f3c8b40475b37e41eb8fa015b42e Mon Sep 17 00:00:00 2001 From: Zhang Ji <125540670@qq.com> Date: Thu, 17 Aug 2023 18:32:51 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=9F=BA=E7=A1=80=E5=8A=9F=E8=83=BD):=20?= =?UTF-8?q?=E8=A7=A3=E5=86=B3=E6=A0=B9=E8=8A=82=E7=82=B9id=E5=8F=AF?= =?UTF-8?q?=E8=83=BD=E4=B8=BA=E7=A9=BA=E7=9A=84=E9=97=AE=E9=A2=98=20(#224)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/api/crud/entity/TreeSupportEntity.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/TreeSupportEntity.java b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/TreeSupportEntity.java index 9d01bca8f..a1936853c 100644 --- a/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/TreeSupportEntity.java +++ b/hsweb-commons/hsweb-commons-api/src/main/java/org/hswebframework/web/api/crud/entity/TreeSupportEntity.java @@ -184,11 +184,6 @@ public interface TreeSupportEntity 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 extends Entity { root.setId(parentId); } + if (CollectionUtils.isEmpty(root.getChildren())) { + target.add(root); + return; + } + //所有节点处理队列 Queue queue = new LinkedList<>(); queue.add(root);