Bladeren bron

listhandler.buildSumSql调整,允许不写

4.0
郑根木 2 jaren geleden
bovenliggende
commit
2664e7582c
4 gewijzigde bestanden met toevoegingen van 10 en 15 verwijderingen
  1. +2
    -6
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java
  2. +4
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageListHandler.java
  3. +0
    -4
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/common/FlowModelListHandler.java
  4. +4
    -4
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java

+ 2
- 6
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java Bestand weergeven

@@ -18,6 +18,7 @@ import cc.smtweb.framework.core.util.SqlUtil;
import cc.smtweb.framework.core.util.StringUtil;
import cc.smtweb.system.bpm.web.design.form.define.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.lang.NonNull;

import java.util.HashMap;
import java.util.HashSet;
@@ -144,12 +145,7 @@ public class DynPageHelper {
* @param params
* @return
*/
public static SqlNamedPara buildSumSql(PageDataset dataSet, Map<String, Object> params) {
return buildSumSqlEx(dataSet, params, null);
}

public static SqlNamedPara buildSumSqlEx(PageDataset dataSet, Map<String, Object> params, IBuildSqlListener listener) {
SqlNamedPara sqlNamedPara = buildSelectSqlEx(dataSet, params, listener);
public static SqlNamedPara buildSumSql(PageDataset dataSet, @NonNull SqlNamedPara sqlNamedPara) {
StringBuilder sql = new StringBuilder(256);
sql.append("select count(1) " + TOTAL_KEY);
for (PageDatasetField field : dataSet.fields) {


+ 4
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageListHandler.java Bestand weergeven

@@ -6,6 +6,7 @@ import cc.smtweb.framework.core.db.DbEngine;
import cc.smtweb.framework.core.db.EntityHelper;
import cc.smtweb.framework.core.db.cache.ModelTableCache;
import cc.smtweb.framework.core.db.vo.ModelTable;
import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.framework.core.mvc.service.AbstractListHandler;
import cc.smtweb.framework.core.mvc.service.SqlNamedPara;
import cc.smtweb.framework.core.mvc.service.SqlPara;
@@ -75,7 +76,9 @@ public class DynPageListHandler extends AbstractListHandler {

@Override
protected SqlNamedPara buildSumSqlPara() {
return DynPageHelper.buildSumSql(pageDataSet, filter);
SqlNamedPara sqlPara = getCache(KEY_SQLPARA);
if (sqlPara == null) sqlPara = buildDataSql();
return DynPageHelper.buildSumSql(pageDataSet, sqlPara);
}

@Override


+ 0
- 4
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/model/common/FlowModelListHandler.java Bestand weergeven

@@ -24,8 +24,4 @@ public class FlowModelListHandler extends ModelListHandler {
return DynPageHelper.buildSelectSqlEx(pageDataSet, filter, sqlListener);
}

@Override
protected SqlNamedPara buildSumSqlPara() {
return DynPageHelper.buildSumSqlEx(pageDataSet, filter, sqlListener);
}
}

+ 4
- 4
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/mvc/service/AbstractListHandler.java Bestand weergeven

@@ -140,9 +140,9 @@ public abstract class AbstractListHandler extends AbstractHandler {
}
}

protected SqlPara buildDataSql() {
protected <T extends SqlPara> T buildDataSql() {
//从缓存里看看有没有保存的sql缓存;
SqlPara sqlParaInCache = getCache(KEY_SQLPARA); //缓存里面的对象;
T sqlParaInCache = getCache(KEY_SQLPARA); //缓存里面的对象;
boolean query = sqlParaInCache == null || params.readBool("query");
if (!query) {
Map<String, Object> map = getCache(KEY_PARAMS);
@@ -164,7 +164,7 @@ public abstract class AbstractListHandler extends AbstractHandler {
}
}
}
SqlPara sqlPara = null;
T sqlPara = null;
if (query) {//新查询
//缓存里面没有对象,重新构建查询条件,重新计算汇总数;
buildParam();//构造过滤条件,设默认值
@@ -203,7 +203,7 @@ public abstract class AbstractListHandler extends AbstractHandler {
protected void afterQuery(List<SwMap> listData) {
}

protected abstract SqlPara buildSqlPara();
protected abstract <T extends SqlPara> T buildSqlPara();

//构建合计字段
private List<FooterField> getFooterFields() {


Laden…
Annuleren
Opslaan