67,512
社区成员
发帖
与我相关
我的任务
分享
package com.jyd.utils;
import java.util.List;
public class PageBean {
// 当前页数
private Integer currentPage;
// 每页条数
private Integer pageSize;
// 总条数
private Integer totalCount;
// 总页数
private Integer totalPage;
// 每页数据
private List list;
// 构造
public PageBean(Integer currentPage, Integer totalCount, Integer pageSize) {
this.totalCount = totalCount;
this.pageSize = pageSize;
this.currentPage = currentPage;
// 如果没有指定显示哪一页,显示第一页
if (this.currentPage == null) {
this.currentPage = 1;
}
// 如果没有指定显示条数,默认每页显示3条
if (this.pageSize == null) {
this.pageSize = 3;
}
// 计算总页数
this.totalPage = (this.totalCount + this.pageSize - 1) / pageSize;
// 判断当前面
// 不能小于1
if (this.currentPage < 1) {
this.currentPage = 1;
}
// 不能大于最大页码
if (this.currentPage > this.totalPage) {
this.currentPage = this.totalPage;
}
}
public Integer getCurrentPage() {
return currentPage;
}
public void setCurrentPage(Integer currentPage) {
this.currentPage = currentPage;
}
public Integer getPageSize() {
return pageSize;
}
public void setPageSize(Integer pageSize) {
this.pageSize = pageSize;
}
public Integer getTotalCount() {
return totalCount;
}
public void setTotalCount(Integer totalCount) {
this.totalCount = totalCount;
}
public Integer getTotalPage() {
return totalPage;
}
public void setTotalPage(Integer totalPage) {
this.totalPage = totalPage;
}
public List getList() {
return list;
}
public void setList(List list) {
this.list = list;
}
public Integer getStart() {
return (this.currentPage - 1) * this.pageSize;
}
}