chore: continew-starter 2.7.2 => 2.7.3

1.CrudApi GET => DETAIL(支持详情权限)
2.适配 CharConstants
3.适配 EnumValue 校验器
This commit is contained in:
2024-11-15 22:25:30 +08:00
parent 985bc25716
commit 556f6c33b1
24 changed files with 48 additions and 27 deletions

View File

@@ -24,6 +24,7 @@ import org.springframework.core.annotation.Order;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
import org.springframework.web.method.annotation.MethodArgumentTypeMismatchException;
import org.springframework.web.multipart.MultipartException;
import top.continew.starter.core.exception.BadRequestException;
import top.continew.starter.core.exception.BusinessException;
@@ -58,6 +59,16 @@ public class GlobalExceptionHandler {
return R.fail(String.valueOf(HttpStatus.BAD_REQUEST.value()), e.getMessage());
}
/**
* 拦截校验异常-方法参数类型不匹配异常
*/
@ExceptionHandler(MethodArgumentTypeMismatchException.class)
public R handleMethodArgumentTypeMismatchException(MethodArgumentTypeMismatchException e,
HttpServletRequest request) {
log.error("[{}] {}", request.getMethod(), request.getRequestURI(), e);
return R.fail(String.valueOf(HttpStatus.BAD_REQUEST.value()), "参数 '%s' 类型不匹配".formatted(e.getName()));
}
/**
* 拦截文件上传异常-超过上传大小限制
*/