标签:实体类 code nal 通用 class lan zab 状态码 integer
* Created by cws
*/
@Data
public class ResultVM implements Serializable {
private static final long serialVersionUID = 1L;
public static final Integer CODE = 0;
private Integer code;
private String msg;
private Object result;
public ResultVM() {
}
public ResultVM(Integer code) {
this.code = code;
}
public ResultVM(Integer code, String msg) {
this.code = code;
this.msg = msg;
}
public ResultVM(Integer code, Object result) {
this.code = code;
this.result = result;
}
public ResultVM(Integer code, String msg, Object result) {
this.code = code;
this.msg = msg;
this.result = result;
}
public ResultVM(Object result) {
this.result = result;
}
public static com.aaa.controller.vm.ResultVM error() {
return error(500, "未知异常,请联系管理员");
}
public static com.aaa.controller.vm.ResultVM error(String msg) {
return error(500, msg);
}
public static com.aaa.controller.vm.ResultVM error(Integer code, String msg) {
return new com.aaa.controller.vm.ResultVM(code, msg);
}
/**
* 带通用返回数据
* @param msg
* @param result
* @return
*/
public static com.aaa.controller.vm.ResultVM ok(String msg, Object result) {
return new com.aaa.controller.vm.ResultVM(CODE, msg, result);
}
/**
* 不带数据
* @param msg
* @return
*/
public static com.aaa.controller.vm.ResultVM ok(String msg) {
return new com.aaa.controller.vm.ResultVM(CODE, msg);
}
/**
* 带数据
* @param result
* @return
*/
public static com.aaa.controller.vm.ResultVM ok(Object result) {
return new com.aaa.controller.vm.ResultVM(CODE, result);
}
/**
* 只带状态码
* @return
*/
public static com.aaa.controller.vm.ResultVM ok() {
return new com.aaa.controller.vm.ResultVM(CODE);
}
}
标签:实体类 code nal 通用 class lan zab 状态码 integer
原文地址:https://www.cnblogs.com/cwshuo/p/13885665.html