public class PageBean<T> {
??? private List<T> datas;// 當(dāng)前頁記錄數(shù), 需要傳遞
??? private int totalRecord;// 總記錄數(shù), 需要傳遞
??? private int currPageCode;// 當(dāng)前頁碼, 需要傳遞
??? private int pagesize;// 每頁記錄數(shù), 需要傳遞
??? private int totalPage;// 總頁數(shù), 計(jì)算
??? private int currPageBeginIndex; //需要計(jì)算
??? public PageBean(int currPageCode, int totalRecord, int pagesize) {
?????? this.currPageCode = currPageCode;
?????? this.totalRecord = totalRecord;
?????? this.pagesize = pagesize;
??????
?????? init();
??? }
???
??? private void init() {
?????? this.totalPage = totalRecord / pagesize;
?????? if(totalRecord % pagesize != 0) {
?????????? this.totalPage ;
?????? }[崔1]?
?????? this.currPageBeginIndex = (this.currPageCode-1) * this.pagesize;[崔2]?
??? }
...
}
|