• 分页Bean终极封装


      1 package org.guangsoft.vo;
      2 
      3 import java.util.List;
      4 
      5 public class Page
      6 {
      7     private Integer pageNum;
      8     private Integer pageSize;
      9     private Long totalCount;
     10     
     11     private Integer pageItemsStart;
     12     private Integer pageItemsEnd;
     13     private Integer pageCount;
     14     private Boolean hasPrePage;
     15     private Boolean hasNextPage;
     16     private Integer prePageNum;
     17     private Integer nextPageNum;
     18     private Integer firstPageNum;
     19     private Integer lastPageNum;
     20     private List dataList;
     21     
     22     public Page()
     23     {
     24         super();
     25     }
     26     public Page(Integer pageNum, Integer pageSize, Long totalCount)
     27     {
     28         super();
     29         this.pageNum = pageNum;
     30         this.pageSize = pageSize;
     31         this.totalCount = totalCount;
     32         
     33         pageItemsStart = (pageNum - 1) * pageSize;
     34         pageItemsEnd = pageItemsStart + pageSize - 1;
     35         pageCount = (int) Math.ceil(totalCount * 1.0 / pageSize);
     36         firstPageNum = totalCount > 0 ? 1 : 0;
     37         lastPageNum = totalCount > 0 ? pageCount : 0;
     38         hasPrePage = pageNum > 1 ? true : false;
     39         hasNextPage = pageNum < lastPageNum ? true : false;
     40         prePageNum = hasPrePage ? pageNum - 1 : 0;
     41         nextPageNum = hasNextPage ? pageNum + 1 : 0;
     42     }
     43     public Integer getPageNum()
     44     {
     45         return pageNum;
     46     }
     47     public void setPageNum(Integer pageNum)
     48     {
     49         this.pageNum = pageNum;
     50     }
     51     public Integer getPageSize()
     52     {
     53         return pageSize;
     54     }
     55     public void setPageSize(Integer pageSize)
     56     {
     57         this.pageSize = pageSize;
     58     }
     59     public Long getTotalCount()
     60     {
     61         return totalCount;
     62     }
     63     public void setTotalCount(Long totalCount)
     64     {
     65         this.totalCount = totalCount;
     66     }
     67     public Integer getPageItemsStart()
     68     {
     69         return pageItemsStart;
     70     }
     71     public void setPageItemsStart(Integer pageItemsStart)
     72     {
     73         this.pageItemsStart = pageItemsStart;
     74     }
     75     public Integer getPageItemsEnd()
     76     {
     77         return pageItemsEnd;
     78     }
     79     public void setPageItemsEnd(Integer pageItemsEnd)
     80     {
     81         this.pageItemsEnd = pageItemsEnd;
     82     }
     83     public Integer getPageCount()
     84     {
     85         return pageCount;
     86     }
     87     public void setPageCount(Integer pageCount)
     88     {
     89         this.pageCount = pageCount;
     90     }
     91     public Boolean getHasPrePage()
     92     {
     93         return hasPrePage;
     94     }
     95     public void setHasPrePage(Boolean hasPrePage)
     96     {
     97         this.hasPrePage = hasPrePage;
     98     }
     99     public Boolean getHasNextPage()
    100     {
    101         return hasNextPage;
    102     }
    103     public void setHasNextPage(Boolean hasNextPage)
    104     {
    105         this.hasNextPage = hasNextPage;
    106     }
    107     public Integer getPrePageNum()
    108     {
    109         return prePageNum;
    110     }
    111     public void setPrePageNum(Integer prePageNum)
    112     {
    113         this.prePageNum = prePageNum;
    114     }
    115     public Integer getNextPageNum()
    116     {
    117         return nextPageNum;
    118     }
    119     public void setNextPageNum(Integer nextPageNum)
    120     {
    121         this.nextPageNum = nextPageNum;
    122     }
    123     public Integer getFirstPageNum()
    124     {
    125         return firstPageNum;
    126     }
    127     public void setFirstPageNum(Integer firstPageNum)
    128     {
    129         this.firstPageNum = firstPageNum;
    130     }
    131     public Integer getLastPageNum()
    132     {
    133         return lastPageNum;
    134     }
    135     public void setLastPageNum(Integer lastPageNum)
    136     {
    137         this.lastPageNum = lastPageNum;
    138     }
    139     public List getDataList()
    140     {
    141         return dataList;
    142     }
    143     public void setDataList(List dataList)
    144     {
    145         this.dataList = dataList;
    146     }
    147 }
  • 相关阅读:
    P3916 图的遍历
    P1656 炸铁路
    P6722 「MCOI-01」Village 村庄
    P1341 无序字母对
    P1072 [NOIP2009 提高组] Hankson 的趣味题
    10大主流自动化测试工具介绍
    Altium Designer中off grid pin问题的解决方法
    Easylogging++的使用及扩展
    博客园粒子特效稳定版
    C#中使用jieba.NET、WordCloudSharp制作词云图
  • 原文地址:https://www.cnblogs.com/guanghe/p/6085521.html
Copyright © 2020-2023  润新知