package com.weilai.swmf.page;
public class Page {
private int rowCount;//总行数
private int pagesize = 10;//每页显示的数据记录
private int curPage;//当前页
public int getRowCount() {
return rowCount;
}
public void setRowCount(int rowCount) {
this.rowCount = rowCount;
}
public int getPagesize() {
return pagesize;
}
public void setPagesize(int pagesize) {
this.pagesize = pagesize;
}
public int getCurPage() {
return curPage == 0 ? 1 : curPage;
}
public void setCurPage(int curPage) {
this.curPage = curPage;
}
/**
* 上一页
* @return
*/
public int getPrev() {
return this.getCurPage()>1 ? (this.getCurPage()-1) : 1;
}
/**
* 下一页
* @return
*/
public int getNext() {
return this.getCurPage()<this.getPageCount() ? (this.getCurPage()+1) : this.getPageCount();
}
/**
* 获取总页数
* @return
*/
public int getPageCount() {
return (this.getRowCount()+this.getPagesize()-1)/this.getPagesize();
}
/**
* 是否为最后一页
* @return
*/
public boolean isLast(){
return (this.getCurPage() == this.getPageCount() ? true : false);
}
/**
* 是否为第一页
*/
public boolean isFirst(){
return (this.getCurPage() == 0 ? true : false);
}
}