From bb8b877cb55034ab4f6cf3636e9250a693001163 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Mon, 6 Nov 2023 17:26:29 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E9=87=8D=E5=BB=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=A7=86=E5=9B=BE=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=A7=9F=E6=88=B7=E6=8B=A5=E6=8A=A4=E7=9A=84?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=BB=84=E6=9D=83=E9=99=90=E9=87=8D=E5=BB=BA?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1018835753205760]重建数据库视图时,根据租户拥护的模块组权限重建对应的视图 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1018835753205760 --- .../core/RebuildDataBaseViewManager.java | 22 +++++++++++++------ 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/src/main/java/neatlogic/framework/rebuilddatabaseview/core/RebuildDataBaseViewManager.java b/src/main/java/neatlogic/framework/rebuilddatabaseview/core/RebuildDataBaseViewManager.java index 10ae2f00b..68a7367e8 100644 --- a/src/main/java/neatlogic/framework/rebuilddatabaseview/core/RebuildDataBaseViewManager.java +++ b/src/main/java/neatlogic/framework/rebuilddatabaseview/core/RebuildDataBaseViewManager.java @@ -17,32 +17,40 @@ package neatlogic.framework.rebuilddatabaseview.core; import neatlogic.framework.applicationlistener.core.ModuleInitializedListenerBase; +import neatlogic.framework.asynchronization.threadlocal.TenantContext; import neatlogic.framework.bootstrap.NeatLogicWebApplicationContext; import neatlogic.framework.common.RootComponent; +import neatlogic.framework.dto.module.ModuleGroupVo; +import neatlogic.framework.dto.module.ModuleVo; +import org.apache.commons.collections4.CollectionUtils; import java.util.*; @RootComponent public class RebuildDataBaseViewManager extends ModuleInitializedListenerBase { - private final static Map map = new HashMap<>(); - - public static IRebuildDataBaseView getHandler(String handler) { - return map.get(handler); - } + private final static Map> moduleGroup2HandlerListMap = new HashMap<>(); @Override protected void onInitialized(NeatLogicWebApplicationContext context) { Map myMap = context.getBeansOfType(IRebuildDataBaseView.class); for (Map.Entry entry : myMap.entrySet()) { IRebuildDataBaseView bean = entry.getValue(); - map.put(bean.getHandler(), bean); + moduleGroup2HandlerListMap.computeIfAbsent(context.getGroup(), key -> new ArrayList<>()).add(bean); } } public static List execute() { + List activeModuleList = TenantContext.get().getActiveModuleList(); List resultList = new ArrayList<>(); - List list = new ArrayList<>(map.values()); + List list = new ArrayList<>(); + List activeModuleGroupList = TenantContext.get().getActiveModuleGroupList(); + for (ModuleGroupVo moduleGroupVo : activeModuleGroupList) { + List handlerList = moduleGroup2HandlerListMap.get(moduleGroupVo.getGroup()); + if (CollectionUtils.isNotEmpty(handlerList)) { + list.addAll(handlerList); + } + } list.sort(Comparator.comparing(IRebuildDataBaseView::getSort)); for (IRebuildDataBaseView rebuildDataBaseView : list) { resultList.addAll(rebuildDataBaseView.execute()); -- Gitee From ffbcf3fbec04e3e3c3113866d9d2e8d47e6e7e91 Mon Sep 17 00:00:00 2001 From: linbangquan <1437892690@qq.com> Date: Mon, 6 Nov 2023 17:28:57 +0800 Subject: [PATCH 2/2] =?UTF-8?q?[=E5=8A=9F=E8=83=BD]=20=E9=87=8D=E5=BB=BA?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=A7=86=E5=9B=BE=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E7=A7=9F=E6=88=B7=E6=8B=A5=E6=8A=A4=E7=9A=84?= =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=BB=84=E6=9D=83=E9=99=90=E9=87=8D=E5=BB=BA?= =?UTF-8?q?=E5=AF=B9=E5=BA=94=E7=9A=84=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 关联 #[1018835753205760]重建数据库视图时,根据租户拥护的模块组权限重建对应的视图 http://192.168.0.96:8090/demo/rdm.html#/story-detail/939050947543040/939050947543042/1018835753205760 --- .../rebuilddatabaseview/core/RebuildDataBaseViewManager.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/neatlogic/framework/rebuilddatabaseview/core/RebuildDataBaseViewManager.java b/src/main/java/neatlogic/framework/rebuilddatabaseview/core/RebuildDataBaseViewManager.java index 68a7367e8..1b5b7d172 100644 --- a/src/main/java/neatlogic/framework/rebuilddatabaseview/core/RebuildDataBaseViewManager.java +++ b/src/main/java/neatlogic/framework/rebuilddatabaseview/core/RebuildDataBaseViewManager.java @@ -21,7 +21,6 @@ import neatlogic.framework.asynchronization.threadlocal.TenantContext; import neatlogic.framework.bootstrap.NeatLogicWebApplicationContext; import neatlogic.framework.common.RootComponent; import neatlogic.framework.dto.module.ModuleGroupVo; -import neatlogic.framework.dto.module.ModuleVo; import org.apache.commons.collections4.CollectionUtils; import java.util.*; @@ -41,7 +40,6 @@ public class RebuildDataBaseViewManager extends ModuleInitializedListenerBase { } public static List execute() { - List activeModuleList = TenantContext.get().getActiveModuleList(); List resultList = new ArrayList<>(); List list = new ArrayList<>(); List activeModuleGroupList = TenantContext.get().getActiveModuleGroupList(); -- Gitee