浏览代码

树筛选

4.0
lip 2 年前
父节点
当前提交
bbdd0ebd45
共有 3 个文件被更改,包括 19 次插入8 次删除
  1. +11
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageLoadHandler.java
  2. +5
    -0
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageService.java
  3. +3
    -7
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageTreeHandler.java

+ 11
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageLoadHandler.java 查看文件

@@ -54,7 +54,7 @@ public class DynPageLoadHandler extends AbstractDynPageHandler {
SwMap data = new SwMap();
afterAddBean(dataSet, data);
mapRet.put(dataSet.name, DynRetBean.createBean(data));
} else {//非枚举 if (!SwEnum.DatasetType.ENUM.value.equals(dataSet.type))
} else {//非枚举 if (!SwEnum.DatasetType.ENUM.value.equals(dataSet.type))
SwListData listData = SwListData.create(null, 0);
afterAddList(dataSet, listData);
mapRet.put(dataSet.name, DynRetBean.createList(listData));
@@ -84,6 +84,16 @@ public class DynPageLoadHandler extends AbstractDynPageHandler {
return R.success(DynRetBean.createBean(data));
}

public R treeFilter() {
//过滤条件
SwMap filter = params.readMap("filter");
//对应的数据集定义
PageDataset pageDataSet = readParamDs();
DynRetBean bean = DynRetBean.createList(SwListData.create(getTreeWorker(filter, pageDataSet).buildFilter(), 0));

return R.success(bean);
}

public R loadOne() {
//过滤条件
SwMap filter = params.readMap("filter");


+ 5
- 0
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageService.java 查看文件

@@ -67,4 +67,9 @@ public class DynPageService extends AbstractCompService {
public R total(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_LOAD, handler -> ((DynPageLoadHandler)handler).getTotal());
}

//树过滤
public R treeFilter(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_LOAD, handler -> ((DynPageLoadHandler)handler).treeFilter());
}
}

+ 3
- 7
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageTreeHandler.java 查看文件

@@ -4,20 +4,14 @@ import cc.smtweb.framework.core.common.SwConsts;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityDao;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.impl.DefaultEntity;
import cc.smtweb.framework.core.db.vo.ModelCatalog;
import cc.smtweb.framework.core.db.vo.ModelField;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.BizException;
import cc.smtweb.framework.core.mvc.service.AbstractTreeHandler;
import cc.smtweb.framework.core.mvc.service.SqlNamedPara;
import cc.smtweb.framework.core.mvc.service.SqlPara;
import cc.smtweb.system.bpm.web.design.form.ModelForm;
import cc.smtweb.system.bpm.web.design.form.define.PageDataset;

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

/**
@@ -42,7 +36,7 @@ public class DynPageTreeHandler extends AbstractTreeHandler<SwMap> {
ModelTable table = ModelTableCache.getInstance().get(pageDataSet.masterTable);
if (table == null) throw new BizException("未找到数据集表定义:" + pageDataSet.masterTable);

String text = "%" + params.readString("text") + "%";
String text = "%" + filter.readString("text") + "%";
SqlNamedPara sqlPara = buildFilterSqlPara(text);

return DbEngine.getInstance().queryN(sqlPara.sql, sqlPara.mapParas, SwMap.class);
@@ -67,6 +61,8 @@ public class DynPageTreeHandler extends AbstractTreeHandler<SwMap> {
* @return
*/
protected SqlNamedPara buildFilterSqlPara(String text) {
//
filter.remove("parent_id");
return DynPageHelper.buildFilterSelectSql(pageDataSet, filter, text);
}



正在加载...
取消
保存