|
@@ -15,10 +15,11 @@
|
|
|
*/
|
|
|
package com.baomidou.mybatisplus.plugins.pagination;
|
|
|
|
|
|
-import com.baomidou.mybatisplus.toolkit.StringUtils;
|
|
|
+import java.io.Serializable;
|
|
|
+
|
|
|
import org.apache.ibatis.session.RowBounds;
|
|
|
|
|
|
-import java.io.Serializable;
|
|
|
+import com.baomidou.mybatisplus.toolkit.StringUtils;
|
|
|
|
|
|
/**
|
|
|
* <p>
|
|
@@ -37,8 +38,8 @@ public class Pagination extends RowBounds implements Serializable {
|
|
|
/* 总数 */
|
|
|
private int total;
|
|
|
|
|
|
- /* 每页显示条数 */
|
|
|
- private int size;
|
|
|
+ /* 每页显示条数,默认 10 */
|
|
|
+ private int size = 10;
|
|
|
|
|
|
/* 总页数 */
|
|
|
private int pages;
|
|
@@ -124,18 +125,16 @@ public class Pagination extends RowBounds implements Serializable {
|
|
|
if (this.total % this.size != 0) {
|
|
|
this.pages++;
|
|
|
}
|
|
|
- /**
|
|
|
- * 当前页大于总页数,当前页设置为第一页
|
|
|
- */
|
|
|
- /*if (this.current > this.pages) {
|
|
|
- this.current = 1;
|
|
|
- }*/
|
|
|
}
|
|
|
|
|
|
public int getSize() {
|
|
|
return size;
|
|
|
}
|
|
|
|
|
|
+ public void setSize(int size) {
|
|
|
+ this.size = size;
|
|
|
+ }
|
|
|
+
|
|
|
public int getPages() {
|
|
|
return pages;
|
|
|
}
|
|
@@ -182,4 +181,5 @@ public class Pagination extends RowBounds implements Serializable {
|
|
|
public String toString() {
|
|
|
return "Pagination { total=" + total + " ,size=" + size + " ,pages=" + pages + " ,current=" + current + " }";
|
|
|
}
|
|
|
+
|
|
|
}
|