package com.lanyuanxiaoyao.service.configuration.entity;

import java.util.ArrayList;
import java.util.List;

/**
 * 分页实体类
 *
 * @author lanyuanxiaoyao
 * @date 2023-04-26
 */
public class PageResponse<T> {
    private List<T> data = new ArrayList<>(0);
    private Long total = 0L;

    public PageResponse() {
    }

    public PageResponse(List<T> data) {
        this.data = data;
        this.total = (long) data.size();
    }

    public PageResponse(List<T> data, Long total) {
        this.data = data;
        this.total = total;
    }

    public List<T> getData() {
        return data;
    }

    public void setData(List<T> data) {
        this.data = data;
    }

    public Long getTotal() {
        return total;
    }

    public void setTotal(Long total) {
        this.total = total;
    }

    @Override
    public String toString() {
        return "PageResponse{" +
                "data=" + data +
                ", total=" + total +
                '}';
    }
}
