package ink.wgink.database.pojo.result;

import ink.wgink.pojo.result.SuccessResult;

import java.util.List;
import java.util.Map;

/**
 * @ClassName: SuccessResultList
 * @Description: 成功列表结果
 * @Author: WangGeng
 * @Date: 2019/3/3 12:21 AM
 * @Version: 1.0
 **/
public class SuccessResultSqlList extends SuccessResult {

    private static final long serialVersionUID = 7152646978840034322L;

    private List<Map<String, Object>> fields;
    private List<Map<String, Object>> rows;
    private Integer page;
    private Long total;

    public SuccessResultSqlList() {
    }

    public SuccessResultSqlList(List<Map<String, Object>> fields, List<Map<String, Object>> rows, Integer page, Long total) {
        this.fields = fields;
        this.rows = rows;
        this.page = page;
        this.total = total;
    }

    @Override
    public String toString() {
        final StringBuilder sb = new StringBuilder("{");
        sb.append("\"fields\":")
                .append(fields);
        sb.append(",\"rows\":")
                .append(rows);
        sb.append(",\"page\":")
                .append(page);
        sb.append(",\"total\":")
                .append(total);
        sb.append('}');
        return sb.toString();
    }
}
