package com.hssx.pcbms.util;

import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * Author: 吴涛涛 cuiyi@itany.com
 * Date : 2019 - 07 - 27 9:25
 * Description:<描述> 模仿pagehelper参数的分页封装类
 * Version: 1.0
 */
@Data
public class PageUtil<T> {
    private Integer pageNum = 1;
    private Integer total;
    private Integer pageSize = 10;
    private Integer pages;
    private List<T> list = new ArrayList<>();

    public Integer getPageNum() {
        return pageNum;
    }

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

    public Integer getTotal() {
        return total;
    }

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

    public Integer getPageSize() {
        return pageSize;
    }

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

    public Integer getPages() {
        return pages;
    }

    public void setPages(Integer total) {
        this.pages = total % this.pageSize == 0 ? total / this.pageSize : total / this.pageSize + 1;;
    }

    public List<T> getList() {
        return list;
    }

    public void setList(List<T> list) {
        this.list = list;
    }
}
