瀏覽代碼

fix: 修复在使用数据权限场景时,无 where 语句时的数据权限返回 null Expression 导致SQL错误问题

HouKunLin 2 年之前
父節點
當前提交
a360add46f

+ 4 - 1
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/inner/BaseMultiTableInnerInterceptor.java

@@ -70,7 +70,10 @@ public abstract class BaseMultiTableInnerInterceptor extends JsqlParserSupport i
     protected Expression andExpression(Table table, Expression where, final String whereSegment) {
         //获得where条件表达式
         final Expression expression = buildTableExpression(table, where, whereSegment);
-        if (null != where) {
+        if (expression == null) {
+            return where;
+        }
+        if (where != null) {
             if (where instanceof OrExpression) {
                 return new AndExpression(expression, new Parenthesis(where));
             } else {