package top.imwork.commons.core.pojo;

import java.util.List;
import java.util.Objects;

/**
 * Copyright (C), 2015-2023
 * FileName: BaseResult
 * Author<作者姓名>:   stars
 * CreateTime<创建时间>:   2023/2/14 23:14
 * UpdateTime<修改时间>:   2023/2/14 23:14
 * Description〈功能简述〉: 基础返回信息
 * History<历史描述>:
 * Since<版本号>: 1.0.0
 */
public class BaseResult<T,P> {
    /**
     * 页码
     */
    private Integer pageNo;

    /**
     * 每页记录数
     */
    private Integer pageRows;

    /**
     * 总页数
     */
    private Integer pageCount;

    /**
     * 总记录数
     */
    private Integer totalRows;

    /**
     * 数据集
     */
    private List<T> dataList;

    /**
     * 入参DTO
     */
    private P params;

    @Override
    public String toString() {
        return "BaseResult{" +
                "pageNo=" + pageNo +
                ", pageRows=" + pageRows +
                ", pageCount=" + pageCount +
                ", totalRows=" + totalRows +
                ", dataList=" + dataList +
                ", params=" + params +
                '}';
    }

    @Override
    public boolean equals(Object o) {
        if (!(o instanceof BaseResult<?, ?> that)) return false;
        return Objects.equals(pageNo, that.pageNo) && Objects.equals(pageRows, that.pageRows) && Objects.equals(pageCount, that.pageCount) && Objects.equals(totalRows, that.totalRows) && Objects.equals(dataList, that.dataList) && Objects.equals(params, that.params);
    }

    @Override
    public int hashCode() {
        return Objects.hash(pageNo, pageRows, pageCount, totalRows, dataList, params);
    }

    public Integer getPageNo() {
        return pageNo;
    }

    public void setPageNo(Integer pageNo) {
        this.pageNo = pageNo;
    }

    public Integer getPageRows() {
        return pageRows;
    }

    public void setPageRows(Integer pageRows) {
        this.pageRows = pageRows;
    }

    public Integer getPageCount() {
        return pageCount;
    }

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

    public Integer getTotalRows() {
        return totalRows;
    }

    public void setTotalRows(Integer totalRows) {
        this.totalRows = totalRows;
    }

    public List<T> getDataList() {
        return dataList;
    }

    public void setDataList(List<T> dataList) {
        this.dataList = dataList;
    }

    public P getParams() {
        return params;
    }

    public void setParams(P params) {
        this.params = params;
    }
}