Skip to content

Commit c633ffb

Browse files
authored
Merge pull request #70 from zhangtianxiao/master
Server:解决 < LEFT JOIN 或 > RIGHT JOIN 在主副表都有条件时 preparedValueList 里的主副表值顺序错误,导致 MySQL 查询结果不对,PostgreSQL 可能类型报错
2 parents 493faa2 + b2e42ff commit c633ffb

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

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

+13-1
Original file line numberDiff line numberDiff line change
@@ -1862,6 +1862,8 @@ public String getJoinString() throws Exception {
18621862

18631863
if (joinList != null) {
18641864
String quote = getQuote();
1865+
List<Object> pvl = new ArrayList<>();
1866+
boolean changed = false;
18651867

18661868
String sql = null;
18671869
SQLConfig jc;
@@ -1898,7 +1900,10 @@ public String getJoinString() throws Exception {
18981900
+ quote + tn + quote + "." + quote + j.getTargetKey() + quote;
18991901
jc.setMain(false).setKeyPrefix(true);
19001902

1901-
preparedValueList.addAll(jc.getPreparedValueList());
1903+
// preparedValueList.addAll(jc.getPreparedValueList());
1904+
1905+
pvl.addAll(jc.getPreparedValueList());
1906+
changed = true;
19021907
break;
19031908

19041909
case "": // FULL JOIN
@@ -1916,6 +1921,13 @@ public String getJoinString() throws Exception {
19161921

19171922
joinOns += " \n " + sql;
19181923
}
1924+
1925+
1926+
if (changed) {
1927+
pvl.addAll(preparedValueList);
1928+
preparedValueList = pvl;
1929+
}
1930+
19191931
}
19201932

19211933
return joinOns;

0 commit comments

Comments
 (0)