Skip to content

Commit 4a2a159

Browse files
committed
Server:AbstractConfig.putWhere优化条件顺序
1 parent 3405b13 commit 4a2a159

1 file changed

Lines changed: 17 additions & 2 deletions

File tree

APIJSON-Java-Server/APIJSONLibrary/src/main/java/zuo/biao/apijson/server/AbstractSQLConfig.java

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -618,17 +618,32 @@ public AbstractSQLConfig putWhere(String key, Object value) {
618618
where = new LinkedHashMap<String, Object>();
619619
}
620620
where.put(key, value);
621-
621+
622622
combine = getCombine();
623623
List<String> andList = combine == null ? null : combine.get("&");
624624
if (value == null) {
625625
andList.remove(key);
626626
}
627627
else if (andList == null || andList.contains(key) == false) {
628+
int i = 0;
628629
if (andList == null) {
629630
andList = new ArrayList<>();
630631
}
631-
andList.add(key); //userId的优先级不能比id高 0, key);
632+
else {
633+
if (andList.contains(KEY_ID)) {
634+
i ++;
635+
}
636+
if (andList.contains(KEY_ID_IN)) {
637+
i ++;
638+
}
639+
if (andList.contains(KEY_USER_ID)) {
640+
i ++;
641+
}
642+
if (andList.contains(KEY_USER_ID_IN)) {
643+
i ++;
644+
}
645+
}
646+
andList.add(i, key); //userId的优先级不能比id高 0, key);
632647
}
633648
combine.put("&", andList);
634649
}

0 commit comments

Comments
 (0)