package com.aucma.framework.validation;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Wen JY
 * @description: 系统校验拦截器配置
 * @date 2025-10-09 17:14:00
 * @version: 1.0
 */
@Configuration
public class InterceptorConfig implements WebMvcConfigurer {

    @Bean
    public ValidationInterceptor interceptor() {
        return new ValidationInterceptor();
    }

    @Override
    public void addInterceptors(InterceptorRegistry registry) {

        registry.addInterceptor(interceptor())
                .addPathPatterns("/api/**")
                .excludePathPatterns("/error");

        registry.addInterceptor(interceptor())
                .addPathPatterns("/boardReport/**")
                .excludePathPatterns("/error");

    }
}
