|
|
@@ -4,20 +4,19 @@ import cc.smtweb.framework.core.common.SwEnum; |
|
|
|
import cc.smtweb.framework.core.common.SwMap; |
|
|
|
import cc.smtweb.framework.core.db.impl.DefaultEntity; |
|
|
|
import cc.smtweb.framework.core.db.vo.ModelCatalog; |
|
|
|
import cc.smtweb.framework.core.db.vo.ModelProject; |
|
|
|
import cc.smtweb.framework.core.util.CommUtil; |
|
|
|
import cc.smtweb.framework.core.util.JsonUtil; |
|
|
|
import cc.smtweb.framework.core.util.PubUtil; |
|
|
|
import cc.smtweb.system.bpm.web.design.db.ModelCatalogTreeHelper; |
|
|
|
import cc.smtweb.system.bpm.web.design.db.ModelProjectCache; |
|
|
|
import cc.smtweb.system.bpm.web.design.form.define.PageDataset; |
|
|
|
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageListHandler; |
|
|
|
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageLoadHandler; |
|
|
|
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageSaveHandler; |
|
|
|
import cc.smtweb.system.bpm.web.engine.dynPage.DynPageTreeHandler; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
import java.util.Set; |
|
|
|
import java.util.*; |
|
|
|
|
|
|
|
/** |
|
|
|
* @Author: tanghp |
|
|
@@ -29,6 +28,9 @@ public class MenuHandler { |
|
|
|
@Override |
|
|
|
public DynPageTreeHandler getTreeWorker(SwMap filter, PageDataset pageDataSet) { |
|
|
|
DynPageTreeHandler treeHandler = new MenuTreeHandler(pageId, filter, pageDataSet); |
|
|
|
if (pageDataSet.name.equals("mcTree")) { |
|
|
|
treeHandler = new MenuCatalogTreeHandler(pageId, filter, pageDataSet); |
|
|
|
} |
|
|
|
treeHandler.init(params, us); |
|
|
|
return treeHandler; |
|
|
|
} |
|
|
@@ -81,6 +83,76 @@ public class MenuHandler { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static class MenuCatalogTreeHandler extends DynPageTreeHandler { |
|
|
|
private ModelCatalogTreeHelper mcTreeHelper = new ModelCatalogTreeHelper(); |
|
|
|
|
|
|
|
public MenuCatalogTreeHandler(long pageId, SwMap filter, PageDataset pageDataSet) { |
|
|
|
super(pageId, filter, pageDataSet); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected List<SwMap> getChildren(long id) { |
|
|
|
List<SwMap> list = new ArrayList<>(); |
|
|
|
buildTreeData(list, id); |
|
|
|
return list; |
|
|
|
} |
|
|
|
|
|
|
|
private void buildTreeData(List<SwMap> list, long id) { |
|
|
|
if (id <= 0) { |
|
|
|
Collection<ModelProject> mpList = ModelProjectCache.getInstance().getAll(); |
|
|
|
for (ModelProject mp : mpList) { |
|
|
|
SwMap row = new SwMap(); |
|
|
|
row.put("mc_id", mp.getId()); |
|
|
|
row.put("mc_name", mp.getName()); |
|
|
|
list.add(row); |
|
|
|
/*List<SwMap> children = new ArrayList<>(); |
|
|
|
buildTreeData(children, mp.getId()); |
|
|
|
if (PubUtil.isEmpty(children)) continue; |
|
|
|
row.put("children", children);*/ |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
ModelProject mp = ModelProjectCache.getInstance().get(id); |
|
|
|
if (mp != null) { |
|
|
|
List<ModelCatalog> mcList = mcTreeHelper.getChildren(0, mp.getId(), true, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName())); |
|
|
|
if (PubUtil.isEmpty(mcList)) return; |
|
|
|
for (ModelCatalog mc : mcList) { |
|
|
|
SwMap row = new SwMap(); |
|
|
|
row.put("mc_id", mc.getId()); |
|
|
|
row.put("mc_name", mc.getName()); |
|
|
|
list.add(row); |
|
|
|
/*List<SwMap> children = new ArrayList<>(); |
|
|
|
buildTreeData(children, mc.getId()); |
|
|
|
if (PubUtil.isEmpty(children)) continue; |
|
|
|
row.put("children", children);*/ |
|
|
|
} |
|
|
|
return; |
|
|
|
} |
|
|
|
List<ModelCatalog> mcList = mcTreeHelper.getChildren(id, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName())); |
|
|
|
if (PubUtil.isEmpty(mcList)) return; |
|
|
|
for (ModelCatalog mc : mcList) { |
|
|
|
SwMap row = new SwMap(); |
|
|
|
row.put("mc_id", mc.getId()); |
|
|
|
row.put("mc_name", mc.getName()); |
|
|
|
list.add(row); |
|
|
|
/*List<SwMap> children = new ArrayList<>(); |
|
|
|
buildTreeData(children, mc.getId()); |
|
|
|
if (PubUtil.isEmpty(children)) continue; |
|
|
|
row.put("children", children);*/ |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected long getId(SwMap bean) { |
|
|
|
return bean.readLong("mc_id"); |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
protected String getText(SwMap bean) { |
|
|
|
return bean.readString("mc_name"); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
static class MenuTreeHandler extends DynPageTreeHandler { |
|
|
|
private ModelCatalogTreeHelper mcTreeHelper = new ModelCatalogTreeHelper(); |
|
|
|
|
|
|
|