zoukankan      html  css  js  c++  java
  • 分页封装类

    /**
    * @title 分页封装类
    * @description 用户分页相关的数据封装
    * @author maohuidong
    * @date 2017-04-06
    */
    public class PageBean<T> {
    //第几页
    private int pageNum;
    //每页显示的条数
    private int pageSize;
    //总共多少页
    private int totalPage;
    //总共多少数据
    private int totalRecord;
    //数据
    private List<T> dataList;

    //可选项(在没有总页数的情况下,失效)
    private int start;
    private int end;

    /**
    *
    * @param pageNum
    * @param pageSize
    * @param totalRecord
    */
    public PageBean(int pageNum, int pageSize, int totalRecord,List<T> dataList) {
    this.pageNum = pageNum;
    this.pageSize = pageSize;
    this.totalRecord = totalRecord;
    this.totalPage = (totalRecord + (pageSize - 1)) / pageSize;
    this.dataList = dataList;
    //可选项
    start = 1;
    end = 10;
    if(this.totalPage <= 10){
    end = totalPage;
    }else{
    start = this.pageNum - 5;
    end = this.pageNum + 4;
    if(start < 1){
    start = 1;
    end = 10;
    }
    if(end > this.totalPage){
    start = this.totalPage - 9;
    end = this.totalPage;
    }
    }
    }
    public int getPageNum() {
    return pageNum;
    }
    public void setPageNum(int pageNum) {
    this.pageNum = pageNum;
    }
    public int getPageSize() {
    return pageSize;
    }
    public void setPageSize(int pageSize) {
    this.pageSize = pageSize;
    }
    public int getTotalPage() {
    return totalPage;
    }
    public void setTotalPage(int totalPage) {
    this.totalPage = totalPage;
    }
    public int getTotalRecord() {
    return totalRecord;
    }
    public void setTotalRecord(int totalRecord) {
    this.totalRecord = totalRecord;
    }
    public List<T> getDataList() {
    return dataList;
    }
    public void setDataList(List<T> dataList) {
    this.dataList = dataList;
    }
    public int getStart() {
    return start;
    }
    public void setStart(int start) {
    this.start = start;
    }
    public int getEnd() {
    return end;
    }
    public void setEnd(int end) {
    this.end = end;
    }


    }

  • 相关阅读:
    python---redis缓存页面前戏之剖析render源码
    python---redis的python使用
    python---redis中文操作与系统中文检测
    python---redis在windows安装以及测试
    python---基于memcache的自定义session类
    python---memcache使用操作
    python---memcache基本使用以及内部原理
    googlecast
    Android-L-Samples
    libsuperuser
  • 原文地址:https://www.cnblogs.com/maohuidong/p/7853301.html
Copyright © 2011-2022 走看看