1.定义一个枚举类,如下所示:
public enum ResultEnum {
SUCCESS(0,"成功"),
ERROR(1,"失败"),
FAIL(-1,"未知错误");
private int code;
private String msg;
ResultEnum(int code, String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public void setCode(int code) {
this.code = code;
}
public String getMsg() {
return msg;
}
public void setMsg(String msg) {
this.msg = msg;
}
}
2.定义返回结果参数类,如下所示
public class ResponseParam<T> implements Serializable {
/**
* 返回数据
*/
private Map<String,T> data = new HashMap<>();
private int