mirror of https://gitee.com/stylefeng/roses
【7.2.5】【scanner】更新资源扫描对类的支持
parent
743a2be9e7
commit
442736dfa5
|
@ -50,7 +50,14 @@ public enum ResBizTypeEnum implements ReadableEnum<ResBizTypeEnum> {
|
|||
/**
|
||||
* 业务类
|
||||
*/
|
||||
BUSINESS(2, "业务类");
|
||||
BUSINESS(2, "业务类"),
|
||||
|
||||
/**
|
||||
* 默认
|
||||
* <p>
|
||||
* 如果是默认,则方法的业务类别,则会根据控制器上@ApiResource的类别决定具体方法的类别
|
||||
*/
|
||||
DEFAULT(3, "默认类");
|
||||
|
||||
/**
|
||||
* 使用@EnumValue注解,标记mybatis-plus保存到库中使用code值
|
||||
|
|
|
@ -89,7 +89,7 @@ public @interface GetResource {
|
|||
/**
|
||||
* 资源的类型,系统类还是业务类资源
|
||||
*/
|
||||
ResBizTypeEnum resBizType() default ResBizTypeEnum.BUSINESS;
|
||||
ResBizTypeEnum resBizType() default ResBizTypeEnum.DEFAULT;
|
||||
|
||||
/**
|
||||
* 请求路径(同RequestMapping)
|
||||
|
|
|
@ -94,7 +94,7 @@ public @interface PostResource {
|
|||
/**
|
||||
* 资源的类型,系统类还是业务类资源
|
||||
*/
|
||||
ResBizTypeEnum resBizType() default ResBizTypeEnum.BUSINESS;
|
||||
ResBizTypeEnum resBizType() default ResBizTypeEnum.DEFAULT;
|
||||
|
||||
/**
|
||||
* 请求路径(同RequestMapping)
|
||||
|
|
|
@ -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]);
|
||||
|
|
Loading…
Reference in New Issue