Skip to content

Commit 16da470

Browse files
committed
refactor(extension/crud): CrudApiHandler preHandle 方法增加 args 方法参数入餐
1 parent f2a30e8 commit 16da470

File tree

3 files changed

+6
-4
lines changed

3 files changed

+6
-4
lines changed

continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-core/src/main/java/top/continew/starter/extension/crud/aop/CrudApiAnnotationInterceptor.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,9 +50,10 @@ public Object invoke(MethodInvocation invocation) throws Throwable {
5050
// 获取处理器
5151
CrudApiHandler<?> crudApiHandler = CrudApiStrategy.INSTANCE.handlerMap.get(targetClass);
5252
if (crudApiHandler != null) {
53-
crudApiHandler.preHandle(crudApi, targetMethod, targetClass);
53+
crudApiHandler.preHandle(crudApi, invocation.getArguments(), targetMethod, targetClass);
5454
} else {
55-
CrudApiStrategy.INSTANCE.handlerMap.get(BaseController.class).preHandle(crudApi, targetMethod, targetClass);
55+
CrudApiStrategy.INSTANCE.handlerMap.get(BaseController.class)
56+
.preHandle(crudApi, invocation.getArguments(), targetMethod, targetClass);
5657
}
5758
return invocation.proceed();
5859
}

continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-core/src/main/java/top/continew/starter/extension/crud/handler/CrudApiHandler.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,10 @@ public interface CrudApiHandler<T extends BaseController> {
4040
* 前置处理
4141
*
4242
* @param crudApi CRUD API 注解
43+
* @param args 方法参数
4344
* @param targetMethod 目标方法
4445
* @param targetClass 目标类
4546
* @throws Exception 处理异常
4647
*/
47-
void preHandle(CrudApi crudApi, Method targetMethod, Class<?> targetClass) throws Exception;
48+
void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) throws Exception;
4849
}

continew-starter-extension/continew-starter-extension-crud/continew-starter-extension-crud-core/src/main/java/top/continew/starter/extension/crud/handler/DefaultCrudApiHandler.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public Class getHandlerControllerClass() {
3535
}
3636

3737
@Override
38-
public void preHandle(CrudApi crudApi, Method targetMethod, Class<?> targetClass) {
38+
public void preHandle(CrudApi crudApi, Object[] args, Method targetMethod, Class<?> targetClass) {
3939
// do nothing
4040
}
4141
}

0 commit comments

Comments
 (0)