public enum UserStatus {
Login(100,"用户登陆"),LoginOut(101,"用户退出"),Remove(103,"用户不存在");
private Integer code;
private String value;
public Integer getCode() {
return this.code;
}
public String getValue() {
return this.value;
}
UserStatus(Integer code, String value) {
this.code = code;
this.value = value;
}
@Override
public String toString() {
return "UserStatus{" +
"code=" + code +
", value='" + value + '\'' +
'}';
}
}
在controller中
@RequestMapping(value = "/selectUser",method = RequestMethod.POST)
public UserStatus selectUser(){
System.out.println(UserStatus.Login);
return UserStatus.Login;
}
打印的是UserStatus{code=100, value='用户登陆'},但是用postman跑这个接口返回却是字符串格式,现在的需求是也希望他返回跟System.out.println结果一致,postman跑的结果