首页 > 代码库 > page

page

package com.gs.jf.model;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author liyinlong
 *
 * 2017年2月23日下午3:57:34
 */
public class Page<T> implements Serializable{
    /**

     * 序列号参数

     */
    private static final long serialVersionUID = -2680722931433299497L;
    /**

     * 

     */
    //当前页

    private int currentPage;
    //总页码

    private int pageCount;
    //总条数

    private int objectCount=1;
    //一页容纳条数

    private int pageMax = 20;
    
    private List<T> list = new ArrayList<T>();
    
    /**

     * @param currentPage

     * @param pageMax

     */
    public Page(int currentPage, int pageMax) {
        super();
        this.currentPage = currentPage;
        this.pageMax = pageMax;
    }
    public Page() {
        
    }
    /**

     * @param currentPage

     * @param pageCount

     * @param objectCount

     * @param pageMax

     */
    public Page(int currentPage, int pageCount, int objectCount, int pageMax) {
        super();
        this.currentPage = currentPage;
        this.pageCount = pageCount;
        this.objectCount = objectCount;
        this.pageMax = pageMax;
    }
    
    /**

     * @param currentPage

     * @param pageCount

     * @param objectCount

     * @param pageMax

     * @param list

     */
    public Page(int currentPage, int pageCount, int objectCount, int pageMax, List<T> list) {
        super();
        this.currentPage = currentPage;
        this.pageCount = pageCount;
        this.objectCount = objectCount;
        this.pageMax = pageMax;
        this.list = list;
    }
    public int getcurrentPage() {
        
        return currentPage;
    }
    public void setcurrentPage(int currentPage) {
        this.currentPage = currentPage;
    }
    public int getPageCount() {
        pageCount = this.objectCount%this.pageMax==0?this.objectCount/this.pageMax:this.objectCount/this.pageMax+1;
        return pageCount;
    }
    public void setPageCount(int pageCount) {    
        this.pageCount = pageCount;
    }
    
    public int getObjectCount() {
        return objectCount;
    }
    public void setObjectCount(int objectCount) {
        this.objectCount = objectCount;
    }
    public int getPageMax() {
        return pageMax;
    }
    public void setPageMax(int pageMax) {
        
        this.pageMax = pageMax;
    }
    public List<T> getList() {
        if(list == null){
            return new ArrayList<T>();
        }
        return list;
    }
    public void setList(List<T> list) {
        this.list = list;
    }
    @Override
    public String toString() {
        return "Page [currentPage=" + this.getcurrentPage() + ", pageCount=" + this.getPageCount()
                + ", objectCount=" + this.getObjectCount() + ", pageMax=" + pageMax
                + ", list=" + list + "]";
    }
    
    
    
    
}

 

page