package com.ruoyi.framework.aspectj;

import com.ruoyi.common.annotation.Dev;
import com.ruoyi.common.config.RuoYiConfig;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.springframework.stereotype.Component;

@Slf4j
@Aspect
@Component
@RequiredArgsConstructor
public class DevAspect {

    private final RuoYiConfig config;
    @Before("@annotation(dev)")
    public void doBefore(JoinPoint point, Dev dev) throws Throwable {
        if(!config.getDev()){
            throw new RuntimeException("开发模式接口");
        }
    }
}
