add 增加ruoyi-resource资源模块 移除ruoyi-file模块 调整项目结构

This commit is contained in:
疯狂的狮子li
2022-02-09 18:59:04 +08:00
parent 5870045c35
commit 69e699946f
91 changed files with 3324 additions and 2007 deletions

View File

@@ -36,8 +36,9 @@
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-core</artifactId>
<scope>provided</scope>
</dependency>
</dependencies>

View File

@@ -1,7 +1,10 @@
package com.ruoyi.common.swagger.config;
import cn.dev33.satoken.config.SaTokenConfig;
import com.github.xiaoymin.knife4j.spring.annotations.EnableKnife4j;
import com.ruoyi.common.swagger.config.properties.SwaggerProperties;
import io.swagger.models.auth.In;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
@@ -31,6 +34,9 @@ import java.util.function.Predicate;
@ConditionalOnProperty(name = "swagger.enabled", matchIfMissing = true)
public class SwaggerAutoConfiguration {
@Autowired
private SaTokenConfig saTokenConfig;
/**
* 默认的排除路径排除Spring Boot默认的错误处理路径和端点
*/
@@ -57,6 +63,7 @@ public class SwaggerAutoConfiguration {
swaggerProperties.getExcludePath().forEach(path -> excludePath.add(PathSelectors.ant(path)));
ApiSelectorBuilder builder = new Docket(DocumentationType.OAS_30)
.enable(swaggerProperties.getEnabled())
.host(swaggerProperties.getHost())
.apiInfo(apiInfo(swaggerProperties))
.select()
@@ -76,7 +83,8 @@ public class SwaggerAutoConfiguration {
*/
private List<SecurityScheme> securitySchemes() {
List<SecurityScheme> apiKeyList = new ArrayList<>();
apiKeyList.add(new ApiKey("Authorization", "Authorization", "header"));
String header = saTokenConfig.getTokenName();
apiKeyList.add(new ApiKey(header, header, In.HEADER.toValue()));
return apiKeyList;
}
@@ -101,7 +109,7 @@ public class SwaggerAutoConfiguration {
AuthorizationScope[] authorizationScopes = new AuthorizationScope[1];
authorizationScopes[0] = authorizationScope;
List<SecurityReference> securityReferences = new ArrayList<>();
securityReferences.add(new SecurityReference("Authorization", authorizationScopes));
securityReferences.add(new SecurityReference(saTokenConfig.getTokenName(), authorizationScopes));
return securityReferences;
}