Browse Source

预览接口先通过module过滤下数据

master
FLYPHT 2 years ago
parent
commit
9d55953dfd
2 changed files with 12 additions and 3 deletions
  1. +9
    -1
      smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelProjectCache.java
  2. +3
    -2
      smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java

+ 9
- 1
smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelProjectCache.java View File

@@ -14,11 +14,13 @@ import java.util.List;
*/
@SwCache(ident = "ASP_MODEL_PROJECT", title = "项目定义")
public class ModelProjectCache extends AbstractCache<ModelProject> {
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> {
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()): "";
}
}

+ 3
- 2
smtweb-framework/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java View File

@@ -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<ModelForm> listForm = new ArrayList<>(ModelFormCache.getInstance().getAll());
String prj_id = ModelProjectCache.getInstance().getIdByModule(module);
List<ModelForm> 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("此项目无页面设计!");



Loading…
Cancel
Save