|
|
@@ -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; |
|
|
|
|
|
|
|
} |
|
|
|
} |