优化grid分页控件,增加可自定义参数而不被纳入自动生成的where语句中
This commit is contained in:
parent
869f427ae2
commit
61429bec36
|
|
@ -121,14 +121,11 @@ public abstract class BaseGridFactory implements IGrid {
|
|||
if (Func.isEmpty(map)) {
|
||||
map = new HashMap<>();
|
||||
}
|
||||
if (Func.isPostgresql()) {
|
||||
//postgresql8.3+版本 字段类型敏感,如果是int型需要做强制类型转换,mysql和oracle可以无视
|
||||
for (String key : map.keySet()) {
|
||||
if (key.startsWith(SqlKeyword.TOINT) || key.startsWith(SqlKeyword.IT) || key.startsWith(SqlKeyword.F_IT)) {
|
||||
map.put(key, Convert.toInt(map.get(key)));
|
||||
}
|
||||
}
|
||||
}
|
||||
for (String key : map.keySet()) {
|
||||
if (key.startsWith(SqlKeyword.TOINT) || key.startsWith(SqlKeyword.IT) || key.startsWith(SqlKeyword.F_IT)) {
|
||||
map.put(key.replace(SqlKeyword.SKIP, ""), Convert.toInt(map.get(key)));
|
||||
}
|
||||
}
|
||||
map.put(Const.ORDER_BY_STR, Func.isAllEmpty(sort, order) ? "" : (sort + " " + order));
|
||||
return map;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import java.util.Map;
|
|||
* 定义常用的 sql关键字
|
||||
*/
|
||||
public class SqlKeyword {
|
||||
public static final String SKIP = "_skip_true";
|
||||
private static final String EQUAL = "_equal";
|
||||
private static final String NOT_EQUAL = "_notequal";
|
||||
private static final String LIKE = "_like";
|
||||
|
|
@ -57,6 +58,7 @@ public class SqlKeyword {
|
|||
w = Func.decodeUrl(w);
|
||||
Map<String, String> mm = JsonKit.parse(w, HashMap.class);
|
||||
for (String m : mm.keySet()) {
|
||||
if (m.endsWith(SKIP)) break;
|
||||
String col = clearKeyWord(m);
|
||||
String k = "";
|
||||
for (String key : keyWord.keySet()) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user