package com.bonus.sgzb.largeScreen.domain;

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

/**
 * @Author ma_sh
 * @create 2024/4/24 13:59
 */
public class PageResultVo<T> implements Serializable {
    private static final long serialVersionUID = -3915666721968467471L;
    private int pageNum;
    private int pageSize;
    private long total;
    private int totalPageCount;
    private List<T> rows;

    public PageResultVo() {
    }

    public PageResultVo(List<T> rows, int total) {
        this.rows = rows;
        this.total = (long)total;
    }

    public PageResultVo(int pageNum, int pageSize, long total, int totalPageCount, List<T> rows) {
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.total = total;
        this.totalPageCount = totalPageCount;
        this.rows = rows;
    }

    public boolean getFirstPage() {
        return this.getPageNum() == 1;
    }

    public long getPrevPage() {
        return (long)Math.max(1, this.getPageNum() - 1);
    }

    public long getNextPage() {
        return (long)(this.getPageNum() + 1);
    }

    public boolean getLastPage() {
        return this.getPageNum() >= this.getTotalPageCount();
    }

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

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

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

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

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

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

    public int getTotalPageCount() {
        return this.totalPageCount;
    }

    public void setTotalPageCount(int totalPageCount) {
        this.totalPageCount = totalPageCount;
    }

    public List<T> getRows() {
        return this.rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }
}
