fix(extension/crud): 修复使用 CrudRequestMapping 后自定义 API 不显示的问题

This commit is contained in:
2023-12-13 23:44:23 +08:00
parent bc00c9bab0
commit 1adfddfa3b

View File

@@ -49,11 +49,11 @@ public class CrudRequestMappingHandlerMapping extends RequestMappingHandlerMappi
if (!handlerType.isAnnotationPresent(CrudRequestMapping.class)) { if (!handlerType.isAnnotationPresent(CrudRequestMapping.class)) {
return requestMappingInfo; return requestMappingInfo;
} }
// 过滤 API如果 API 列表中不包含,则忽略
CrudRequestMapping crudRequestMapping = handlerType.getDeclaredAnnotation(CrudRequestMapping.class); CrudRequestMapping crudRequestMapping = handlerType.getDeclaredAnnotation(CrudRequestMapping.class);
// 过滤 API如果非本类中定义且 API 列表中不包含,则忽略
Api[] apiArr = crudRequestMapping.api(); Api[] apiArr = crudRequestMapping.api();
Api api = ExceptionUtils.exToNull(() -> Api.valueOf(method.getName().toUpperCase())); Api api = ExceptionUtils.exToNull(() -> Api.valueOf(method.getName().toUpperCase()));
if (!ArrayUtil.containsAny(apiArr, Api.ALL, api)) { if (method.getDeclaringClass() != handlerType && !ArrayUtil.containsAny(apiArr, Api.ALL, api)) {
return null; return null;
} }
// 拼接路径(合并了 @RequestMapping 的部分能力) // 拼接路径(合并了 @RequestMapping 的部分能力)