Commit 07605d8a authored by yanzg's avatar yanzg

修改MQ请求尸体,防止出错

parent 2975ef98
...@@ -99,7 +99,7 @@ public class DaoConst { ...@@ -99,7 +99,7 @@ public class DaoConst {
* 加载SQL语句模板 * 加载SQL语句模板
*/ */
public static final String SQL_LOAD = "{SELECT_OUTER_BEGIN}SELECT {FIELD} FROM {TABLE} AS a {INNER} WHERE 1=1" + public static final String SQL_LOAD = "{SELECT_OUTER_BEGIN}SELECT {FIELD} FROM {TABLE} AS a {INNER} WHERE 1=1" +
"{WHERE}{GROUP}{HAVING}{ORDER}{LIMIT}{SELECT_OUTER_END}"; "{WHERE}{GROUP}{HAVING}{ORDER}{LIMIT}{SELECT_OUTER_END}{LIMIT_END}";
/** /**
* 表名代码片段 * 表名代码片段
*/ */
...@@ -124,6 +124,14 @@ public class DaoConst { ...@@ -124,6 +124,14 @@ public class DaoConst {
* WHERE条件代码片段 * WHERE条件代码片段
*/ */
public static final String CODE_WHERE = "{WHERE}"; public static final String CODE_WHERE = "{WHERE}";
/**
* WHERE条件代码片段
*/
public static final String CODE_LIMIT = "{LIMIT}";
/**
* WHERE条件代码片段
*/
public static final String CODE_LIMIT_END = "{LIMIT_END}";
/** /**
* 更新字段模板 * 更新字段模板
*/ */
......
...@@ -3,12 +3,11 @@ package com.yanzuoguang.dao.impl; ...@@ -3,12 +3,11 @@ package com.yanzuoguang.dao.impl;
import com.yanzuoguang.dao.DaoConst; import com.yanzuoguang.dao.DaoConst;
import com.yanzuoguang.dao.cond.SqlCond; import com.yanzuoguang.dao.cond.SqlCond;
import com.yanzuoguang.dao.cond.SqlCondDefault; import com.yanzuoguang.dao.cond.SqlCondDefault;
import com.yanzuoguang.util.helper.StringFormatHandle;
import com.yanzuoguang.util.helper.StringHelper; import com.yanzuoguang.util.helper.StringHelper;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map;
/** /**
* SQL语句基本信息 * SQL语句基本信息
...@@ -82,6 +81,28 @@ public class SqlData { ...@@ -82,6 +81,28 @@ public class SqlData {
return name; return name;
} }
/**
* 交换SQL语句中的{LIMIT}和{LIMIT_END}
*
* @return
*/
public SqlData switchLimit() {
this.sql = StringHelper.getFormat(this.sql, StringHelper.EMPTY, new StringFormatHandle() {
@Override
public void addPos(StringBuilder sb, String group, String fieldFull, String field, String command) {
if (StringHelper.compare(group, DaoConst.CODE_LIMIT)) {
sb.append(DaoConst.CODE_LIMIT_END);
} else if (StringHelper.compare(group, DaoConst.CODE_LIMIT_END)) {
sb.append(DaoConst.CODE_LIMIT);
} else {
sb.append(group);
}
}
});
return this;
}
/** /**
* 设置SQL语句名称 * 设置SQL语句名称
* *
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment