瀏覽代碼

换个位置

miemie 6 年之前
父節點
當前提交
a824986139

+ 3 - 2
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/PaginationInterceptor.java

@@ -171,19 +171,20 @@ public class PaginationInterceptor extends AbstractSqlParserHandler implements I
                 return invocation.proceed();
             }
         }
+
         String buildSql = concatOrderBy(originalSql, page, orderBy);
         DialectModel model = DialectFactory.buildPaginationSql(page, buildSql, dbType, dialectClazz);
-
         Configuration configuration = mappedStatement.getConfiguration();
         List<ParameterMapping> mappings = new ArrayList<>(boundSql.getParameterMappings());
         model.consumers(mappings, configuration);
+        metaObject.setValue("delegate.boundSql.sql", model.getDialectSql());
         metaObject.setValue("delegate.boundSql.parameterMappings", mappings);
         metaObject.setValue("delegate.boundSql.additionalParameters", model.getDialectMap());
+
         /*
          * <p> 禁用内存分页 </p>
          * <p> 内存分页会查询所有结果出来处理(这个很吓人的),如果结果变化频繁这个数据还会不准。</p>
          */
-        metaObject.setValue("delegate.boundSql.sql", model.getDialectSql());
         metaObject.setValue("delegate.rowBounds.offset", RowBounds.NO_ROW_OFFSET);
         metaObject.setValue("delegate.rowBounds.limit", RowBounds.NO_ROW_LIMIT);
         return invocation.proceed();