All Downloads are FREE. Search and download functionalities are using the official Maven repository.

top.doudou.common.tool.page.PaginationSupport Maven / Gradle / Ivy

There is a newer version: 1.3.2
Show newest version
package top.doudou.common.tool.page;



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

/**
 * @author  傻男人<[email protected]>
 * @Date: 2020/3/30
 * @Description: 分页模型
 */
public class PaginationSupport implements Serializable {
    private int pageSize;
    private int pageNum;
    private int total;
    private int pageCount;
    private List items;

    private void init() {
        if (this.total > 0) {
            this.pageCount = this.total / this.pageSize;
            if (this.total % this.pageSize > 0) {
                ++this.pageCount;
            }
        } else {
            this.pageCount = 0;
        }

    }

    public PaginationSupport() {
    }

    public PaginationSupport(List items, int total, int pageSize, int pageNum) {
        this.pageSize = pageSize;
        this.pageNum = pageNum;
        this.total = total;
        this.items = items;
        this.init();
    }

//    public PaginationSupport(List items, PageHelper pageHelper) {
//        this.pageSize = PageHelper.getPagination().getSize();
//        this.pageNum = PageHelper.getPagination().getCurrent();
//        this.total = (int)PageHelper.freeTotal();
//        this.items = items;
//        this.init();
//    }

    public int getPageSize() {
        return this.pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getPageNum() {
        return this.pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getTotal() {
        return this.total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public int getPageCount() {
        return this.pageCount;
    }

    public void setPageCount(int pageCount) {
        this.pageCount = pageCount;
    }

    public List getItems() {
        return this.items;
    }

    public void setItems(List items) {
        this.items = items;
    }
}





© 2015 - 2024 Weber Informatics LLC | Privacy Policy