Newer
Older
casic-metering / casic-metering-model / src / main / java / com / casic / missiles / dto / PageInfoBT.java
wangpeng on 25 Nov 2022 2 KB knife4j、minio
package com.casic.missiles.dto;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.util.List;

/**
 * @Description:
 * @Author: wangpeng
 * @Date: 2022/11/21 16:04
 */
@Data
@ApiModel(value = "分页数据", description = "分页数据统一返回对象")
public class PageInfoBT<T> {
    @ApiModelProperty(value = "列表数据", dataType = "List", name = "rows")
    private List<T> rows;
    @ApiModelProperty(value = "数据条数", dataType = "int", name = "total")
    private int total;

    public PageInfoBT(Page<T> page) {
        this.rows = page.getRecords();
        this.total = new Integer(String.valueOf(page.getTotal()));
    }

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

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

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

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

    public boolean equals(Object o) {
        if (o == this) {
            return true;
        } else if (!(o instanceof PageInfoBT)) {
            return false;
        } else {
            PageInfoBT<?> other = (PageInfoBT)o;
            if (!other.canEqual(this)) {
                return false;
            } else {
                Object this$rows = this.getRows();
                Object other$rows = other.getRows();
                if (this$rows == null) {
                    if (other$rows == null) {
                        return this.getTotal() == other.getTotal();
                    }
                } else if (this$rows.equals(other$rows)) {
                    return this.getTotal() == other.getTotal();
                }

                return false;
            }
        }
    }

    protected boolean canEqual(Object other) {
        return other instanceof PageInfoBT;
    }

    public int hashCode() {
        int PRIME = 1;
        int result = 1;
        Object $rows = this.getRows();
        result = result * 59 + ($rows == null ? 43 : $rows.hashCode());
        result = result * 59 + this.getTotal();
        return result;
    }

    public String toString() {
        return "PageInfoBT(rows=" + this.getRows() + ", total=" + this.getTotal() + ")";
    }
}