Browse Source

提供一组静态对象方法

杨永林 4 years ago
parent
commit
f6a35b8353

+ 21 - 0
mybatis-plus-extension/src/main/java/com/baomidou/mybatisplus/extension/plugins/pagination/Page.java

@@ -273,4 +273,25 @@ public class Page<T> implements IPage<T> {
         // 解决 github issues/3208
         // 解决 github issues/3208
         return IPage.super.getPages();
         return IPage.super.getPages();
     }
     }
+
+    public static Page<T> of(long current, long size){
+        return this(current, size, 0);
+    }
+
+    public static Page<T> of(long current, long size, long total) {
+        this(current, size, total, true);
+    }
+
+    public static Page<T> of(long current, long size, boolean isSearchCount) {
+        this(current, size, 0, isSearchCount);
+    }
+
+    public static Page<T> of(long current, long size, long total, boolean isSearchCount) {
+        if (current > 1) {
+            this.current = current;
+        }
+        this.size = size;
+        this.total = total;
+        this.isSearchCount = isSearchCount;
+    }
 }
 }