mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-25 22:57:08 +08:00
refactor(extension/crud): CrudApiHandler preHandle 方法增加 args 方法参数入餐
This commit is contained in:
@@ -50,9 +50,10 @@ public class CrudApiAnnotationInterceptor implements MethodInterceptor {
|
|||||||
// 获取处理器
|
// 获取处理器
|
||||||
CrudApiHandler<?> crudApiHandler = CrudApiStrategy.INSTANCE.handlerMap.get(targetClass);
|
CrudApiHandler<?> crudApiHandler = CrudApiStrategy.INSTANCE.handlerMap.get(targetClass);
|
||||||
if (crudApiHandler != null) {
|
if (crudApiHandler != null) {
|
||||||
crudApiHandler.preHandle(crudApi, targetMethod, targetClass);
|
crudApiHandler.preHandle(crudApi, invocation.getArguments(), targetMethod, targetClass);
|
||||||
} else {
|
} else {
|
||||||
CrudApiStrategy.INSTANCE.handlerMap.get(BaseController.class).preHandle(crudApi, targetMethod, targetClass);
|
CrudApiStrategy.INSTANCE.handlerMap.get(BaseController.class)
|
||||||
|
.preHandle(crudApi, invocation.getArguments(), targetMethod, targetClass);
|
||||||
}
|
}
|
||||||
return invocation.proceed();
|
return invocation.proceed();
|
||||||
}
|
}
|
||||||
|
@@ -40,9 +40,10 @@ public interface CrudApiHandler<T extends BaseController> {
|
|||||||
* 前置处理
|
* 前置处理
|
||||||
*
|
*
|
||||||
* @param crudApi CRUD API 注解
|
* @param crudApi CRUD API 注解
|
||||||
|
* @param args 方法参数
|
||||||
* @param targetMethod 目标方法
|
* @param targetMethod 目标方法
|
||||||
* @param targetClass 目标类
|
* @param targetClass 目标类
|
||||||
* @throws Exception 处理异常
|
* @throws Exception 处理异常
|
||||||
*/
|
*/
|
||||||
void preHandle(CrudApi crudApi, Method targetMethod, Class<?> targetClass) throws Exception;
|
void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) throws Exception;
|
||||||
}
|
}
|
||||||
|
@@ -35,7 +35,7 @@ public class DefaultCrudApiHandler implements CrudApiHandler<BaseController> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void preHandle(CrudApi crudApi, Method targetMethod, Class<?> targetClass) {
|
public void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) {
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user