添加登陆表单信息错误处理

This commit is contained in:
筱锋xiao_lfeng 2023-12-21 12:37:56 +08:00
parent 93c1e1c2ca
commit 3ef2688320
Signed by: XiaoLFeng
GPG Key ID: F693AA12AABBFA87

View File

@ -49,8 +49,11 @@ public class UserController {
* @author 176yunxuan * @author 176yunxuan
*/ */
@PostMapping("/user/login") @PostMapping("/user/login")
public BaseResponse userLogin(@RequestBody UserLoginVO userLoginVO){ public BaseResponse userLogin(@RequestBody UserLoginVO userLoginVO, BindingResult bindingResult){
// 判断是否有参数错误
if (bindingResult.hasErrors()) {
return ResultUtil.error(ErrorCode.REQUEST_BODY_ERROR, Processing.getValidatedErrorList(bindingResult));
}
return userService.userLogin(userLoginVO); return userService.userLogin(userLoginVO);
} }
} }