Browse Source

修改分页存在的bug

wujing 8 năm trước cách đây
mục cha
commit
02d7847a4f

+ 7 - 2
src/main/java/com/baomidou/mybatisplus/plugins/PaginationInterceptor.java

@@ -155,8 +155,13 @@ public class PaginationInterceptor implements Interceptor {
 			 */
             int pages = page.getPages();
             if (overflowCurrent && (page.getCurrent() > pages)) {
-                page = new Pagination(1, page.getSize());
-                page.setTotal(total);
+            	
+            	// 这里不能使用new,如果new内存地址会改变,导致前面的page无效
+                // page = new Pagination(1, page.getSize());
+                // page.setTotal(total);
+            	
+            	// 设置为第一条
+                page.setCurrent(1);
             }
         } catch (Exception e) {
             logger.error("Error: Method queryTotal execution error !", e);