浏览代码

模块树展示

master
郑根木 2 年前
父节点
当前提交
4c97751eaf
共有 5 个文件被更改,包括 527 次插入336 次删除
  1. +18
    -24
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelCatalogTreeHandler.java
  2. +1
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java
  3. +1
    -1
      smtweb-framework/bpm/src/main/resources/config/application.yaml
  4. +1
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractTreeHandler.java
  5. +506
    -310
      smtweb-framework/core/src/main/resources/demo.json

+ 18
- 24
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/db/ModelCatalogTreeHandler.java 查看文件

@@ -73,35 +73,20 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
EntityDao<ModelForm> formdao = DbEngine.getInstance().findDao(ModelForm.class);
List<ModelForm> lf;
switch (type) {
case TYPE_FORM:
lf = formdao.queryWhere(" mf_prj_id=? and (mf_name like ? or mf_title like ?) order by tb_name", prj_id, text, text);
addForm(listRet, lf);
break;
case TYPE_PAGE:
lf = formdao.queryWhere(" mf_prj_id=? and mf_type<>? and (mf_name like ? or mf_title like ?) order by tb_name", prj_id, SwEnum.FormType.WIDGET.value, text, text);
addForm(listRet, lf);
break;
case TYPE_WIDGET:
lf = formdao.queryWhere(" mf_prj_id=? and mf_type=? and (mf_name like ? or mf_title like ?) order by tb_name", prj_id, SwEnum.FormType.WIDGET.value, text, text);
listRet.addAll(lf);
break;
default:
lf = formdao.queryWhere(" mf_prj_id=? and (mf_name like ? or mf_title like ?) order by tb_name", prj_id, text, text);
}
listRet.addAll(lf);
}
return listRet;
}

//添加页面,将模块子页面单独扔map,特殊处理
private void addForm(List<DefaultEntity> listRet, List<ModelForm> lf){
for (ModelForm mf: lf) {
if (mf.getParent() > 0) {
List<DefaultEntity> ch = mapFormChild.computeIfAbsent(mf.getParent(), k -> new ArrayList<>());
ch.add(mf);
} else {
listRet.add(mf);
}
}
}

@Override
protected List<DefaultEntity> getChildren(long id) {
List<ModelCatalog> list = mcTreeHelper.getChildren(id, prj_id, (o1, o2) -> CommUtil.chineseCompare(o1.getName(), o2.getName()));
@@ -168,6 +153,19 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
listRet.addAll(set);
}

//添加页面,将子页面单独清出来
private void addForm(List<DefaultEntity> listRet, List<ModelForm> lf, boolean exc_widget) {
for (ModelForm mf : lf) {
if (exc_widget && mf.getType() == SwEnum.FormType.WIDGET.value) continue;
if (mf.getParent() > 0) {
List<DefaultEntity> ch = mapFormChild.computeIfAbsent(mf.getParent(), k -> new ArrayList<>());
ch.add(mf);
} else {
listRet.add(mf);
}
}
}

//增加页面定义
private void addPageChildren(List<DefaultEntity> listRet, long mcid, int type) {
List<ModelForm> set = ModelFormCache.getInstance().getFormsByMc(mcid, (o1, o2) -> {
@@ -177,11 +175,7 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
if (set == null || set.isEmpty()) return;
switch (type) {
case TYPE_PAGE:
for (ModelForm form : set) {
if (form.getType() != SwEnum.FormType.WIDGET.value) {
listRet.add(form);
}
}
addForm(listRet, set, true);
break;
case TYPE_WIDGET:
for (ModelForm form : set) {
@@ -191,7 +185,7 @@ public class ModelCatalogTreeHandler extends AbstractTreeHandler<DefaultEntity>
}
break;
default:
listRet.addAll(set);
addForm(listRet, set, false);
}
}



+ 1
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/design/form/ModelFormSaveHandler.java 查看文件

@@ -81,6 +81,7 @@ public class ModelFormSaveHandler extends DefaultSaveHandler<ModelForm> {
page.setId(DbEngine.getInstance().nextId());
page.setOption("{}");
page.setDataset(null);
page.setContent(null);
page.setTmpl(null);
page.setType(SwEnum.FormType.PAGE.value);
page.setName(name);


+ 1
- 1
smtweb-framework/bpm/src/main/resources/config/application.yaml 查看文件

@@ -27,7 +27,7 @@ spring:
password:
datasource:
driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://127.0.0.1:3306/gdmz?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
url: jdbc:mysql://127.0.0.1:3306/smt_asp?useUnicode=true&characterEncoding=utf-8&allowMultiQueries=true&useSSL=false
username: root
password: root
servlet:


+ 1
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractTreeHandler.java 查看文件

@@ -58,7 +58,7 @@ public abstract class AbstractTreeHandler<T> extends AbstractHandler {
node.put("bean", row);
buildNode(node, row);
listRet.add(node);
if (!lazy) {
if (!lazy && !node.containsKey("children")) {
List<SwMap> list = buildNodes(children, lazy);
node.put("children", list);
}


+ 506
- 310
smtweb-framework/core/src/main/resources/demo.json
文件差异内容过多而无法显示
查看文件


正在加载...
取消
保存