分页查询对象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 }

 

posted @ 2018-04-08 23:35  cat_fish  阅读(3512)  评论(0编辑  收藏  举报