|
|
@ -21,6 +21,7 @@ import java.util.Collections; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
|
|
import lombok.Data; |
|
|
|
import lombok.Data; |
|
|
|
|
|
|
|
import lombok.Setter; |
|
|
|
|
|
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
|
|
|
|
|
|
|
@ -38,6 +39,7 @@ public class PageInfo<T> { |
|
|
|
/** |
|
|
|
/** |
|
|
|
* total Page |
|
|
|
* total Page |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
|
|
|
|
@Setter |
|
|
|
private Integer totalPage; |
|
|
|
private Integer totalPage; |
|
|
|
/** |
|
|
|
/** |
|
|
|
* page size |
|
|
|
* page size |
|
|
@ -75,4 +77,15 @@ public class PageInfo<T> { |
|
|
|
public static <T> PageInfo<T> of(Integer currentPage, Integer pageSize) { |
|
|
|
public static <T> PageInfo<T> of(Integer currentPage, Integer pageSize) { |
|
|
|
return new PageInfo<>(currentPage, pageSize); |
|
|
|
return new PageInfo<>(currentPage, pageSize); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public Integer getTotalPage() { |
|
|
|
|
|
|
|
if (pageSize == null || pageSize == 0) { |
|
|
|
|
|
|
|
pageSize = 7; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
this.totalPage = |
|
|
|
|
|
|
|
(this.total % this.pageSize) == 0 |
|
|
|
|
|
|
|
? ((this.total / this.pageSize) == 0 ? 1 : (this.total / this.pageSize)) |
|
|
|
|
|
|
|
: (this.total / this.pageSize + 1); |
|
|
|
|
|
|
|
return this.totalPage; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|