package com.ankaibei.workFlow.webadmin.ankaibei.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author lwq
 * @version 1.0
 * @description:
 * @date 2022/9/26 11:21
 */

@Configuration
public class LoginConfig implements WebMvcConfigurer {

    /**
     *服务器存储路径
     */
    final String basePath="/ankaibei/upload/";
    /**
     *上传服务器的映射路径
     */
    final String staticAccessPath="/static/";
    /**
     *本地存储路径
     */
    String locationPath = "D:/upload/";

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        ////注册TestInterceptor拦截器
        //InterceptorRegistration registration = registry.addInterceptor(new UserLoginInterceptor());
        //registration.addPathPatterns("/manHour/**");
        //registration.addPathPatterns("/project/**");
        //registration.addPathPatterns("/projectteam/**");
        //registration.addPathPatterns("/task/**");
        //registration.addPathPatterns("/cost/**");
        //registration.addPathPatterns("/apply/**");
        //registration.excludePathPatterns("/login");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {

        //添加默认的静态资源访问路径
        registry.addResourceHandler(staticAccessPath+"**")
                .addResourceLocations("file:"+basePath);
        registry.addResourceHandler(staticAccessPath+"**")
                .addResourceLocations("file:"+locationPath);

    }



}

