【7.2.5】【scanner】更新资源扫描对类的支持

pull/37/head
fengshuonan 2022-09-28 15:41:20 +08:00
parent 743a2be9e7
commit 442736dfa5
4 changed files with 18 additions and 5 deletions

View File

@ -50,7 +50,14 @@ public enum ResBizTypeEnum implements ReadableEnum<ResBizTypeEnum> {
/**
*
*/
BUSINESS(2, "业务类");
BUSINESS(2, "业务类"),
/**
*
* <p>
* @ApiResource
*/
DEFAULT(3, "默认类");
/**
* 使@EnumValuemybatis-plus使code

View File

@ -89,7 +89,7 @@ public @interface GetResource {
/**
*
*/
ResBizTypeEnum resBizType() default ResBizTypeEnum.BUSINESS;
ResBizTypeEnum resBizType() default ResBizTypeEnum.DEFAULT;
/**
* (RequestMapping)

View File

@ -94,7 +94,7 @@ public @interface PostResource {
/**
*
*/
ResBizTypeEnum resBizType() default ResBizTypeEnum.BUSINESS;
ResBizTypeEnum resBizType() default ResBizTypeEnum.DEFAULT;
/**
* (RequestMapping)

View File

@ -246,12 +246,18 @@ public class ApiResourceScanner implements BeanPostProcessor {
Boolean requiredLogin = invokeAnnotationMethod(apiResource, "requiredLogin", Boolean.class);
Boolean requiredPermission = invokeAnnotationMethod(apiResource, "requiredPermission", Boolean.class);
Boolean viewFlag = invokeAnnotationMethod(apiResource, "viewFlag", Boolean.class);
ResBizTypeEnum resBizType = invokeAnnotationMethod(apiResource, "resBizType", ResBizTypeEnum.class);
ResBizTypeEnum methodResBizType = invokeAnnotationMethod(apiResource, "resBizType", ResBizTypeEnum.class);
resourceDefinition.setRequiredLoginFlag(requiredLogin);
resourceDefinition.setRequiredPermissionFlag(requiredPermission);
resourceDefinition.setResourceName(name);
resourceDefinition.setResourceBizType(resBizType.getCode());
// 填充资源的业务类型
if (!methodResBizType.equals(ResBizTypeEnum.DEFAULT)) {
resourceDefinition.setResourceBizType(methodResBizType.getCode());
} else {
resourceDefinition.setResourceBizType(classApiAnnotation.resBizType().getCode());
}
// 根据控制器和控制器方法的path组装最后的url
String controllerMethodPath = createControllerPath(controllerClass, methodPath[0]);