郑根木 2 anni fa
parent
commit
c1dc6518d2
2 ha cambiato i file con 33 aggiunte e 4 eliminazioni
  1. +31
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHandler.java
  2. +2
    -2
      smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageService.java

+ 31
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHandler.java Vedi File

@@ -4,7 +4,9 @@ import cc.smtweb.framework.core.common.R;
import cc.smtweb.framework.core.common.SwEnum;
import cc.smtweb.framework.core.common.SwException;
import cc.smtweb.framework.core.common.SwMap;
import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.mvc.service.AbstractHandler;
import cc.smtweb.framework.core.mvc.service.SqlNamedPara;
import cc.smtweb.framework.core.mvc.service.SwListData;
import cc.smtweb.framework.core.session.UserSession;
import cc.smtweb.system.bpm.web.design.form.ModelFormHelper;
@@ -14,6 +16,8 @@ import cc.smtweb.system.bpm.web.design.form.define.PageDatasets;
import java.util.HashMap;
import java.util.Map;

import static cc.smtweb.framework.core.common.SwConsts.TOTAL_KEY;

/**
* Created by Akmm at 2022/5/26 17:45
*/
@@ -70,10 +74,10 @@ public class DynPageHandler extends AbstractHandler {
}

public R loadOne() {
//数据集
//数据集
String dbName = params.readString("dataset");
//过滤条件
SwMap filter = (SwMap)params.get("filter");
SwMap filter = (SwMap) params.get("filter");
//对应的数据集定义
PageDataset pageDataSet = findDataset(dbName);
if (pageDataSet == null) throw new SwException("没有找到指定的的数据集定义:" + dbName + "!");
@@ -89,4 +93,29 @@ public class DynPageHandler extends AbstractHandler {

return R.success(bean);
}

/**
* 计算分页数据
*
* @return
*/
public R getTotal() {
//数据集
String dbName = params.readString("dataset");
//过滤条件
SwMap filter = (SwMap) params.get("filter");
//对应的数据集定义
PageDataset pageDataSet = findDataset(dbName);
if (pageDataSet == null) throw new SwException("没有找到指定的的数据集定义:" + dbName + "!");

SqlNamedPara sqlPara = DynPageHelper.buildSumSql(pageDataSet, filter);

SwMap mapFooter = DbEngine.getInstance().queryEntityN(sqlPara.sql, sqlPara.mapParas, SwMap.class);

R r = R.success();
r.put("total", mapFooter.get(TOTAL_KEY));
r.put("footer", mapFooter);
return r;

}
}

+ 2
- 2
smtweb-system/sw-system-bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageService.java Vedi File

@@ -19,7 +19,7 @@ public class DynPageService extends AbstractCompService {
protected AbstractHandler createHandler(String type) {
switch (type) {
case TYPE_ADD:
return new DynPageAddHandler();
return new DynPageHandler();
case TYPE_LOAD:
return new DynPageLoadOneHandler();
case TYPE_SAVE:
@@ -32,7 +32,7 @@ public class DynPageService extends AbstractCompService {

//新增
public R add(@SwBody SwMap params, UserSession us) {
return pageHandler(params, us, TYPE_ADD, handler -> ((DynPageAddHandler)handler).add());
return pageHandler(params, us, TYPE_ADD, handler -> ((DynPageHandler)handler).add());
}

//保存指定数据集


Caricamento…
Annulla
Salva