Browse Source

系统:自定义sql的表替换,[#tableName#]

4.0
郑根木 2 years ago
parent
commit
7893a1fb6e
4 changed files with 12 additions and 5 deletions
  1. +2
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java
  2. +1
    -1
      smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageLoadHandler.java
  3. +0
    -2
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisSysTask.java
  4. +9
    -1
      smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/SqlUtil.java

+ 2
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageHelper.java View File

@@ -14,6 +14,7 @@ import cc.smtweb.framework.core.exception.SwException;
import cc.smtweb.framework.core.mvc.service.SqlNamedPara;
import cc.smtweb.framework.core.util.MapUtil;
import cc.smtweb.framework.core.util.NumberUtil;
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;
@@ -187,7 +188,7 @@ public class DynPageHelper {
if (listener != null) listener.buildSelect(dataSet, sql);
return sql.toString();
} else {
return dataSet.sql;
return SqlUtil.replaceTable(dataSet.sql);
}
}



+ 1
- 1
smtweb-framework/bpm/src/main/java/cc/smtweb/system/bpm/web/engine/dynPage/DynPageLoadHandler.java View File

@@ -104,7 +104,7 @@ public class DynPageLoadHandler extends AbstractDynPageHandler {
SwMap filter = params.readMap("filter");
//对应的数据集定义
PageDataset pageDataSet = readParamDs();
DynRetBean bean = null;
if (SwEnum.DatasetType.LIST.value.equals(pageDataSet.type)) {//列表类
bean = DynRetBean.createList(getListWorker(filter, pageDataSet).buildListData());


+ 0
- 2
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/cache/redis/RedisSysTask.java View File

@@ -38,8 +38,6 @@ public class RedisSysTask implements ISysTask {
RedisBroadcastEvent redisBroadcast = JsonUtil.parse(message, RedisBroadcastEvent.class);

applicationContext.publishEvent(redisBroadcast);

// log.debug("Redis [" + channel + "] message:" + redisBroadcast);
}
});



+ 9
- 1
smtweb-framework/core/src/main/java/cc/smtweb/framework/core/util/SqlUtil.java View File

@@ -3,6 +3,7 @@ package cc.smtweb.framework.core.util;
import cc.smtweb.framework.core.common.AbstractEnum;
import cc.smtweb.framework.core.common.IntEnum;
import cc.smtweb.framework.core.common.StrEnum;
import cc.smtweb.framework.core.db.EntityHelper;
import org.apache.commons.lang3.StringUtils;

import java.util.List;
@@ -22,7 +23,14 @@ public abstract class SqlUtil {
* @return
*/
public static String replaceTable(String sql) {
return sql;
return StringUtil.myReplaceStrEx(sql, "[#", "#]", new StringUtil.IStrHanlder() {
@Override
public String work(String src) {
src = src.toUpperCase();
return EntityHelper.getSchemaTableName(src);
}
});

}

/**


Loading…
Cancel
Save