PageResponseVO.java 1.45 KB
package com.yohoufo.user.responseVO;

import java.util.List;

/**
 * Created by shengguo.cai on 2018/9/12.
 */
public class PageResponseVO<T> {
    /**
     * 总记录数
     */
    private int total;

    /**
     * 当前页
     */
    private int page;

    /**
     * 每页记录数
     */
    private int size;

    /**
     * 总页数
     */
    private int totalPage;

    /**
     * 数据
     */
    private List<T> list;

    public PageResponseVO() {
    }

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

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

    private void dealTotalPage() {
        if (this.total > 0 && this.size > 0) {
            int totalPage = this.total % this.size == 0 ? this.total / this.size : this.total / this.size + 1;
            this.setTotalPage(totalPage);
        }

    }

    public int getPage() {
        return this.page;
    }

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

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

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

    public int getSize() {
        return this.size;
    }

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

    public int getTotalPage() {
        return this.totalPage;
    }

    public void setTotalPage(int totalPage) {
        this.totalPage = totalPage;
    }
}