package com.icomsys.main_vm.biz.common.system.vo;

import com.querydsl.core.QueryResults;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
@NoArgsConstructor
public class DslDataTableRes<T> {

    private List<T> getList;
    private Long getTotal;
    private Long getLimit;
    private Long getOffset;

    public DslDataTableRes(QueryResults<T> dslResult) {
//        this.dslResult = dslResult;
        this.getList = dslResult.getResults();
        this.getTotal = dslResult.getTotal();
        this.getLimit = dslResult.getLimit();
        this.getOffset = dslResult.getOffset();
    }

    public DslDataTableRes(QueryResults<T> dslResult, List<T> data) {
        this.getList = data;
        this.getTotal = dslResult.getTotal();
        this.getLimit = dslResult.getLimit();
        this.getOffset = dslResult.getOffset();
    }

    public DslDataTableRes(List<T> data, Long total, Long limit, Long offset ) {
        this.getList = data;
        this.getTotal = total;
        this.getLimit = limit;
        this.getOffset = offset;
    }
}
