Skip to content

Commit 067e7b9

Browse files
committed
解决 key[ 表示 length(key) 和 key{ 表示 json_length(key) 不支持 = 和 != 比较
1 parent 16d3bf1 commit 067e7b9

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3571,7 +3571,9 @@ public String getEqualString(String key, String column, Object value, String raw
35713571
if (not) {
35723572
column = column.substring(0, column.length() - 1);
35733573
}
3574-
if (StringUtil.isName(column) == false) {
3574+
3575+
String rc = column.endsWith("[") || column.endsWith("{") ? column.substring(0, column.length() - 1) : column;
3576+
if (StringUtil.isName(rc) == false) {
35753577
throw new IllegalArgumentException(key + ":value 中key不合法!不支持 ! 以外的逻辑符 !");
35763578
}
35773579

@@ -6032,20 +6034,20 @@ else if (key.endsWith("-")) {//缩减,PUT查询时处理
60326034
}
60336035
}
60346036

6035-
String len = "";
6036-
if (key.endsWith("[") || key.endsWith("{")) {
6037-
len = key.substring(key.length() - 1);
6038-
key = key.substring(0, key.length() - 1);
6039-
}
6040-
60416037
// TODO if (key.endsWith("-")) { // 表示 key 和 value 顺序反过来: value LIKE key ?
60426038

60436039
// 不用Logic优化代码,否则 key 可能变为 key| 导致 key=value 变成 key|=value 而出错
60446040
String last = key.isEmpty() ? "" : key.substring(key.length() - 1);
60456041
if ("&".equals(last) || "|".equals(last) || "!".equals(last)) {
60466042
key = key.substring(0, key.length() - 1);
60476043
} else {
6048-
last = null;//避免key + StringUtil.getString(last)错误延长
6044+
last = null; // 避免key + StringUtil.getString(last) 错误延长
6045+
}
6046+
6047+
String len = "";
6048+
if (key.endsWith("[") || key.endsWith("{")) {
6049+
len = key.substring(key.length() - 1);
6050+
key = key.substring(0, key.length() - 1);
60496051
}
60506052

60516053
// "User:toUser":User转换"toUser":User, User为查询同名Table得到的JSONObject。交给客户端处理更好

0 commit comments

Comments
 (0)