Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
工
工位预约
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiatao
工位预约
Commits
cb79e7eb
Commit
cb79e7eb
authored
Oct 31, 2025
by
jiatao
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
提交初始化配置
parent
075e9646
Pipeline
#26
failed with stages
Changes
8
Pipelines
1
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
320 additions
and
291 deletions
+320
-291
README.md
README.md
+0
-95
pom.xml
pom.xml
+37
-0
application-dev.yml
ruoyi-admin/src/main/resources/application-dev.yml
+101
-0
application-prod.yml
ruoyi-admin/src/main/resources/application-prod.yml
+102
-61
application.yml
ruoyi-admin/src/main/resources/application.yml
+11
-3
pom.xml
ruoyi-common/pom.xml
+7
-0
MyBatisConfig.java
...c/main/java/com/ruoyi/framework/config/MyBatisConfig.java
+0
-132
MybatisPlusConfig.java
...in/java/com/ruoyi/framework/config/MybatisPlusConfig.java
+62
-0
No files found.
README.md
View file @
cb79e7eb
This diff is collapsed.
Click to expand it.
pom.xml
View file @
cb79e7eb
...
...
@@ -231,6 +231,28 @@
</modules>
<packaging>
pom
</packaging>
<!--环境选择-->
<profiles>
<profile>
<!-- 本地环境 -->
<id>
dev
</id>
<properties>
<spring.active>
dev
</spring.active>
</properties>
<activation>
<!-- 设置默认激活这个配置 -->
<activeByDefault>
true
</activeByDefault>
</activation>
</profile>
<profile>
<!-- prod -->
<id>
prod
</id>
<properties>
<spring.active>
prod
</spring.active>
</properties>
</profile>
</profiles>
<build>
<plugins>
<plugin>
...
...
@@ -244,6 +266,21 @@
</configuration>
</plugin>
</plugins>
<resources>
<resource>
<directory>
src/main/resources
</directory>
<filtering>
true
</filtering>
</resource>
<resource>
<directory>
src/main/java
</directory>
<includes>
<include>
**/*.xml
</include>
<include>
**/*.json
</include>
<include>
**/*.ftl
</include>
</includes>
</resource>
</resources>
</build>
<repositories>
...
...
ruoyi-admin/src/main/resources/application-dev.yml
0 → 100644
View file @
cb79e7eb
# 数据源配置
ruoyi
:
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile
:
D:/code/rs-service/rs/uploadPath
spring
:
# redis 配置
redis
:
# 地址
host
:
localhost
# 端口,默认为6379
port
:
6379
# 数据库索引
database
:
0
# 密码
password
:
# 连接超时时间
timeout
:
10s
lettuce
:
pool
:
# 连接池中的最小空闲连接
min-idle
:
0
# 连接池中的最大空闲连接
max-idle
:
8
# 连接池的最大数据库连接数
max-active
:
8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait
:
-1ms
datasource
:
type
:
com.alibaba.druid.pool.DruidDataSource
driverClassName
:
com.mysql.cj.jdbc.Driver
druid
:
# 主库数据源
master
:
url
:
jdbc:mysql://192.168.1.7:3306/rs_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
123456
# 从库数据源
slave
:
# 从数据源开关/默认关闭
url
:
jdbc:mysql://192.168.1.7:3306/lms_laboratory?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
123456
# 初始连接数
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
#mybatis-plus 插件
mybatis-plus
:
#configuration:
# 打印SQL 开发测试使用 生产关闭 ***
log-impl
:
org.apache.ibatis.logging.stdout.StdOutImpl
# Swagger配置
swagger
:
# 是否开启swagger
enabled
:
true
# 请求前缀
pathMapping
:
/prod-api
\ No newline at end of file
ruoyi-admin/src/main/resources/application-
drui
d.yml
→
ruoyi-admin/src/main/resources/application-
pro
d.yml
View file @
cb79e7eb
# 数据源配置
spring
:
datasource
:
type
:
com.alibaba.druid.pool.DruidDataSource
driverClassName
:
com.mysql.cj.jdbc.Driver
druid
:
# 主库数据源
master
:
url
:
jdbc:mysql://localhost:3306/ry-vue?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username
:
root
password
:
password
# 从库数据源
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
\ No newline at end of file
# 数据源配置
ruoyi
:
# 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /home/ruoyi/uploadPath)
profile
:
${UPLOAD_PATH}
spring
:
# redis 配置
redis
:
# 地址
host
:
${REDIS_HOST:localhost}
# 端口,默认为6379
port
:
${REDIS_PORT:6379}
# 数据库索引
database
:
0
# 密码
password
:
${REDIS_PASSWORD:}
# 连接超时时间
timeout
:
10s
lettuce
:
pool
:
# 连接池中的最小空闲连接
min-idle
:
0
# 连接池中的最大空闲连接
max-idle
:
8
# 连接池的最大数据库连接数
max-active
:
8
# #连接池最大阻塞等待时间(使用负值表示没有限制)
max-wait
:
-1ms
datasource
:
type
:
com.alibaba.druid.pool.DruidDataSource
driverClassName
:
com.mysql.cj.jdbc.Driver
druid
:
# 主库数据源
master
:
url
:
${SPRING_DATASOURCE_URL}
username
:
${SPRING_DATASOURCE_USERNAME}
password
:
${SPRING_DATASOURCE_PASSWORD}
# 从库数据源
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
#mybatis-plus 插件
mybatis-plus
:
#configuration:
# 打印SQL 开发测试使用 生产关闭 ***
#log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
# Swagger配置
swagger
:
# 是否开启swagger
enabled
:
true
# 请求前缀
pathMapping
:
/prod-api
\ No newline at end of file
ruoyi-admin/src/main/resources/application.yml
View file @
cb79e7eb
...
...
@@ -52,7 +52,7 @@ spring:
# 国际化资源文件路径
basename
:
i18n/messages
profiles
:
active
:
druid
active
:
"
@spring.active@"
# 文件上传
servlet
:
multipart
:
...
...
@@ -97,8 +97,8 @@ token:
# 令牌有效期(默认30分钟)
expireTime
:
30
# MyBatis配置
mybatis
:
# MyBatis
Plus
配置
mybatis
-plus
:
# 搜索指定包别名
typeAliasesPackage
:
com.ruoyi.**.domain
# 配置mapper的扫描,找到所有的mapper.xml映射文件
...
...
@@ -106,6 +106,14 @@ mybatis:
# 加载全局的配置文件
configLocation
:
classpath:mybatis/mybatis-config.xml
global-config
:
db-config
:
logic-delete-field
:
delFlag
# 全局逻辑删除字段名(deleted为实体类属性名称)
logic-delete-value
:
1
# 逻辑已删除值。可选,默认值为 1
logic-not-delete-value
:
2
# 逻辑未删除值。可选,默认值为 0
# 关闭Banner
banner
:
false
# PageHelper分页插件
pagehelper
:
helperDialect
:
mysql
...
...
ruoyi-common/pom.xml
View file @
cb79e7eb
...
...
@@ -119,6 +119,13 @@
<artifactId>
javax.servlet-api
</artifactId>
</dependency>
<!-- ruoyi-springboot2 / mybatis-plus 配置 -->
<dependency>
<groupId>
com.baomidou
</groupId>
<artifactId>
mybatis-plus-boot-starter
</artifactId>
<version>
3.5.1
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MyBatisConfig.java
deleted
100644 → 0
View file @
075e9646
package
com
.
ruoyi
.
framework
.
config
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.Arrays
;
import
java.util.HashSet
;
import
java.util.List
;
import
javax.sql.DataSource
;
import
org.apache.ibatis.io.VFS
;
import
org.apache.ibatis.session.SqlSessionFactory
;
import
org.mybatis.spring.SqlSessionFactoryBean
;
import
org.mybatis.spring.boot.autoconfigure.SpringBootVFS
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.core.env.Environment
;
import
org.springframework.core.io.DefaultResourceLoader
;
import
org.springframework.core.io.Resource
;
import
org.springframework.core.io.support.PathMatchingResourcePatternResolver
;
import
org.springframework.core.io.support.ResourcePatternResolver
;
import
org.springframework.core.type.classreading.CachingMetadataReaderFactory
;
import
org.springframework.core.type.classreading.MetadataReader
;
import
org.springframework.core.type.classreading.MetadataReaderFactory
;
import
org.springframework.util.ClassUtils
;
import
com.ruoyi.common.utils.StringUtils
;
/**
* Mybatis支持*匹配扫描包
*
* @author ruoyi
*/
@Configuration
public
class
MyBatisConfig
{
@Autowired
private
Environment
env
;
static
final
String
DEFAULT_RESOURCE_PATTERN
=
"**/*.class"
;
public
static
String
setTypeAliasesPackage
(
String
typeAliasesPackage
)
{
ResourcePatternResolver
resolver
=
(
ResourcePatternResolver
)
new
PathMatchingResourcePatternResolver
();
MetadataReaderFactory
metadataReaderFactory
=
new
CachingMetadataReaderFactory
(
resolver
);
List
<
String
>
allResult
=
new
ArrayList
<
String
>();
try
{
for
(
String
aliasesPackage
:
typeAliasesPackage
.
split
(
","
))
{
List
<
String
>
result
=
new
ArrayList
<
String
>();
aliasesPackage
=
ResourcePatternResolver
.
CLASSPATH_ALL_URL_PREFIX
+
ClassUtils
.
convertClassNameToResourcePath
(
aliasesPackage
.
trim
())
+
"/"
+
DEFAULT_RESOURCE_PATTERN
;
Resource
[]
resources
=
resolver
.
getResources
(
aliasesPackage
);
if
(
resources
!=
null
&&
resources
.
length
>
0
)
{
MetadataReader
metadataReader
=
null
;
for
(
Resource
resource
:
resources
)
{
if
(
resource
.
isReadable
())
{
metadataReader
=
metadataReaderFactory
.
getMetadataReader
(
resource
);
try
{
result
.
add
(
Class
.
forName
(
metadataReader
.
getClassMetadata
().
getClassName
()).
getPackage
().
getName
());
}
catch
(
ClassNotFoundException
e
)
{
e
.
printStackTrace
();
}
}
}
}
if
(
result
.
size
()
>
0
)
{
HashSet
<
String
>
hashResult
=
new
HashSet
<
String
>(
result
);
allResult
.
addAll
(
hashResult
);
}
}
if
(
allResult
.
size
()
>
0
)
{
typeAliasesPackage
=
String
.
join
(
","
,
(
String
[])
allResult
.
toArray
(
new
String
[
0
]));
}
else
{
throw
new
RuntimeException
(
"mybatis typeAliasesPackage 路径扫描错误,参数typeAliasesPackage:"
+
typeAliasesPackage
+
"未找到任何包"
);
}
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
return
typeAliasesPackage
;
}
public
Resource
[]
resolveMapperLocations
(
String
[]
mapperLocations
)
{
ResourcePatternResolver
resourceResolver
=
new
PathMatchingResourcePatternResolver
();
List
<
Resource
>
resources
=
new
ArrayList
<
Resource
>();
if
(
mapperLocations
!=
null
)
{
for
(
String
mapperLocation
:
mapperLocations
)
{
try
{
Resource
[]
mappers
=
resourceResolver
.
getResources
(
mapperLocation
);
resources
.
addAll
(
Arrays
.
asList
(
mappers
));
}
catch
(
IOException
e
)
{
// ignore
}
}
}
return
resources
.
toArray
(
new
Resource
[
resources
.
size
()]);
}
@Bean
public
SqlSessionFactory
sqlSessionFactory
(
DataSource
dataSource
)
throws
Exception
{
String
typeAliasesPackage
=
env
.
getProperty
(
"mybatis.typeAliasesPackage"
);
String
mapperLocations
=
env
.
getProperty
(
"mybatis.mapperLocations"
);
String
configLocation
=
env
.
getProperty
(
"mybatis.configLocation"
);
typeAliasesPackage
=
setTypeAliasesPackage
(
typeAliasesPackage
);
VFS
.
addImplClass
(
SpringBootVFS
.
class
);
final
SqlSessionFactoryBean
sessionFactory
=
new
SqlSessionFactoryBean
();
sessionFactory
.
setDataSource
(
dataSource
);
sessionFactory
.
setTypeAliasesPackage
(
typeAliasesPackage
);
sessionFactory
.
setMapperLocations
(
resolveMapperLocations
(
StringUtils
.
split
(
mapperLocations
,
","
)));
sessionFactory
.
setConfigLocation
(
new
DefaultResourceLoader
().
getResource
(
configLocation
));
return
sessionFactory
.
getObject
();
}
}
\ No newline at end of file
ruoyi-framework/src/main/java/com/ruoyi/framework/config/MybatisPlusConfig.java
0 → 100644
View file @
cb79e7eb
package
com
.
ruoyi
.
framework
.
config
;
import
com.baomidou.mybatisplus.annotation.DbType
;
import
com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.BlockAttackInnerInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor
;
import
com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.transaction.annotation.EnableTransactionManagement
;
/**
* Mybatis Plus 配置
*
* @author ruoyi
*/
@EnableTransactionManagement
(
proxyTargetClass
=
true
)
@Configuration
public
class
MybatisPlusConfig
{
@Bean
public
MybatisPlusInterceptor
mybatisPlusInterceptor
()
{
MybatisPlusInterceptor
interceptor
=
new
MybatisPlusInterceptor
();
// 分页插件
interceptor
.
addInnerInterceptor
(
paginationInnerInterceptor
());
// 乐观锁插件
interceptor
.
addInnerInterceptor
(
optimisticLockerInnerInterceptor
());
// 阻断插件
interceptor
.
addInnerInterceptor
(
blockAttackInnerInterceptor
());
return
interceptor
;
}
/**
* 分页插件,自动识别数据库类型 https://baomidou.com/guide/interceptor-pagination.html
*/
public
PaginationInnerInterceptor
paginationInnerInterceptor
()
{
PaginationInnerInterceptor
paginationInnerInterceptor
=
new
PaginationInnerInterceptor
();
// 设置数据库类型为mysql
paginationInnerInterceptor
.
setDbType
(
DbType
.
MYSQL
);
// 设置最大单页限制数量,默认 500 条,-1 不受限制
paginationInnerInterceptor
.
setMaxLimit
(-
1L
);
return
paginationInnerInterceptor
;
}
/**
* 乐观锁插件 https://baomidou.com/guide/interceptor-optimistic-locker.html
*/
public
OptimisticLockerInnerInterceptor
optimisticLockerInnerInterceptor
()
{
return
new
OptimisticLockerInnerInterceptor
();
}
/**
* 如果是对全表的删除或更新操作,就会终止该操作 https://baomidou.com/guide/interceptor-block-attack.html
*/
public
BlockAttackInnerInterceptor
blockAttackInnerInterceptor
()
{
return
new
BlockAttackInnerInterceptor
();
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment