把分页查询的相关属性存到对象中:
1、属性:
①private List<student> list;//结果及数据类型
private Integer totalCount;//结果总条数
private Integer currentPage = 1;//当前页 用户传入
private Integer pageSize = 5;//每页条数 用户传入
private Integer beginPage= 1;//首页
private Integer prevPage;//上一页
private Integer nextPage;//下一页
private Integer totalPage;//末页 总页数
public Page(Integer currentPage, Ingeter pageSize, list<Student> list,Ingeter totalCount){
this.list = list;
this.totalCount=totalCount;
this.currentPage = currentPage;
this.pageSize = pageSize;
//计算出个数据
this.totalPage=totalCount % pageSize==0? totalCount/pageSize: totalCount/pageSize+1
this.prevPage =totalCount-1>=1? currentPage-1:1;
this.nextPage = currentPage+1<=totalPage?currentPage+1: totalPage;
}