分頁查詢對象Page


 1 public class Page {
 2     //當前頁碼
 3     private Integer pageNo = 1;
 4     //每頁顯示條數
 5     private Integer pageSize = 5;
 6     //當前條件下的總記錄數
 7     private Integer totalCount = 0;
 8     //總頁數
 9     private Integer totalPage = 1;
10     //開始行號
11     private Integer startNum = 0;
12     //查詢的結果集
13     private List<?> list;
14     public Integer getPageNo() {
15         return pageNo;
16     }
17     public void setPageNo(Integer pageNo) {
18         this.pageNo = pageNo;
19     }
20     public Integer getPageSize() {
21         return pageSize;
22     }
23     public void setPageSize(Integer pageSize) {
24         this.pageSize = pageSize;
25     }
26     public Integer getTotalCount() {
27         return totalCount;
28     }
29     public void setTotalCount(Integer totalCount) {
30         this.totalCount = totalCount;
31     }
32     public Integer getTotalPage() {
33         //總頁數
34         totalPage = totalCount / pageSize;
35         if(totalCount == 0 || totalCount%pageSize != 0){
36             totalPage++;
37         }
38         return totalPage;
39     }
40     public void setTotalPage(Integer totalPage) {
41         this.totalPage = totalPage;
42     }
43     public Integer getStartNum() {
44         //開始行號=(當前頁數-1)x每頁顯示的條數
45         return (pageNo - 1) * pageSize;
46     }
47     public void setStartNum(Integer startNum) {
48         this.startNum = startNum;
49     }
50     public List<?> getList() {
51         return list;
52     }
53     public void setList(List<?> list) {
54         this.list = list;
55     }
56 }

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM