Skip to content

Commit bd96636

Browse files
committed
Revert "Server:调整 ^ SIDE JOIN(ANTI JOIN) 的实现为 ! (A & B),和原来的实现 (A & ! B) | (B & ! A) 查询结果不一致,一般数量更多!"
This reverts commit 5ebfa8d.
1 parent 5ebfa8d commit bd96636

File tree

1 file changed

+21
-16
lines changed

1 file changed

+21
-16
lines changed

APIJSON-Java-Server/APIJSONORM/src/main/java/apijson/orm/AbstractSQLConfig.java

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1387,31 +1387,36 @@ else if ("!".equals(ce.getKey())) {
13871387
newWs += AND;
13881388
}
13891389

1390-
if ("^".equals(j.getJoinType())) { // ! (A & B)
1391-
newWs += " ( " + getCondition(
1392-
true,
1393-
( StringUtil.isEmpty(ws, true) ? "" : ws + AND ) + " ( " + js + " ) "
1394-
) + " ) ";
1390+
if ("^".equals(j.getJoinType())) { // (A & ! B) | (B & ! A)
1391+
newWs += " ( ( " + ws + ( StringUtil.isEmpty(ws, true) ? "" : AND + NOT ) + " ( " + js + " ) ) "
1392+
+ OR
1393+
+ " ( " + js + AND + NOT + " ( " + ws + " ) ) ) ";
1394+
1395+
newPvl.addAll(pvl);
1396+
newPvl.addAll(jc.getPreparedValueList());
1397+
newPvl.addAll(jc.getPreparedValueList());
1398+
newPvl.addAll(pvl);
13951399
}
13961400
else {
13971401
logic = Logic.getType(j.getJoinType());
13981402

1399-
newWs += " ( " + getCondition(
1400-
Logic.isNot(logic),
1401-
( StringUtil.isEmpty(ws, true) ? "" : ws + (Logic.isAnd(logic) ? AND : OR) ) + " ( " + js + " ) "
1402-
) + " ) ";
1403+
newWs += " ( "
1404+
+ getCondition(
1405+
Logic.isNot(logic),
1406+
ws
1407+
+ ( StringUtil.isEmpty(ws, true) ? "" : (Logic.isAnd(logic) ? AND : OR) )
1408+
+ " ( " + js + " ) "
1409+
)
1410+
+ " ) ";
1411+
1412+
newPvl.addAll(pvl);
1413+
newPvl.addAll(jc.getPreparedValueList());
14031414
}
1404-
1405-
newPvl.addAll(pvl);
1406-
newPvl.addAll(jc.getPreparedValueList());
14071415

14081416
changed = true;
14091417
break;
14101418
default:
1411-
throw new UnsupportedOperationException(
1412-
"join:value 中 value 里的 " + j.getJoinType() + "/" + j.getPath() + "错误!不支持 " + j.getJoinType()
1413-
+ " 等 [@ APP, < LEFT, > RIGHT, | FULL, & INNER, ! OUTTER, ^ SIDE, * CROSS] 之外的JOIN类型 !"
1414-
);
1419+
throw new UnsupportedOperationException("join:value 中 value 里的 " + j.getJoinType() + "/" + j.getPath() + "错误!不支持 " + j.getJoinType() + " 等 [@ APP, < LEFT, > RIGHT, | FULL, & INNER, ! OUTTER, ^ SIDE, * CROSS] 之外的JOIN类型 !");
14151420
}
14161421
}
14171422

0 commit comments

Comments
 (0)