package com.sckw.core.model.page;

import com.github.pagehelper.PageInfo;

import java.util.List;

/**
 * 分页结果泛型类
 *
 * @author xucaiqin
 * @date 2023-07-12 08:42:26
 */
public class PageRes<T> {

    /**
     * 当前页数
     */
    protected int page;
    /**
     * 每页显示条数
     */
    protected int pageSize;
    /**
     * 总条数
     */
    protected long size;
    /**
     * 总页数
     */
    protected int pages;
    /**
     * 数据
     */
    protected List<T> list;

    public PageRes() {
    }

    public PageRes(PageInfo<T> pageInfo) {
        this.page = pageInfo.getPageNum();
        this.pageSize = pageInfo.getPageSize();
        this.size = pageInfo.getTotal();
        this.pages = pageInfo.getPages();
        this.list = pageInfo.getList();
    }

    public void setPage(int page) {
        this.page = page;
    }

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

    public void setSize(long size) {
        this.size = size;
    }

    public void setPages(int pages) {
        this.pages = pages;
    }

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

    public int getPage() {
        return page;
    }

    public int getPageSize() {
        return pageSize;
    }

    public long getSize() {
        return size;
    }

    public int getPages() {
        return pages;
    }

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