package com.cm.common.result;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.io.Serializable;

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

    @ApiModelProperty(name = "rows", value = "数据列表")
    private List rows;
    @ApiModelProperty(name = "page", value = "当前页码", example = "1")
    private Integer page;
    @ApiModelProperty(name = "总数", value = "总页数", example = "20")
    private Long total;

    public SuccessResultList() {
    }

    public SuccessResultList(List rows, Integer page, Long total) {
        this.rows = rows;
        this.page = page;
        this.total = total;
    }

    public List getRows() {
        return rows;
    }

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

    public Integer getPage() {
        return page;
    }

    public void setPage(Integer page) {
        this.page = page;
    }

    public Long getTotal() {
        return total;
    }

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

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