郑根木 2 anni fa
parent
commit
412a447fe6
2 ha cambiato i file con 32 aggiunte e 13 eliminazioni
  1. +12
    -0
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormCache.java
  2. +20
    -13
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java

+ 12
- 0
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormCache.java Vedi File

@@ -63,4 +63,16 @@ public class ModelFormCache extends AbstractCache<ModelForm> {
list.sort(comparator);
return list;
}

public final Set<ModelForm> getFormsByPrj(long mcId) {
return getListByKey(mp, String.valueOf(mcId));
}

public final List<ModelForm> getFormsByPrj(long mcId, Comparator<ModelForm> comparator) {
Set<ModelForm> set = getListByKey(mp, String.valueOf(mcId));
if (set == null || set.isEmpty()) return null;
List<ModelForm> list = new ArrayList<>(set);
list.sort(comparator);
return list;
}
}

+ 20
- 13
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/design/preview/PreviewMenuTreeService.java Vedi File

@@ -3,11 +3,18 @@ package cc.smtweb.system.bpm.web.design.preview;
import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.annotation.SwParam;
import cc.smtweb.framework.core.annotation.SwService;
import cc.smtweb.framework.core.common.SwException;
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.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.ModelFormCache;
import cc.smtweb.system.bpm.web.design.preview.entity.MenuVO;
import org.apache.commons.lang3.StringUtils;

import java.util.ArrayList;
import java.util.Comparator;
import java.util.List;

@SwService
@@ -16,25 +23,25 @@ public class PreviewMenuTreeService {
private DbEngine dbEngine;

public R treeAll(@SwParam("module") String module, UserSession us) {
Long mcId = dbEngine.queryLong("select mc_id from sw_bpm.asp_model_catalog where mc_module=? and mc_site_id=?", module, us.getSiteId());
if (mcId == null) {
return R.error(module + " 模块不存在!");
// long prj_id = StringUtils.isNotEmpty(module) ? Long.parseLong(module) : 0L;
List<ModelForm> listForm = new ArrayList<>(ModelFormCache.getInstance().getAll());
listForm.sort((o1, o2) -> CommUtil.chineseCompare(o1.getTitle(), o2.getTitle()));
if (listForm.isEmpty()) throw new SwException("此项目无页面设计!");

List<MenuVO> list = new ArrayList<>(listForm.size());
for (ModelForm form: listForm) {
MenuVO menu = new MenuVO();
menu.setId(form.getId());
menu.setName(form.getTitle());
menu.setPath("/bpm/" + form.getId());
// menu.setParentId(-1L);
list.add(menu);
}
/*
* id: "11",
* name: "用户管理",
* icon: "",
* path: "/bpm/uc.system.user.list",
*/
String sql = "select model_id id, model_parent_id parent_id, model_key path, model_name name from sw_bpm.asp_model" +
" where model_mc_id=? and model_type=? and model_site_id=? order by model_order, model_id";
List<MenuVO> list = dbEngine.query(sql, MenuVO.class, mcId, 3, us.getSiteId());

MenuVO root = new MenuVO();
root.setName("项目");
root.setPath(module);
List<MenuVO> data = TreeDataUtil.buildTree(root, list, MenuVO.createTreeHandler());
fixPath(data, "/bpm/" + module);

return R.success(data);
}


Caricamento…
Annulla
Salva