2 changed files with 47 additions and 0 deletions
@ -0,0 +1,39 @@ |
|||||||
|
package com.biutag.supervision.aop; |
||||||
|
|
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
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.stereotype.Component; |
||||||
|
|
||||||
|
/** |
||||||
|
* @ClassName CheckInterceptor |
||||||
|
* @Description 参数规范 |
||||||
|
* @Author shihao |
||||||
|
* @Date 2025/12/9 9:14 |
||||||
|
*/ |
||||||
|
@Component |
||||||
|
@Aspect |
||||||
|
@Slf4j |
||||||
|
public class CheckInterceptor { |
||||||
|
|
||||||
|
|
||||||
|
// @Pointcut("execution(* com.biutag.supervision.controller..*(..)) || execution(* com.biutag.supervision.service..*(..))")
|
||||||
|
@Pointcut("execution(* com.biutag.supervision.controller..*(..))") |
||||||
|
public void pointCut() { |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
@Before("pointCut()") |
||||||
|
public void check(JoinPoint joinPoint) { |
||||||
|
Object[] args = joinPoint.getArgs(); |
||||||
|
for (Object arg : args) { |
||||||
|
if (arg instanceof ParamChecked) { |
||||||
|
((ParamChecked) arg).check(); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
|
||||||
|
} |
||||||
Loading…
Reference in new issue