package com.judong.chuanyiserver.util;


import com.judong.chuanyiserver.enums.ResultEnum;
import lombok.Data;

@Data
public class Result {
    private Integer code;//响应码
    private String msg;//响应消息
    private Object data;//返回的数据

    public static Result ok(Object data) {
        Result result = new Result();
        result.setCode(ResultEnum.SUCCESS.getRespCode());
        result.setMsg(ResultEnum.SUCCESS.getRespMsg());
        result.setData(data);
        return result;
    }

    public static Result no(Integer code, String msg) {
        Result result = new Result();
        result.setCode(code);
        result.setMsg(msg);
        return result;
    }
}
