package com.docus.server.config;


import com.docus.server.util.StaticResourceMapping;
import com.docus.server.util.TableJsonRead;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

import java.io.File;

/**
 * @author WYBDEV
 */
@Configuration
public class StaticResourceWebConfig implements WebMvcConfigurer {


    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        // 静态资源映射
        registry.addResourceHandler("/"+ StaticResourceMapping.LIS +"/**")
                .addResourceLocations("file:"+ TableJsonRead.currentPath(StaticResourceMapping.STATIC_RESOURCE_PREFIX+ File.separator+StaticResourceMapping.LIS)+File.separator);
        registry.addResourceHandler("/"+ StaticResourceMapping.SHOU_MA +"/**")
                .addResourceLocations("file:"+ TableJsonRead.currentPath(StaticResourceMapping.STATIC_RESOURCE_PREFIX+ File.separator+StaticResourceMapping.SHOU_MA)+File.separator);
    }

}
