package com.seer.teach.common;

import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.ToString;

import java.util.List;

/**
 * @Author: Captain
 * @Autograph: 安稳
 * @Description:
 * @Date: 2023-08-08 11:36:12
 */
@Data
@AllArgsConstructor
@ToString
@Schema(description ="分页数据")
public class PageListBean<T> {

    @Schema(description ="总页数")
    private long totalPage;

    @Schema(description ="总记录数")
    private long total;

    @Schema(description ="当前页数")
    private long page;

    @Schema(description ="当前页面记录数量")
    private long pageSize;

    @Schema(description ="数据")
    private List<T> list;

    public PageListBean(){
    }

    public PageListBean(IPage<T> iPage){
        this.setList(iPage.getRecords());
        this.setPageSize(iPage.getSize());
        this.setTotalPage(iPage.getPages());
        this.setTotal(iPage.getTotal());
    }
}
