This commit is contained in:
parent
50d4180e4d
commit
2ab12ec2a7
|
|
@ -5,7 +5,7 @@
|
||||||
"author": "若依",
|
"author": "若依",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vue-cli-service serve",
|
"dev": "export NODE_OPTIONS=--openssl-legacy-provider && vue-cli-service serve",
|
||||||
"build:prod": "vue-cli-service build",
|
"build:prod": "vue-cli-service build",
|
||||||
"build:stage": "vue-cli-service build --mode staging",
|
"build:stage": "vue-cli-service build --mode staging",
|
||||||
"preview": "node build/index.js --preview",
|
"preview": "node build/index.js --preview",
|
||||||
|
|
|
||||||
|
|
@ -48,6 +48,13 @@
|
||||||
<version>${ruoyi.version}</version>
|
<version>${ruoyi.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- ruoyi-gateway -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-gateway</artifactId>
|
||||||
|
<version>${ruoyi.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</project>
|
</project>
|
||||||
|
|
@ -2,6 +2,7 @@ package com.ruoyi.web.admin;
|
||||||
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.context.annotation.ComponentScan;
|
||||||
|
|
||||||
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
import com.ruoyi.common.security.annotation.EnableCustomConfig;
|
||||||
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
import com.ruoyi.common.security.annotation.EnableRyFeignClients;
|
||||||
|
|
@ -16,6 +17,7 @@ import com.ruoyi.common.swagger.annotation.EnableCustomSwagger2;
|
||||||
@EnableCustomSwagger2
|
@EnableCustomSwagger2
|
||||||
@EnableRyFeignClients
|
@EnableRyFeignClients
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
|
@ComponentScan("com.ruoyi")
|
||||||
public class RuoYiWebAdminApplication
|
public class RuoYiWebAdminApplication
|
||||||
{
|
{
|
||||||
public static void main(String[] args)
|
public static void main(String[] args)
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,20 @@
|
||||||
|
package com.ruoyi.web.admin.config;
|
||||||
|
|
||||||
|
import org.springframework.boot.autoconfigure.web.servlet.WebMvcRegistrations;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 自动补全路由前缀配置类
|
||||||
|
* @author 1763113879@qq.com
|
||||||
|
* @version V2.1
|
||||||
|
* @since 2.1.0 2023/11/15 14:48
|
||||||
|
*/
|
||||||
|
@Component
|
||||||
|
public class AutoPrefixConfiguration implements WebMvcRegistrations {
|
||||||
|
@Override
|
||||||
|
public RequestMappingHandlerMapping getRequestMappingHandlerMapping() {
|
||||||
|
return new AutoPrefixUrlMapping();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,84 @@
|
||||||
|
package com.ruoyi.web.admin.config;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Objects;
|
||||||
|
|
||||||
|
import org.springframework.web.servlet.mvc.method.RequestMappingInfo;
|
||||||
|
import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按照目录结构/包名添加前缀
|
||||||
|
*
|
||||||
|
* @author 1763113879@qq.com
|
||||||
|
* @version V2.1
|
||||||
|
* @since 2.1.0 2023/11/15 14:20
|
||||||
|
*/
|
||||||
|
public class AutoPrefixUrlMapping extends RequestMappingHandlerMapping {
|
||||||
|
|
||||||
|
// 路由映射
|
||||||
|
static Map<String, String> routesMap = new HashMap<String, String>();
|
||||||
|
|
||||||
|
static {
|
||||||
|
// # 认证中心 uri: lb://ruoyi-auth
|
||||||
|
routesMap.put("com.ruoyi.auth.controller", "/auth");
|
||||||
|
// # 代码生成 uri: lb://ruoyi-gen
|
||||||
|
routesMap.put("com.ruoyi.gen.controller", "/code");
|
||||||
|
// # 定时任务 uri: lb://ruoyi-job
|
||||||
|
routesMap.put("com.ruoyi.job.controller", "/schedule");
|
||||||
|
// # 系统模块 uri: lb://ruoyi-system
|
||||||
|
routesMap.put("com.ruoyi.system.controller", "/system");
|
||||||
|
// # 文件服务 uri: lb://ruoyi-file
|
||||||
|
routesMap.put("com.ruoyi.file.controller", "/file");
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重写方法路由获取
|
||||||
|
*
|
||||||
|
* @param method
|
||||||
|
* @param handlerType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
protected RequestMappingInfo getMappingForMethod(Method method, Class<?> handlerType) {
|
||||||
|
RequestMappingInfo mappingInfo = super.getMappingForMethod(method, handlerType);
|
||||||
|
|
||||||
|
if (Objects.nonNull(mappingInfo)) {
|
||||||
|
String prefix = this.getPrefix(handlerType);
|
||||||
|
|
||||||
|
if (prefix != null) {
|
||||||
|
String[] paths = mappingInfo.getPatternValues()
|
||||||
|
.stream()
|
||||||
|
.map(path -> prefix + path)
|
||||||
|
.toArray(String[]::new);
|
||||||
|
|
||||||
|
return mappingInfo.mutate()
|
||||||
|
.paths(paths)
|
||||||
|
.build();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return mappingInfo;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取方法路由前缀
|
||||||
|
*
|
||||||
|
* @param handleType
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private String getPrefix(Class<?> handleType) {
|
||||||
|
String packageName = handleType.getPackage()
|
||||||
|
.getName();
|
||||||
|
// 使用foreach循环遍历HashMap 符合路由规则的添加前缀
|
||||||
|
for (String key : routesMap.keySet()) {
|
||||||
|
if (packageName.startsWith(key)) {
|
||||||
|
return routesMap.get(key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,61 +0,0 @@
|
||||||
# 数据源配置
|
|
||||||
spring:
|
|
||||||
datasource:
|
|
||||||
type: com.alibaba.druid.pool.DruidDataSource
|
|
||||||
driverClassName: com.mysql.cj.jdbc.Driver
|
|
||||||
druid:
|
|
||||||
# 主库数据源
|
|
||||||
master:
|
|
||||||
url: jdbc:mysql://localhost:3306/ry-config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
|
||||||
username: root
|
|
||||||
password: chenroot
|
|
||||||
# 从库数据源
|
|
||||||
slave:
|
|
||||||
# 从数据源开关/默认关闭
|
|
||||||
enabled: false
|
|
||||||
url:
|
|
||||||
username:
|
|
||||||
password:
|
|
||||||
# 初始连接数
|
|
||||||
initialSize: 5
|
|
||||||
# 最小连接池数量
|
|
||||||
minIdle: 10
|
|
||||||
# 最大连接池数量
|
|
||||||
maxActive: 20
|
|
||||||
# 配置获取连接等待超时的时间
|
|
||||||
maxWait: 60000
|
|
||||||
# 配置连接超时时间
|
|
||||||
connectTimeout: 30000
|
|
||||||
# 配置网络超时时间
|
|
||||||
socketTimeout: 60000
|
|
||||||
# 配置间隔多久才进行一次检测,检测需要关闭的空闲连接,单位是毫秒
|
|
||||||
timeBetweenEvictionRunsMillis: 60000
|
|
||||||
# 配置一个连接在池中最小生存的时间,单位是毫秒
|
|
||||||
minEvictableIdleTimeMillis: 300000
|
|
||||||
# 配置一个连接在池中最大生存的时间,单位是毫秒
|
|
||||||
maxEvictableIdleTimeMillis: 900000
|
|
||||||
# 配置检测连接是否有效
|
|
||||||
validationQuery: SELECT 1 FROM DUAL
|
|
||||||
testWhileIdle: true
|
|
||||||
testOnBorrow: false
|
|
||||||
testOnReturn: false
|
|
||||||
webStatFilter:
|
|
||||||
enabled: true
|
|
||||||
statViewServlet:
|
|
||||||
enabled: true
|
|
||||||
# 设置白名单,不填则允许所有访问
|
|
||||||
allow:
|
|
||||||
url-pattern: /druid/*
|
|
||||||
# 控制台管理用户名和密码
|
|
||||||
login-username: ruoyi
|
|
||||||
login-password: 123456
|
|
||||||
filter:
|
|
||||||
stat:
|
|
||||||
enabled: true
|
|
||||||
# 慢SQL记录
|
|
||||||
log-slow-sql: true
|
|
||||||
slow-sql-millis: 1000
|
|
||||||
merge-sql: true
|
|
||||||
wall:
|
|
||||||
config:
|
|
||||||
multi-statement-allow: true
|
|
||||||
|
|
@ -1,7 +1,7 @@
|
||||||
# 项目相关配置
|
# 项目相关配置
|
||||||
ruoyi:
|
ruoyi:
|
||||||
# 名称
|
# 名称
|
||||||
name: RuoYi
|
name: ruoyi-web-admin
|
||||||
# 版本
|
# 版本
|
||||||
version: 3.8.6
|
version: 3.8.6
|
||||||
# 版权年份
|
# 版权年份
|
||||||
|
|
@ -53,8 +53,6 @@ spring:
|
||||||
messages:
|
messages:
|
||||||
# 国际化资源文件路径
|
# 国际化资源文件路径
|
||||||
basename: i18n/messages
|
basename: i18n/messages
|
||||||
profiles:
|
|
||||||
active: druid
|
|
||||||
# 文件上传
|
# 文件上传
|
||||||
servlet:
|
servlet:
|
||||||
multipart:
|
multipart:
|
||||||
|
|
@ -67,6 +65,41 @@ spring:
|
||||||
restart:
|
restart:
|
||||||
# 热部署开关
|
# 热部署开关
|
||||||
enabled: true
|
enabled: true
|
||||||
|
datasource:
|
||||||
|
druid:
|
||||||
|
stat-view-servlet:
|
||||||
|
enabled: true
|
||||||
|
loginUsername: admin
|
||||||
|
loginPassword: 123456
|
||||||
|
dynamic:
|
||||||
|
druid:
|
||||||
|
initial-size: 5
|
||||||
|
min-idle: 5
|
||||||
|
maxActive: 20
|
||||||
|
maxWait: 60000
|
||||||
|
timeBetweenEvictionRunsMillis: 60000
|
||||||
|
minEvictableIdleTimeMillis: 300000
|
||||||
|
validationQuery: SELECT 1 FROM DUAL
|
||||||
|
testWhileIdle: true
|
||||||
|
testOnBorrow: false
|
||||||
|
testOnReturn: false
|
||||||
|
poolPreparedStatements: true
|
||||||
|
maxPoolPreparedStatementPerConnectionSize: 20
|
||||||
|
filters: stat,slf4j
|
||||||
|
connectionProperties: druid.stat.mergeSql\=true;druid.stat.slowSqlMillis\=5000
|
||||||
|
datasource:
|
||||||
|
# 主库数据源
|
||||||
|
master:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://localhost:3306/ry-config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: chenroot
|
||||||
|
# 备库数据源
|
||||||
|
slave:
|
||||||
|
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||||
|
url: jdbc:mysql://localhost:3306/ry-config?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
|
username: root
|
||||||
|
password: chenroot
|
||||||
# redis 配置
|
# redis 配置
|
||||||
redis:
|
redis:
|
||||||
# 地址
|
# 地址
|
||||||
|
|
@ -89,7 +122,7 @@ spring:
|
||||||
max-active: 8
|
max-active: 8
|
||||||
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
# #连接池最大阻塞等待时间(使用负值表示没有限制)
|
||||||
max-wait: -1ms
|
max-wait: -1ms
|
||||||
#禁用nacos,yml文件
|
#禁用nacos,yml文件
|
||||||
cloud:
|
cloud:
|
||||||
nacos:
|
nacos:
|
||||||
config:
|
config:
|
||||||
|
|
@ -99,6 +132,8 @@ spring:
|
||||||
enabled: false
|
enabled: false
|
||||||
instance-enabled: false
|
instance-enabled: false
|
||||||
|
|
||||||
|
main:
|
||||||
|
allow-bean-definition-overriding: true
|
||||||
# token配置
|
# token配置
|
||||||
token:
|
token:
|
||||||
# 令牌自定义标识
|
# 令牌自定义标识
|
||||||
|
|
@ -138,3 +173,47 @@ xss:
|
||||||
excludes: /system/notice
|
excludes: /system/notice
|
||||||
# 匹配链接
|
# 匹配链接
|
||||||
urlPatterns: /system/*,/monitor/*,/tool/*
|
urlPatterns: /system/*,/monitor/*,/tool/*
|
||||||
|
|
||||||
|
|
||||||
|
# 安全配置
|
||||||
|
security:
|
||||||
|
# 验证码
|
||||||
|
captcha:
|
||||||
|
enabled: true
|
||||||
|
type: math
|
||||||
|
# 防止XSS攻击
|
||||||
|
xss:
|
||||||
|
enabled: true
|
||||||
|
excludeUrls:
|
||||||
|
- /system/notice
|
||||||
|
# 不校验白名单
|
||||||
|
ignore:
|
||||||
|
whites:
|
||||||
|
- /auth/logout
|
||||||
|
- /auth/login
|
||||||
|
- /auth/register
|
||||||
|
- /*/v2/api-docs
|
||||||
|
- /csrf
|
||||||
|
|
||||||
|
##################### 文件模块 ###########################################
|
||||||
|
# 本地文件上传
|
||||||
|
file:
|
||||||
|
domain: http://127.0.0.1:9300
|
||||||
|
path: ruoyi/uploadPath
|
||||||
|
prefix: /statics
|
||||||
|
|
||||||
|
# FastDFS配置
|
||||||
|
fdfs:
|
||||||
|
domain: http://8.129.231.12
|
||||||
|
soTimeout: 3000
|
||||||
|
connectTimeout: 2000
|
||||||
|
trackerList: 8.129.231.12:22122
|
||||||
|
|
||||||
|
# Minio配置
|
||||||
|
minio:
|
||||||
|
url: http://8.129.231.12:9000
|
||||||
|
accessKey: minioadmin
|
||||||
|
secretKey: minioadmin
|
||||||
|
bucketName: test
|
||||||
|
|
||||||
|
######################## 文件模块 ########################################
|
||||||
|
|
@ -0,0 +1,79 @@
|
||||||
|
# Tomcat
|
||||||
|
server:
|
||||||
|
port: 8080
|
||||||
|
|
||||||
|
# Spring
|
||||||
|
spring:
|
||||||
|
application:
|
||||||
|
# 应用名称
|
||||||
|
name: ruoyi-web-admin
|
||||||
|
profiles:
|
||||||
|
# 环境配置
|
||||||
|
active: local
|
||||||
|
|
||||||
|
# Spring Web 公共配置
|
||||||
|
autoconfigure:
|
||||||
|
exclude: com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure
|
||||||
|
mvc:
|
||||||
|
pathmatch:
|
||||||
|
matching-strategy: ant_path_matcher
|
||||||
|
cloud:
|
||||||
|
gateway:
|
||||||
|
discovery:
|
||||||
|
locator:
|
||||||
|
lowerCaseServiceId: true
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# feign 配置
|
||||||
|
feign:
|
||||||
|
sentinel:
|
||||||
|
enabled: true
|
||||||
|
okhttp:
|
||||||
|
enabled: true
|
||||||
|
httpclient:
|
||||||
|
enabled: false
|
||||||
|
client:
|
||||||
|
config:
|
||||||
|
default:
|
||||||
|
connectTimeout: 10000
|
||||||
|
readTimeout: 10000
|
||||||
|
compression:
|
||||||
|
request:
|
||||||
|
enabled: true
|
||||||
|
response:
|
||||||
|
enabled: true
|
||||||
|
|
||||||
|
# 暴露监控端点
|
||||||
|
management:
|
||||||
|
endpoints:
|
||||||
|
web:
|
||||||
|
exposure:
|
||||||
|
include: '*'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# 安全配置
|
||||||
|
security:
|
||||||
|
# 验证码
|
||||||
|
captcha:
|
||||||
|
enabled: true
|
||||||
|
type: math
|
||||||
|
# 防止XSS攻击
|
||||||
|
xss:
|
||||||
|
enabled: true
|
||||||
|
excludeUrls:
|
||||||
|
- /system/notice
|
||||||
|
# 不校验白名单
|
||||||
|
ignore:
|
||||||
|
whites:
|
||||||
|
- /auth/logout
|
||||||
|
- /auth/login
|
||||||
|
- /auth/register
|
||||||
|
- /*/v2/api-docs
|
||||||
|
- /csrf
|
||||||
|
|
||||||
|
# swagger配置
|
||||||
|
swagger:
|
||||||
|
title: 系统模块接口文档
|
||||||
|
license: Powered By ruoyi
|
||||||
|
licenseUrl: https://ruoyi.vip
|
||||||
|
|
@ -67,7 +67,7 @@
|
||||||
</root>
|
</root>
|
||||||
|
|
||||||
<!--系统操作日志-->
|
<!--系统操作日志-->
|
||||||
<root level="info">
|
<root level="DEBUG">
|
||||||
<appender-ref ref="file_info" />
|
<appender-ref ref="file_info" />
|
||||||
<appender-ref ref="file_error" />
|
<appender-ref ref="file_error" />
|
||||||
</root>
|
</root>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue