package com.gyee.runeconomy.dto;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @ClassName : R
 * @Author : xieshengjie
 * @Date: 2021/5/16 16:59
 * @Description : 结果集
 */
@Data
public class R {

    @ApiModelProperty(value = "返回码")
    private Integer code;
    @ApiModelProperty(value = "返回数据")
    private ResultMsg data = new ResultMsg();

    private R() {
    }

    public static R error(ResultMsg error) {
        R r = new R();
        r.setData(error);
        r.setCode(ResultCode.ERROR1);
        return r;
    }

    public static R data(ResultMsg ok) {

        R r = new R();
        r.setCode(ResultCode.SUCCESS0);
        r.setData(ok);
        return r;
    }
}
