package me.qwq.doghouse.pojo.dto;

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

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

/**
 * 后台查询结果，适配 layui
 * @author Doghole
 **/
@Data
@Accessors(chain = true)
public class LayPageResp<T> implements Serializable {

    /**
     * 
     */
    private static final long serialVersionUID = 3706125181722544872L;

    //状态码
    private int code;

    //提示消息
    private String msg;

    //总条数
    private long count;
    
    // 当前页数
    private long curr;
    
    // 当前页限制
    private long limit;

    //表格数据
    private List<T> data;
    
    public LayPageResp() {}
    
    public LayPageResp(IPage<T> page) {
        this.data = page.getRecords();
        this.count = page.getTotal();
        this.curr = page.getCurrent();
        this.limit = page.getSize();
    }
}
