Commit 44c69a25 by 袁伟铭

优化代码

parent 8d948e0a
...@@ -106,7 +106,7 @@ public class UnifiedExceptionHandler { ...@@ -106,7 +106,7 @@ public class UnifiedExceptionHandler {
paranmName = ((MissingServletRequestParameterException) ex).getParameterName(); paranmName = ((MissingServletRequestParameterException) ex).getParameterName();
} else if (ex instanceof BindException) { } else if (ex instanceof BindException) {
List<FieldError> fieldErrors = ((BindException) ex).getBindingResult().getFieldErrors(); List<FieldError> fieldErrors = ((BindException) ex).getBindingResult().getFieldErrors();
paranmName = fieldErrors.stream().map(f -> "[" + f.getDefaultMessage() + "(" + f.getField() + ")]").collect(Collectors.joining("、")); paranmName = fieldErrors.stream().map(f -> f.getDefaultMessage() + "[" + f.getField() + "]").collect(Collectors.joining("、"));
} }
return ResultVo.fail(HttpStatus.BAD_REQUEST.value(), "缺少请求参数:" + paranmName); return ResultVo.fail(HttpStatus.BAD_REQUEST.value(), "缺少请求参数:" + paranmName);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment