package com.m2pool.common.core.web.page;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * @Description 表格分页数据对象
 * @Date 2024/6/13 11:59
 * @Author dy
 */
@Data
@ApiModel(description = "分页返回对象")
public class TableDataInfo<T> implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 总记录数 */
    @ApiModelProperty(value = "总记录数", example = "1")
    private long total;

    /** 总页数 */
    @ApiModelProperty(value = "总页数", example = "1")
    private long totalPage;

    /** 列表数据 */
    @ApiModelProperty(value = "查询结果集合")
    private List<T> rows;

    /** 消息状态码 */
    @ApiModelProperty(value = "消息状态码", example = "200")
    private int code;

    /** 消息内容 */
    @ApiModelProperty(value = "查询结果描述", example = "成功")
    private String msg;

    /**
     * 表格数据对象
     */
    public TableDataInfo()
    {
    }

    /**
     * 分页
     *
     * @param list 列表数据
     * @param total 总记录数
     */
    public TableDataInfo(List<T> list, int total)
    {
        this.rows = list;
        this.total = total;
    }

}
