Created
August 28, 2019 12:13
-
-
Save keepingcoding/4cad92b5dabd2ffb5025c1c00791d6e7 to your computer and use it in GitHub Desktop.
分页Bean
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.Serializable; | |
import java.util.List; | |
/** | |
* 分页Bean | |
*/ | |
public class PageInfo implements Serializable { | |
private static final long serialVersionUID = 1L; | |
/** 每页显示条数 **/ | |
private int pageSize = 10; | |
/** 当前页 **/ | |
private int pageNum = 1; | |
/** 总记录数 **/ | |
private int totalRecord; | |
/** 总页数 **/ | |
private int totalPage; | |
/** 起始索引 会计算出来 **/ | |
private int startIndex; | |
public int getStartIndex() { | |
return startIndex = (this.getPageNum() - 1) * this.getPageSize(); | |
} | |
public int getPageSize() { | |
return pageSize; | |
} | |
public void setPageSize(int pageSize) { | |
this.pageSize = pageSize; | |
} | |
public int getPageNum() { | |
return pageNum; | |
} | |
public void setPageNum(int pageNum) { | |
this.pageNum = pageNum; | |
} | |
public int getTotalRecord() { | |
return totalRecord; | |
} | |
public void setTotalRecord(int totalRecord) { | |
this.totalRecord = totalRecord; | |
} | |
public int getTotalPage() { | |
return totalPage = (this.getTotalRecord() % this.getPageSize() == 0 ? (this.getTotalRecord() / this.getPageSize()) : (this.getTotalRecord() / this.getPageSize() + 1)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment