miemie 5 سال پیش
والد
کامیت
2fab12eaa7

+ 4 - 4
mybatis-plus-core/src/main/java/com/baomidou/mybatisplus/core/conditions/segments/NormalSegmentList.java

@@ -67,10 +67,6 @@ public class NormalSegmentList extends AbstractISegmentList {
                 return false;
             }
         } else {
-            if (!executeNot) {
-                list.add(0, SqlKeyword.NOT);
-                executeNot = true;
-            }
             if (MatchSegment.APPLY.match(firstSegment)) {
                 list.remove(0);
             }
@@ -80,6 +76,10 @@ public class NormalSegmentList extends AbstractISegmentList {
             if (!MatchSegment.AND_OR.match(lastValue) && !isEmpty()) {
                 add(SqlKeyword.AND);
             }
+            if (!executeNot) {
+                list.add(0, SqlKeyword.NOT);
+                executeNot = true;
+            }
         }
         return true;
     }