You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
56 lines
1.2 KiB
56 lines
1.2 KiB
package com.community.pocket.entity.vo;
|
|
|
|
import java.util.List;
|
|
|
|
//分页数据
|
|
public class Page<T> {
|
|
//总记录数
|
|
private final Long count;
|
|
//总页数
|
|
private final Long totalPage;
|
|
//当前页数
|
|
private Long currentPage;
|
|
//数据集合
|
|
private List<T> list;
|
|
//分页大小
|
|
private final Integer pageSize;
|
|
|
|
public Page(Long count, Long currentPage, Integer pageSize) {
|
|
this.count = count;
|
|
this.pageSize = pageSize;
|
|
this.totalPage = count % pageSize == 0 ? count / pageSize : count / pageSize + 1;
|
|
this.currentPage = currentPage > this.totalPage ? this.totalPage : currentPage;
|
|
}
|
|
|
|
public Integer getPageSize() {
|
|
return pageSize;
|
|
}
|
|
|
|
public Long getCount() {
|
|
return count;
|
|
}
|
|
|
|
public Long getTotalPage() {
|
|
return totalPage;
|
|
}
|
|
|
|
public Long getCurrentPage() {
|
|
return currentPage;
|
|
}
|
|
|
|
public void setCurrentPage(Long currentPage) {
|
|
this.currentPage = currentPage;
|
|
}
|
|
|
|
public List<T> getList() {
|
|
return list;
|
|
}
|
|
|
|
public void setList(List<T> list) {
|
|
this.list = list;
|
|
}
|
|
|
|
public boolean isEmpty() {
|
|
return this.list.isEmpty();
|
|
}
|
|
}
|
|
|