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("此项目无页面设计!");