From 9768199202052110e49ab38b2caf00eda13764e7 Mon Sep 17 00:00:00 2001 From: flytreeleft Date: Thu, 19 Sep 2024 22:23:57 +0800 Subject: [PATCH 1/2] =?UTF-8?q?Nop=20Biz:=20=E4=BF=AE=E5=A4=8D=20TreeEntit?= =?UTF-8?q?yHelper=20=E4=B8=AD=E6=8B=BC=E6=8E=A5=E6=A0=B9=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E8=BF=87=E6=BB=A4=E6=9D=A1=E4=BB=B6=E4=B8=8D=E5=87=86?= =?UTF-8?q?=E7=A1=AE=E7=9A=84=20bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/nop/biz/crud/TreeEntityHelper.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/nop-biz/src/main/java/io/nop/biz/crud/TreeEntityHelper.java b/nop-biz/src/main/java/io/nop/biz/crud/TreeEntityHelper.java index 414ce2845..c2ae89ee3 100644 --- a/nop-biz/src/main/java/io/nop/biz/crud/TreeEntityHelper.java +++ b/nop-biz/src/main/java/io/nop/biz/crud/TreeEntityHelper.java @@ -82,11 +82,13 @@ public class TreeEntityHelper { DaoQueryHelper.appendFilter(sb, "b", filter); } if (levelProp != null && rootLevelValue != null) { + if (filter != null) + sb.and(); sb.append("\n ").owner("b").append(levelProp).append("=").param(ConvertHelper.toInt(rootLevelValue)); } else { - // 如果 parentProp 属性在 filter 中存在,以传入的属性为准 - boolean hasParentProp = filter != null && ((TreeBean) filter).nodeWithAttr("name", parentProp) == null; - if (filter == null || hasParentProp) { + // 如果 parentProp 属性在 filter 中存在,则以传入的属性为准 + boolean hasParentProp = filter != null && ((TreeBean) filter).nodeWithAttr("name", parentProp) != null; + if (!hasParentProp) { if (filter != null) sb.and(); sb.append("\n ").owner("b").append(parentProp); -- Gitee From 4697ea8c0090b56b3dbd4395583eca9ba787c829 Mon Sep 17 00:00:00 2001 From: flytreeleft Date: Thu, 19 Sep 2024 22:30:39 +0800 Subject: [PATCH 2/2] =?UTF-8?q?Docs:=20=E5=B0=86=E6=96=87=E6=A1=A3?= =?UTF-8?q?=E4=B8=AD=E7=9A=84=20@TreeChildren(max=3D5)=20=E4=BF=AE?= =?UTF-8?q?=E6=AD=A3=E4=B8=BA=20@TreeChildren(max:5)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/dev-guide/graphql/graphql-java.md | 16 +++++++++------- docs/tutorial/simple/7-graphql-extension.md | 14 ++++++++------ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/docs/dev-guide/graphql/graphql-java.md b/docs/dev-guide/graphql/graphql-java.md index ffb15a177..3697126a9 100644 --- a/docs/dev-guide/graphql/graphql-java.md +++ b/docs/dev-guide/graphql/graphql-java.md @@ -465,7 +465,7 @@ GraphQL是一种强类型的框架,它要求所有数据都有明确的类型 NopGraphQL引入了一个特殊的Scalar类型: Map,可以利用它来描述那些动态数据结构。例如 -```js +```graphql type QueryBean{ filter: Map orderBy: [OrderFieldBean] @@ -476,15 +476,17 @@ type QueryBean{ 对于单位树、菜单树这样的树形结构的获取,NopGraphQL通过Directive机制提供了一个扩展语法,可以直接表达递归拉取数据,例如 -```js -NopAuthDept_findList{ - value: id, - label: displayName - children @TreeChildren(max=5) +```graphql +query { + NopAuthDept_findList{ + value: id + label: displayName + children @TreeChildren(max:5) + } } ``` -`@TreeChildren(max=5)`表示按照本层的结构最多嵌套5层。 +`@TreeChildren(max:5)`表示按照本层的结构最多嵌套5层。 ## 文件上传下载 diff --git a/docs/tutorial/simple/7-graphql-extension.md b/docs/tutorial/simple/7-graphql-extension.md index a8c3e5f0b..2060a419c 100644 --- a/docs/tutorial/simple/7-graphql-extension.md +++ b/docs/tutorial/simple/7-graphql-extension.md @@ -51,15 +51,17 @@ query{ 对于单位树、菜单树这样的树形结构的获取,NopGraphQL通过Directive机制提供了一个扩展语法,可以直接表达递归拉取数据,例如 -``` -NopAuthDept_findList{ - value: id, - label: displayName - children @TreeChildren(max=5) +```graphql +query { + NopAuthDept_findList{ + value: id + label: displayName + children @TreeChildren(max:5) + } } ``` -* `@TreeChildren(max=5)`表示按照本层的结构最多嵌套5层。 +* `@TreeChildren(max:5)`表示按照本层的结构最多嵌套5层。 ## 三. Map类型 -- Gitee