mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 02:25:56 +08:00
* add dbu
This commit is contained in:
parent
f8c079c651
commit
3812e4a402
7
pom.xml
7
pom.xml
@ -327,6 +327,13 @@
|
|||||||
<artifactId>ruoyi-demo</artifactId>
|
<artifactId>ruoyi-demo</artifactId>
|
||||||
<version>${ruoyi-vue-plus.version}</version>
|
<version>${ruoyi-vue-plus.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
|
<!-- demodbu -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<artifactId>ruoyi-dbu</artifactId>
|
||||||
|
<version>${ruoyi-vue-plus.version}</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
</dependencies>
|
</dependencies>
|
||||||
</dependencyManagement>
|
</dependencyManagement>
|
||||||
|
|||||||
42
ruoyi-dbu/pom.xml
Normal file
42
ruoyi-dbu/pom.xml
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<parent>
|
||||||
|
<artifactId>ruoyi-vue-plus</artifactId>
|
||||||
|
<groupId>com.ruoyi</groupId>
|
||||||
|
<version>4.5.0</version>
|
||||||
|
</parent>
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
|
||||||
|
<artifactId>ruoyi-dbu</artifactId>
|
||||||
|
|
||||||
|
<description>
|
||||||
|
dbu模块
|
||||||
|
</description>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.liquibase</groupId>
|
||||||
|
<artifactId>liquibase-core</artifactId>
|
||||||
|
<version>4.19.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.mysql</groupId>
|
||||||
|
<artifactId>mysql-connector-j</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-aop</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
|
||||||
|
</project>
|
||||||
22
ruoyi-dbu/src/main/java/com/ruoyi/dbu/DbuApplication.java
Normal file
22
ruoyi-dbu/src/main/java/com/ruoyi/dbu/DbuApplication.java
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package com.ruoyi.dbu;
|
||||||
|
|
||||||
|
import org.springframework.boot.SpringApplication;
|
||||||
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
import org.springframework.boot.context.metrics.buffering.BufferingApplicationStartup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动程序
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
*/
|
||||||
|
|
||||||
|
@SpringBootApplication
|
||||||
|
public class DbuApplication {
|
||||||
|
|
||||||
|
public static void main(String[] args) {
|
||||||
|
SpringApplication application = new SpringApplication(DbuApplication.class);
|
||||||
|
application.setApplicationStartup(new BufferingApplicationStartup(2048));
|
||||||
|
application.run(args);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package com.ruoyi.dbu.config;
|
||||||
|
|
||||||
|
import liquibase.integration.spring.SpringLiquibase;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
|
||||||
|
import javax.sql.DataSource;
|
||||||
|
|
||||||
|
@Configuration
|
||||||
|
public class LiquibaseConfig
|
||||||
|
{
|
||||||
|
@Value("${update.module:}")
|
||||||
|
private String module;
|
||||||
|
|
||||||
|
@Value("${liquibase.schema:}")
|
||||||
|
private String liquibaseSchema;
|
||||||
|
|
||||||
|
@Bean
|
||||||
|
public SpringLiquibase liquibase(DataSource dataSource)
|
||||||
|
throws Exception
|
||||||
|
{
|
||||||
|
if (StringUtils.isEmpty(module) || module.equals("''"))
|
||||||
|
{
|
||||||
|
throw new Exception("请配置--update.module=oms/wms/admin(只可配置一个),选择需要更新的数据库");
|
||||||
|
}
|
||||||
|
|
||||||
|
SpringLiquibase liquibase = new SpringLiquibase();
|
||||||
|
liquibase.setDataSource(dataSource);
|
||||||
|
liquibase.setChangeLog("classpath:" + module + "/master.xml");
|
||||||
|
liquibase.setContexts("development,test,production");
|
||||||
|
liquibase.setShouldRun(true);
|
||||||
|
liquibase.setDatabaseChangeLogTable("ds_changelog");
|
||||||
|
liquibase.setDatabaseChangeLogLockTable("ds_changelog_lock");
|
||||||
|
// liquibase.setDefaultSchema(null);
|
||||||
|
if (!StringUtils.isEmpty(liquibaseSchema))
|
||||||
|
{
|
||||||
|
liquibase.setLiquibaseSchema(liquibaseSchema);
|
||||||
|
}
|
||||||
|
|
||||||
|
return liquibase;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
33
ruoyi-dbu/src/resources/application.properties
Normal file
33
ruoyi-dbu/src/resources/application.properties
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
server.port = 9199
|
||||||
|
|
||||||
|
update.module=${UPDATE_MODULE:default}
|
||||||
|
|
||||||
|
liquibase.schema=${UPDATE_SCHEMA:ry-vue}
|
||||||
|
|
||||||
|
spring.datasource.name=${DATASOURCE_NAME:ry-vue}
|
||||||
|
|
||||||
|
spring.datasource.url=${DATASOURCE_URL:jdbc:mysql://${MYSQL_HOST:localhost}:${MYSQL_PORT:3306}/${MYSQL_DATASOURCE:ry-vue}?useUnicode=true&characterEncoding=UTF8}
|
||||||
|
|
||||||
|
spring.datasource.username=${MYSQL_USER:root}
|
||||||
|
|
||||||
|
spring.datasource.password=${MYSQL_PASSWORD:root}
|
||||||
|
|
||||||
|
spring.datasource.driver-class-name=com.mysql.cj.jdbc.Driver
|
||||||
|
|
||||||
|
spring.datasource.type=com.zaxxer.hikari.HikariDataSource
|
||||||
|
|
||||||
|
spring.datasource.hikari.minimum-idle=2
|
||||||
|
|
||||||
|
spring.datasource.hikari.maximum-pool-size=20
|
||||||
|
|
||||||
|
spring.datasource.hikari.auto-commit=true
|
||||||
|
|
||||||
|
spring.datasource.hikari.idle-timeout=30000
|
||||||
|
|
||||||
|
spring.datasource.hikari.pool-name=DatebookHikariCP
|
||||||
|
|
||||||
|
spring.datasource.hikari.max-lifetime=1800000
|
||||||
|
|
||||||
|
spring.datasource.hikari.connection-timeout=30000
|
||||||
|
|
||||||
|
spring.datasource.hikari.connection-test-query=SELECT 1
|
||||||
13
ruoyi-dbu/src/resources/default/changelog/3.2.4.xml
Normal file
13
ruoyi-dbu/src/resources/default/changelog/3.2.4.xml
Normal file
@ -0,0 +1,13 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<databaseChangeLog
|
||||||
|
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd">
|
||||||
|
|
||||||
|
<!-- <changeSet id="3.2.4.1" author="pxj">-->
|
||||||
|
<!-- <sql>-->
|
||||||
|
<!-- select 1-->
|
||||||
|
<!-- </sql>-->
|
||||||
|
<!-- </changeSet>-->
|
||||||
|
|
||||||
|
</databaseChangeLog>
|
||||||
9
ruoyi-dbu/src/resources/default/master.xml
Normal file
9
ruoyi-dbu/src/resources/default/master.xml
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<databaseChangeLog
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xmlns="http://www.liquibase.org/xml/ns/dbchangelog"
|
||||||
|
xsi:schemaLocation="http://www.liquibase.org/xml/ns/dbchangelog http://www.liquibase.org/xml/ns/dbchangelog/dbchangelog-3.9.xsd">
|
||||||
|
|
||||||
|
<!-- <include file="classpath:oms/changelog/3.2.3_all.sql" relativeToChangelogFile="false"/>-->
|
||||||
|
<include file="default/changelog/3.2.4.xml" />
|
||||||
|
</databaseChangeLog>
|
||||||
Loading…
Reference in New Issue
Block a user