ADD file via upload

master
pxh4iabou 2 years ago
parent 4a8584de12
commit dcc3ca9271

@ -0,0 +1,66 @@
package com.example.common;
public class Result<T> {
private String code;
private String msg;
private T data;
private Result(T data) {
this.data = data;
}
public Result() {
}
public static Result success() {
Result tResult = new Result<>();
tResult.setCode(ResultCode.SUCCESS.code);
tResult.setMsg(ResultCode.SUCCESS.msg);
return tResult;
}
public static <T> Result<T> success(T data) {
Result<T> tResult = new Result<>(data);
tResult.setCode(ResultCode.SUCCESS.code);
tResult.setMsg(ResultCode.SUCCESS.msg);
return tResult;
}
public static Result error() {
Result tResult = new Result<>();
tResult.setCode(ResultCode.ERROR.code);
tResult.setMsg(ResultCode.ERROR.msg);
return tResult;
}
public static Result error(String code, String msg) {
Result tResult = new Result<>();
tResult.setCode(code);
tResult.setMsg(msg);
return tResult;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
public T getData() {
return data;
}
public void setData(T data) {
this.data = data;
}
}
Loading…
Cancel
Save