ResultVo

@Data
public class ResultVO<T> implements Serializable {

    private Integer code;
    private String msg;
    private T data;

    public ResultVO(int code,String msg,T data){
        this.code = code;
        this.msg = msg;
        this.data = data;
    }

    /**
     * 成功200、有数据
     * @param msg
     * @param data
     * @return
     */
    public static<T> ResultVO<T> success(String msg,T data){
        return new ResultVO<>(ResultCode.SUCCESS,msg,data);
    }

    /**
     * 成功200、无数据
     * @param msg
     * @return
     */
    public static<T> ResultVO<T> success(String msg){
        return success(msg,null);
    }

    /**
     * 失败500
     * @param msg
     * @param <T>
     * @return
     */
    public static<T> ResultVO<T> failed(String msg){
        return new ResultVO<>(ResultCode.FAILED,msg,null);
    }

    /**
     * 自定义返回
     * @param msg
     * @param code
     * @param data
     * @param <T>
     * @return
     */
    public static<T> ResultVO<T> result(String msg,Integer code,T data){
        return new ResultVO<T>(code,msg,data);
    }
}
public interface ResultCode {
    /**
     * 请求成功
     */
    int SUCCESS = 200;
    /**
     * 服务器异常
     */
    int FAILED = 500;
    /**
     * 未授权
     */
    int UNAUTHORIZED = 401;
    /**
     * 无权限
     */
    int NOACCESS = 403;
}