package cn.iocoder.yudao.module.knowledge.constants;

import lombok.Data;

import java.io.Serializable;


@Data
public class Result<T> implements Serializable {
    private Integer code;
    private String msg;
    private T data;
    private static final Integer SUCCESS_CODE = 200;
    private static final String SUCCESS_MSG = "success";
    public Result() {
    }

    public Result(Object o, String 文件不能为空) {
    }

    public Integer getCode() {
        return this.code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMsg() {
        return this.msg;
    }

    public void setMsg(String msg) {
        this.msg = msg;
    }

    public T getData() {
        return this.data;
    }

    public void setData(T data) {
        this.data = data;
    }

    public String toString() {
        return "Result{code=" + this.code + ", msg='" + this.msg + "', data=" + this.data + "}";
    }
    public static <T> Result<T> success(T data) {
        Result var1 = new Result();
        var1.setCode(SUCCESS_CODE);
        var1.setMsg("success");
        var1.setData(data);
        return var1;
    }

    public static <T> Result<T> success() {
        return success((T)null);
    }

    public static <T> Result<T> error(Integer code, String msg) {
        Result var2 = new Result();
        var2.setCode(code);
        var2.setMsg(msg);
        return var2;
    }
}
