|
@@ -0,0 +1,32 @@
|
|
|
|
+package com.diagbot.aop;
|
|
|
|
+
|
|
|
|
+import com.diagbot.enums.SysTypeEnum;
|
|
|
|
+import com.diagbot.util.PermissionUtil;
|
|
|
|
+import org.aspectj.lang.JoinPoint;
|
|
|
|
+import org.aspectj.lang.annotation.Aspect;
|
|
|
|
+import org.aspectj.lang.annotation.Before;
|
|
|
|
+import org.aspectj.lang.annotation.Pointcut;
|
|
|
|
+import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
|
+
|
|
|
|
+/**
|
|
|
|
+ * @Description: 接口权限拦截
|
|
|
|
+ * @author: gaodm
|
|
|
|
+ * @time: 2020/2/17 14:34
|
|
|
|
+ */
|
|
|
|
+@Aspect
|
|
|
|
+@Component
|
|
|
|
+@ConditionalOnProperty(prefix = "permission", value = { "enable" }, havingValue = "true")
|
|
|
|
+public class PermissionAspect {
|
|
|
|
+
|
|
|
|
+ //切所有Controller
|
|
|
|
+ @Pointcut("execution(* com.diagbot.web..*.*(..))")
|
|
|
|
+ public void pointcutController() {
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Before("pointcutController()")
|
|
|
|
+ public void permissionIntercept(JoinPoint joinPoint) {
|
|
|
|
+ //权限拦截
|
|
|
|
+ PermissionUtil.permissionAspect(joinPoint, SysTypeEnum.LTAPI_SERVICE.getKey());
|
|
|
|
+ }
|
|
|
|
+}
|