emun 统一管理 返回的code 和msg public enum ResultEnums {SUCCESS(0,"成功"),NNKOWN_ERROR(1,"未知错误");private int code;private String msg;private ResultEnums(int code, String msg) {this.code = code;this.msg = msg;}public int ge
emun 统一管理 返回的code 和msg
public enum ResultEnums {
SUCCESS(0,"成功"),
NNKOWN_ERROR(1,"未知错误")
;
private int code;
private String msg;
private ResultEnums(int code, String msg) {
this.code = code;
this.msg = msg;
}
public int getCode() {
return code;
}
public String getMsg() {
return msg;
}
}
rusult 内容 自己写个返回的格式 ,并继承Map 增加扩展性
public class Rusult
extends HashMap
controller 使用案例
@RequestMapping(value="/test")
private void test(HttpServletRequest req , HttpServletResponse resp){
log.info("test");
Rusult