老师,请问为什么我这边枚举类型loginType接受不到值
来源:6-2 Filter、Interceptor、AOP机制的区别于联系
慕莱坞8271573
2020-04-14 16:48:29
@Getter
@Setter
public class LoginParam {
/**
* 账号,如果是微信登录则装载code
*/
@NotBlank(message = "{token.account}")
private String account;
private String password;
private LoginType loginType;
}
@PostMapping
public Map<String, String> getToken(@RequestBody @Validated LoginParam loginParam){
String token=null;
token=wxAuthenticationService.code2Session(loginParam.getAccount());
// switch (loginParam.getLoginType()){
// case USER_WX:{
// token=wxAuthenticationService.code2Session(loginParam.getAccount());
// break;
// }
// case USER_MAIL:{
// break;
// }
// case USER_PHONE:{
// break;
// }
// default:{
// throw new NotFoundException(10003);
// }
// }
Map<String,String> map=new HashMap<>();
map.put("token",token);
return map;
}
public enum LoginType {
USER_WX(0,"微信登录"),
USER_MAIL(1,"邮箱登录"),
USER_PHONE(2,"手机号码登录");
private Integer value;
LoginType(Integer value,String description){
this.value=value;
}
}
1回答
调试一下,这种问题不调试很难看出问题
相似问题