package com.ihooyah.common.msg;

import java.util.List;

/**
 * 描述
 *
 * @author fatiaojie
 * @date 2020/4/1 9:56
 */
public class TableRespInfo<T> extends BaseRespInfo {

    TableData<T> result;

    public TableRespInfo(long total, List<T> rows) {
        this.result = new TableData<T>(total, rows);
    }

    public TableRespInfo() {
        this.result = new TableData<T>();
    }

    TableRespInfo<T> total(int total) {
        this.result.setTotal(total);
        return this;
    }

    TableRespInfo<T> total(List<T> rows) {
        this.result.setRows(rows);
        return this;
    }

    public TableData<T> getResult() {
        return result;
    }

    public void setResult(TableData<T> result) {
        this.result = result;
    }

    class TableData<T> {
        long total;
        List<T> rows;

        public TableData(long total, List<T> rows) {
            this.total = total;
            this.rows = rows;
        }

        public TableData() {
        }

        public long getTotal() {
            return total;
        }

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

        public List<T> getRows() {
            return rows;
        }

        public void setRows(List<T> rows) {
            this.rows = rows;
        }
    }
}
