package com.legend.drp.util;
import java.util.List;
public class PageModel<E> {
private List<E> list;// 查询结果,返回给客户端
private int pageSize;// 每页多少条数据,返回给客户端
private int totalRecords;// 总记录数,需要这个数据,因为要给客户端返回总页数
private int pageNo;// 当前页数,需要这个数据,因为要给客户端下一页,上一页,首页,尾页的页数
public List<E> getList() {
return list;
}
public void setList(List<E> list) {
this.list = list;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getTotalRecords() {
return totalRecords;
}
public void setTotalRecords(int totalRecords) {
this.totalRecords = totalRecords;
}
public int getPageNo() {
return pageNo;
}
public void setPageNo(int pageNo) {
this.pageNo = pageNo;
}
public int getTotalPages() {
return (totalRecords + pageSize - 1) / pageSize;
}
public int getTopPage() {
return 1;
}
public int getButtomPageNo() {
if (getTotalPages() == 0) {
return 1;
}
return getTotalPages();
}
public int getPreviouePageNo() {
if (pageNo <= 1) {
return 1;
}
return pageNo - 1;
}
public int getNextPageNo() {
if (pageNo >= getButtomPageNo()) {
return getButtomPageNo();
}
return pageNo + 1;
}
}
分页工具类
最新推荐文章于 2020-10-19 16:33:49 发布