From 9d55953dfdbd5dc2153da89a23bd8479a10438fb Mon Sep 17 00:00:00 2001 From: FLYPHT <1035748121@qq.com> Date: Tue, 28 Jun 2022 13:20:02 +0800 Subject: [PATCH] =?UTF-8?q?=E9=A2=84=E8=A7=88=E6=8E=A5=E5=8F=A3=E5=85=88?= =?UTF-8?q?=E9=80=9A=E8=BF=87module=E8=BF=87=E6=BB=A4=E4=B8=8B=E6=95=B0?= =?UTF-8?q?=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cc/smtweb/system/bpm/web/design/db/ModelProjectCache.java | 10 +++++++++- .../system/bpm/web/design/preview/PreviewMenuTreeService.java | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelProjectCache.java b/smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelProjectCache.java index 2d059b6..0ba5e4a 100644 --- a/smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelProjectCache.java +++ b/smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelProjectCache.java @@ -14,11 +14,13 @@ import java.util.List; */ @SwCache(ident = "ASP_MODEL_PROJECT", title = "项目定义") public class ModelProjectCache extends AbstractCache { + private final static String mm = "m"; public static ModelProjectCache getInstance() { return CacheManager.getIntance().getCache(ModelProjectCache.class); } public ModelProjectCache() { + regMap(mm, k-> String.valueOf(k.getModule())); } @Override @@ -36,5 +38,11 @@ public class ModelProjectCache extends AbstractCache { ModelProject bean = get(id); return bean != null ? bean.getModule() : ""; } - + public ModelProject getByModule(String module){ + return getByKey(mm,module); + } + public String getIdByModule(String module) { + ModelProject bean = getByModule(module); + return bean !=null ? String.valueOf(bean.getId()): ""; + } } diff --git a/smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java b/smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java index 0d7b3ad..a579a12 100644 --- a/smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java +++ b/smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java @@ -9,6 +9,7 @@ import cc.smtweb.framework.core.db.DbEngine; import cc.smtweb.framework.core.session.UserSession; import cc.smtweb.framework.core.util.CommUtil; import cc.smtweb.system.bpm.util.TreeDataUtil; +import cc.smtweb.system.bpm.web.design.db.ModelProjectCache; import cc.smtweb.system.bpm.web.design.form.ModelForm; import cc.smtweb.system.bpm.web.design.form.ModelFormCache; @@ -21,8 +22,8 @@ public class PreviewMenuTreeService { private DbEngine dbEngine; public R treeAll(@SwParam("module") String module, UserSession us) { -// long prj_id = StringUtils.isNotEmpty(module) ? Long.parseLong(module) : 0L; - List listForm = new ArrayList<>(ModelFormCache.getInstance().getAll()); + String prj_id = ModelProjectCache.getInstance().getIdByModule(module); + List listForm = new ArrayList<>(ModelFormCache.getInstance().getFormsByPrj(Long.parseLong(prj_id))); listForm.sort((o1, o2) -> CommUtil.chineseCompare(o1.getTitle(), o2.getTitle())); if (listForm.isEmpty()) throw new BizException("此项目无页面设计!");