zoukankan      html  css  js  c++  java
  • Java 分页工具类

    /***
     * 分页工具类
     */
    public class Page {
        
        private int pageSize = 5;// 页显示条数
        private int currentPage;// 当前页码
        private Long totalSize;// 总记录条数
        private int totalPage;// 总页数
        private int beginSize;// 开始查询记录条数
        private int endSize;// 结束查询记录条数
        private List<Map<String, Object>> list;// 记录
        
        public Page(int currentPage){
            this.currentPage = currentPage;
        }
        
        public int getPageSize() {
            return pageSize;
        }
        public void setPageSize(int pageSize) {
            this.pageSize = pageSize;
        }
        public int getCurrentPage() {
            return currentPage;
        }
        public void setCurrentPage(int currentPage) {
            this.currentPage = currentPage;
        }
        public Long getTotalSize() {
            return totalSize;
        }
        public void setTotalSize(Long totalSize) {
            this.totalSize = totalSize;
        }
        public int getTotalPage() {
            Long totalSize = getTotalSize();
            return (int) (totalSize%pageSize==0?(totalSize/pageSize):(totalSize/pageSize+1));
        }
        public void setTotalPage(int totalPage) {
            this.totalPage = totalPage;
        }
        public List<Map<String, Object>> getList() {
            return list;
        }
        public void setList(List<Map<String, Object>> list) {
            this.list = list;
        }
        public int getBeginSize() {
            return beginSize = currentPage>0?(currentPage-1) * pageSize + 1:0;
        }
        public void setBeginSize(int beginSize) {
            this.beginSize = beginSize;
        }
        public int getEndSize() {
            int beginSize = getBeginSize();
            return beginSize + pageSize - (beginSize>0?1:0);
        }
        public void setEndSize(int endSize) {
            this.endSize = endSize;
        }
        
    }
  • 相关阅读:
    Pyton 练习题2
    Python 知识点练习
    pycharm 汉化
    关于sublime编辑Python的安装与配置
    python练习题
    虚短和虚断
    OSI的7层协议
    5V电压的制作
    三角波,方波,正弦波的转换
    单片机不工作,晶振是否起振怎么检查
  • 原文地址:https://www.cnblogs.com/lpxdbk/p/9779139.html
Copyright © 2011-2022 走看看