From ab76f1bb0240c5c532a22fbbc5b2573814dcc286 Mon Sep 17 00:00:00 2001 From: "1437892690@qq.com" <1437892690@qq.com> Date: Fri, 22 Nov 2024 21:00:19 +0800 Subject: [PATCH] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E5=90=8E=E7=AB=AF-?= =?UTF-8?q?=E5=AE=9A=E5=88=B6=E5=8C=96=E8=A1=A8=E5=8D=95=E6=8E=A7=E4=BB=B6?= =?UTF-8?q?-=E8=87=AA=E5=8A=A8=E5=8C=96=E6=9C=8D=E5=8A=A1=E8=A1=A8?= =?UTF-8?q?=E5=8D=95=E5=AE=B9=E5=99=A8=E6=8E=A7=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1293524304101376]后端-定制化表单控件-自动化服务表单容器控件 http://192.168.0.96:8090/demo/rdm.html#/task-detail/939050947543040/939050947543050/1293524304101376 --- .../AllVisibleAutoexecServiceForTreeApi.java | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/src/main/java/neatlogic/module/autoexec/api/service/AllVisibleAutoexecServiceForTreeApi.java b/src/main/java/neatlogic/module/autoexec/api/service/AllVisibleAutoexecServiceForTreeApi.java index 593ebcbe..a1dc5b18 100644 --- a/src/main/java/neatlogic/module/autoexec/api/service/AllVisibleAutoexecServiceForTreeApi.java +++ b/src/main/java/neatlogic/module/autoexec/api/service/AllVisibleAutoexecServiceForTreeApi.java @@ -23,6 +23,7 @@ import neatlogic.framework.autoexec.auth.AUTOEXEC_BASE; import neatlogic.framework.autoexec.constvalue.AutoexecServiceType; import neatlogic.framework.autoexec.dto.service.AutoexecServiceNodeVo; import neatlogic.framework.autoexec.dto.service.AutoexecServiceSearchVo; +import neatlogic.framework.common.constvalue.ApiParamType; import neatlogic.framework.dto.AuthenticationInfoVo; import neatlogic.framework.restful.annotation.*; import neatlogic.framework.restful.constvalue.OperationTypeEnum; @@ -60,7 +61,9 @@ public class AllVisibleAutoexecServiceForTreeApi extends PrivateApiComponentBase return null; } - @Input({}) + @Input({ + @Param(name = "needService", type = ApiParamType.BOOLEAN, defaultValue = "false", desc = "是否需要服务节点数据") + }) @Output({ @Param(explode = AutoexecServiceNodeVo[].class, desc = "服务目录树结构数据") }) @@ -102,33 +105,36 @@ public class AllVisibleAutoexecServiceForTreeApi extends PrivateApiComponentBase leafNodeList.add(nodeVo); } } - for (AutoexecServiceNodeVo nodeVo : allNodeList) { - nodeVo.getChildrenCount(); - } - // 遍历所有叶子节点,找出叶子节点所有上游节点ID,并将叶子节点从树中移除 - List visibleNodeIdList = new ArrayList<>(); + // 遍历所有叶子节点,找出叶子节点所有上游节点ID + List visibleCatalogNodeIdList = new ArrayList<>(); for (AutoexecServiceNodeVo nodeVo : leafNodeList) { AutoexecServiceNodeVo tempNodeVo = nodeVo; - while(true) { + while (true) { AutoexecServiceNodeVo parent = tempNodeVo.getParent(); if (parent == null) { break; } - if (visibleNodeIdList.contains(parent.getId())) { + if (visibleCatalogNodeIdList.contains(parent.getId())) { break; } - visibleNodeIdList.add(parent.getId()); + visibleCatalogNodeIdList.add(parent.getId()); tempNodeVo = parent; } - AutoexecServiceNodeVo parent = nodeVo.getParent(); - if (parent != null) { - nodeVo.setParent(null); - parent.removeChild(nodeVo); + } + Boolean needService = paramObj.getBoolean("needService"); + if (!Objects.equals(needService, true)) { + // 遍历所有叶子节点,并将叶子节点从树中移除 + for (AutoexecServiceNodeVo nodeVo : leafNodeList) { + AutoexecServiceNodeVo parent = nodeVo.getParent(); + if (parent != null) { + nodeVo.setParent(null); + parent.removeChild(nodeVo); + } } } // 遍历所有节点,把节点id不在visibleNodeIdList中的节点从树中移除 for (AutoexecServiceNodeVo nodeVo : allNodeList) { - if (!visibleNodeIdList.contains(nodeVo.getId())) { + if (Objects.equals(nodeVo.getType(), AutoexecServiceType.CATALOG.getValue()) && !visibleCatalogNodeIdList.contains(nodeVo.getId())) { AutoexecServiceNodeVo parent = nodeVo.getParent(); if (parent != null) { nodeVo.setParent(null); -- Gitee