mirror of
https://github.com/continew-org/continew-starter.git
synced 2025-09-09 04:59:21 +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);
|
||||
if (crudApiHandler != null) {
|
||||
crudApiHandler.preHandle(crudApi, targetMethod, targetClass);
|
||||
crudApiHandler.preHandle(crudApi, invocation.getArguments(), targetMethod, targetClass);
|
||||
} 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();
|
||||
}
|
||||
|
@@ -40,9 +40,10 @@ public interface CrudApiHandler<T extends BaseController> {
|
||||
* 前置处理
|
||||
*
|
||||
* @param crudApi CRUD API 注解
|
||||
* @param args 方法参数
|
||||
* @param targetMethod 目标方法
|
||||
* @param targetClass 目标类
|
||||
* @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
|
||||
public void preHandle(CrudApi crudApi, Method targetMethod, Class<?> targetClass) {
|
||||
public void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) {
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user