31 lines
666 B
Java
31 lines
666 B
Java
package com.designhub.annotation;
|
||
|
||
import java.lang.annotation.ElementType;
|
||
import java.lang.annotation.Retention;
|
||
import java.lang.annotation.RetentionPolicy;
|
||
import java.lang.annotation.Target;
|
||
|
||
/**
|
||
* 角色验证注解
|
||
* 用于Controller方法上,标记需要的角色
|
||
*/
|
||
@Target({ElementType.METHOD, ElementType.TYPE})
|
||
@Retention(RetentionPolicy.RUNTIME)
|
||
public @interface RequireRole {
|
||
|
||
/**
|
||
* 角色代码
|
||
*/
|
||
String[] value() default {};
|
||
|
||
/**
|
||
* 角色匹配模式:AND-需要所有角色,OR-需要任一角色
|
||
*/
|
||
LogicalMode mode() default LogicalMode.OR;
|
||
|
||
enum LogicalMode {
|
||
AND, OR
|
||
}
|
||
}
|
||
|