package com.xvji.domain.vo;

import lombok.Data;
import java.util.List;

/**
 * 分页结果通用返回对象
 */
@Data
public class PageResult<T> {
    private long total;              // 总记录数
    private int pageNum;             // 当前页码
    private int pageSize;            // 每页条数
    private int pages;               // 总页数
    private List<T> list;               // 当前页数据列表

    public PageResult(long total, int pageNum, int pageSize, List<T> list) {
        this.total = total;
        this.pageNum = pageNum;
        this.pageSize = pageSize;
        this.list = list;
        this.pages = (int) Math.ceil((double) total / pageSize);
    }
}
