权限注解:
@Target({ElementType.TYPE,ElementType.METHOD})
@Retention(RetentionPolicy.RUNTIME)
public @interface CheckPermissions {
String value() default "";
}
切入点:
@Aspect
@Component
public class CheckPermissionsAspect extends BaseController {
@Autowired
private OrgMenuService menuService;
@Autowired
private OrgEmpRoleService empRoleService;
@Autowired
private OrgRoleMenuService roleMenuService;
@Autowired
private OrgEmpService empService;
@Pointcut("@annotation(com.bcl.yiliao.annotation.CheckPermissions)")
public void CheckPermissionsAspect() {
}
@Before("CheckPermissionsAspect()")
public void doBefore(JoinPoint joinpoint) throws Throwable {
//获取用户的ID
Long userId = getCurrentUserId();
if(userId == 0){