package com.psbc.cpsp.entity;

import com.baomidou.mybatisplus.core.metadata.IPage;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

@Data
@NoArgsConstructor
@AllArgsConstructor
public class PageInfo<T> {
    private long pageSize;
    private long pageNum;
    private long total;
    private List<T> data;

    public static  <T> PageInfo<T> toPageInfo(IPage<T> data) {
        return new PageInfo<T>(data.getSize(), data.getCurrent(), data.getTotal(), data.getRecords());
    }
}
