package com.zcxk.model;


import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

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

/**
 * 自定义分页
 * @param <T>
 */
@Data
public class Pagination<T> implements Serializable {
    private static final long serialVersionUID = -4899829840696212229L;
    @ApiModelProperty("总记录数")
    private long total;

    @ApiModelProperty("结果集")
    private List<T> list;


    public Pagination(){

    };

    /**
     * 包装Page对象
     *
     * @param list
     */
    public Pagination(IPage<T> page) {

        this.list = page.getRecords();
        this.total = page.getTotal();
    }
}
