package com.esv.freight.file.common.vo;

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

import java.util.List;

/**
 * @description: 分页查询返回结果VO
 * @project: freight-file-service
 * @name: com.esv.freight.file.common.vo.PageResultVO
 * @author: 黄朝斌
 * @email: huangchaobin@esvtek.com
 * @createTime: 2020/04/09 10:01
 * @version:1.0
 */
@Data
public class PageResultVO {

    /**
     * 每页记录条数
     **/
    private Long pageSize;

    /**
     * 当前页码
     **/
    private Long pageNum;

    /**
     * 总记录条数
     **/
    private Long total;

    /**
     * 当前页的记录条数
     **/
    private Long recordSize;

    /**
     * 数据
     **/
    private List<?> records;

    public PageResultVO(IPage page, List<?> record) {
        this.pageSize = page.getSize();
        this.pageNum = page.getCurrent();
        this.total = page.getTotal();
        this.recordSize = Long.parseLong(String.valueOf(page.getRecords().size()));
        this.records = record;
    }
}
