Skip to content

Commit

Permalink
refactor(extension/crud): CrudApiHandler preHandle 方法增加 args 方法参数入餐
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles7c committed Nov 21, 2024
1 parent f2a30e8 commit 16da470
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,10 @@ public Object invoke(MethodInvocation invocation) throws Throwable {
// 获取处理器
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();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public Class getHandlerControllerClass() {
}

@Override
public void preHandle(CrudApi crudApi, Method targetMethod, Class<?> targetClass) {
public void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) {
// do nothing
}
}

0 comments on commit 16da470

Please sign in to comment.