mirror of
http://git.pig4cloud.com/pig/pigx.git
synced 2026-11-11 21:29:02 +08:00
增加动态多数据源示例项目
This commit is contained in:
1 parent
c7475f88ce
commit
0c493bad14
13 files changed
+683
No files matched your search
@@ -0,0 +1,91 @@
|
||||
## 快速入门
|
||||
### 创建测试数据库
|
||||
```
|
||||
create database `test1` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `test2` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
create database `test3` default character set utf8mb4 collate utf8mb4_general_ci;
|
||||
```
|
||||
### 创建测试表
|
||||
```
|
||||
CREATE TABLE `user` (
|
||||
`id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT 'id',
|
||||
`username` varchar(255) DEFAULT NULL COMMENT '用户名',
|
||||
`password` varchar(255) DEFAULT NULL COMMENT '密码',
|
||||
PRIMARY KEY (`id`) USING BTREE
|
||||
) ENGINE=InnoDB AUTO_INCREMENT=40 DEFAULT CHARSET=utf8mb4 COMMENT='用户测试表';
|
||||
```
|
||||
### 插入测试数据
|
||||
```
|
||||
use test1;
|
||||
BEGIN;
|
||||
INSERT INTO `user` VALUES (1, 'test1测试一', '123');
|
||||
INSERT INTO `user` VALUES (2, 'test1测试二', '123');
|
||||
INSERT INTO `user` VALUES (3, 'test1测试三', '123');
|
||||
COMMIT;
|
||||
use test2;
|
||||
BEGIN;
|
||||
INSERT INTO `user` VALUES (1, 'test2测试一', '123');
|
||||
INSERT INTO `user` VALUES (2, 'test2测试二', '123');
|
||||
INSERT INTO `user` VALUES (3, 'test2测试三', '123');
|
||||
COMMIT;
|
||||
use test3;
|
||||
BEGIN;
|
||||
INSERT INTO `user` VALUES (1, 'test3测试一', '123');
|
||||
INSERT INTO `user` VALUES (2, 'test3测试二', '123');
|
||||
INSERT INTO `user` VALUES (3, 'test3测试三', '123');
|
||||
COMMIT;
|
||||
```
|
||||
### Nocas新增配置
|
||||
```
|
||||
## pigx-dynamic-datasource-biz.yml
|
||||
## spring security 配置
|
||||
security:
|
||||
oauth2:
|
||||
client:
|
||||
client-id: ENC(ltJPpR50wT0oIY9kfOe1Iw==)
|
||||
client-secret: ENC(ltJPpR50wT0oIY9kfOe1Iw==)
|
||||
scope: server
|
||||
|
||||
# 数据源
|
||||
spring:
|
||||
datasource:
|
||||
dynamic:
|
||||
primary: test1 #设置默认的数据源
|
||||
druid:
|
||||
filters: stat
|
||||
datasource:
|
||||
test1:
|
||||
username: ${MYSQL-USER:root}
|
||||
password: ${MYSQL-USER:root}
|
||||
url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/test1?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
test2:
|
||||
username: ${MYSQL-USER:root}
|
||||
password: ${MYSQL-USER:root}
|
||||
url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/test2?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
test3:
|
||||
username: ${MYSQL-USER:root}
|
||||
password: ${MYSQL-USER:root}
|
||||
url: jdbc:mysql://${MYSQL-HOST:pigx-mysql}:${MYSQL-PORT:3306}/test3?characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=false&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&serverTimezone=GMT%2B8&allowMultiQueries=true&allowPublicKeyRetrieval=true
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
```
|
||||
### 启动以下应用
|
||||
+ PigxNacosApplication
|
||||
+ PigxSentinelApplication
|
||||
+ PigxAuthApplication
|
||||
+ PigxAdminApplication
|
||||
+ PigxGatewayApplication
|
||||
+ PigxDynamicDatasourceApplication
|
||||
### Postman看效果
|
||||
```
|
||||
http://localhost:6060/test/getTest1
|
||||
http://localhost:6060/test/getTest2?current=1&size=5
|
||||
http://localhost:6060/test/getTest3?current=1&size=5
|
||||
```
|
||||

|
||||

|
||||

|
||||
|
||||
### 联系我
|
||||
QQ:55215085
|
||||
@@ -0,0 +1,27 @@
|
||||
<?xml version="1.0"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-dynamic-datasource</artifactId>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-dynamic-datasource-api</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!--core 工具类-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-core</artifactId>
|
||||
</dependency>
|
||||
<!--mybatis plus extension,包含了mybatis plus core-->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-extension</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
/*
|
||||
@author pigx archetype
|
||||
* <p>
|
||||
* feign client 存放目录,注意 @EnablePigxFeignClients 的扫描范围
|
||||
*/
|
||||
package com.pig4cloud.pigx.dynamic.feign;
|
||||
@@ -0,0 +1,99 @@
|
||||
<?xml version="1.0"?>
|
||||
<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">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-dynamic-datasource</artifactId>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>pigx-dynamic-datasource-biz</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<!--必备: undertow容器-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||
</dependency>
|
||||
<!--必备: spring boot web-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 注册中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 配置中心客户端-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 操作数据源相关-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-data</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<artifactId>druid-spring-boot-starter</artifactId>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<version>1.1.20</version>
|
||||
</dependency>
|
||||
<!-- 动态数据源 数据操作 -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>dynamic-datasource-spring-boot-starter</artifactId>
|
||||
<version>2.5.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-log</artifactId>
|
||||
</dependency>
|
||||
<!--必备:pigx安全模块-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-security</artifactId>
|
||||
</dependency>
|
||||
<!--必备: sentinel 依赖-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-sentinel</artifactId>
|
||||
</dependency>
|
||||
<!--必备: 依赖api模块-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-dynamic-datasource-api</artifactId>
|
||||
<version>3.5.0</version>
|
||||
</dependency>
|
||||
<!--选配: swagger文档-->
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-swagger</artifactId>
|
||||
</dependency>
|
||||
<!--测试: spring boot test-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
+25
@@ -0,0 +1,25 @@
|
||||
package com.pig4cloud.pigx.dynamic;
|
||||
|
||||
import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure;
|
||||
import com.pig4cloud.pigx.common.security.annotation.EnablePigxFeignClients;
|
||||
import com.pig4cloud.pigx.common.security.annotation.EnablePigxResourceServer;
|
||||
import com.pig4cloud.pigx.common.swagger.annotation.EnablePigxSwagger2;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.cloud.client.SpringCloudApplication;
|
||||
|
||||
/**
|
||||
* @author pigx archetype
|
||||
* <p>
|
||||
* 项目启动类
|
||||
*/
|
||||
@EnablePigxSwagger2
|
||||
@SpringCloudApplication
|
||||
@EnablePigxFeignClients
|
||||
@EnablePigxResourceServer
|
||||
@EnableAutoConfiguration(exclude={DruidDataSourceAutoConfigure.class})
|
||||
public class PigxDynamicDatasourceApplication {
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(PigxDynamicDatasourceApplication.class, args);
|
||||
}
|
||||
}
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.dynamic.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.pig4cloud.pigx.common.core.util.R;
|
||||
import com.pig4cloud.pigx.common.log.annotation.SysLog;
|
||||
import com.pig4cloud.pigx.dynamic.mapper.TestMapper;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author liuyes
|
||||
* @date 2019/11/19
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/test")
|
||||
@Api(value = "test", tags = "动态多数据源示例模块")
|
||||
public class TestController {
|
||||
|
||||
private TestMapper testMapper;
|
||||
|
||||
/**
|
||||
* 获取test1数据库用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@ApiOperation(value = "查询test1数据库用户信息", notes = "查询test1数据库用户信息")
|
||||
@SysLog("查询test1数据库用户信息" )
|
||||
@PostMapping("/getTest1")
|
||||
public R getTest1() {
|
||||
List<Map<String, Object>> list = testMapper.getTest1();
|
||||
if (list == null) {
|
||||
return R.failed(null, "查询失败!");
|
||||
}
|
||||
return R.ok(list,"操作成功!");
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取test2数据库用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@ApiOperation(value = "查询test2数据库用户信息", notes = "查询test2数据库用户信息")
|
||||
@SysLog("查询test2数据库用户信息" )
|
||||
@PostMapping("/getTest2")
|
||||
public R getTest2(Page page) {
|
||||
IPage<List<Map<String, Object>>> list = testMapper.getTest2(page);
|
||||
if (list == null) {
|
||||
return R.failed(null, "查询失败!");
|
||||
}
|
||||
return R.ok(list,"操作成功!");
|
||||
}
|
||||
/**
|
||||
* 获取test3数据库用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@ApiOperation(value = "查询test3数据库用户信息", notes = "查询test3数据库用户信息")
|
||||
@SysLog("查询test3数据库用户信息" )
|
||||
@PostMapping("/getTest3")
|
||||
public R getTest3(Page page) {
|
||||
IPage<List<Map<String, Object>>> list = testMapper.getTest3(page);
|
||||
if (list == null) {
|
||||
return R.failed(null, "查询失败!");
|
||||
}
|
||||
return R.ok(list,"操作成功!");
|
||||
}
|
||||
|
||||
}
|
||||
+50
@@ -0,0 +1,50 @@
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 2018-2025, lengleng All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are met:
|
||||
*
|
||||
* Redistributions of source code must retain the above copyright notice,
|
||||
* this list of conditions and the following disclaimer.
|
||||
* Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
* Neither the name of the pig4cloud.com developer nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
* Author: lengleng (wangiegie@gmail.com)
|
||||
*
|
||||
*/
|
||||
|
||||
package com.pig4cloud.pigx.dynamic.mapper;
|
||||
|
||||
import com.baomidou.dynamic.datasource.annotation.DS;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* test Mapper 接口
|
||||
* </p>
|
||||
*
|
||||
* @author liuyes
|
||||
* @date 2019/11/19
|
||||
*/
|
||||
public interface TestMapper {
|
||||
|
||||
@Select("SELECT * FROM user")
|
||||
@DS("test1")
|
||||
List<Map<String, Object>> getTest1();
|
||||
|
||||
@DS("test2")
|
||||
IPage<List<Map<String, Object>>> getTest2(Page page);
|
||||
|
||||
@DS("test3")
|
||||
IPage<List<Map<String, Object>>> getTest3(Page page);
|
||||
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
package com.pig4cloud.pigx.dynamic.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class UserVO {
|
||||
private Integer id;
|
||||
private String username;
|
||||
private String password;
|
||||
}
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
server:
|
||||
port: 6060
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: @artifactId@
|
||||
cloud:
|
||||
nacos:
|
||||
discovery:
|
||||
server-addr: ${NACOS-HOST:pigx-register}:${NACOS-PORT:8848}
|
||||
config:
|
||||
server-addr: ${spring.cloud.nacos.discovery.server-addr}
|
||||
file-extension: yml
|
||||
shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
profiles:
|
||||
active: dev
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!--
|
||||
小技巧: 在根pom里面设置统一存放路径,统一管理方便维护
|
||||
<properties>
|
||||
<log-path>/Users/lengleng</log-path>
|
||||
</properties>
|
||||
1. 其他模块加日志输出,直接copy本文件放在resources 目录即可
|
||||
2. 注意修改 <property name="${log-path}/log.path" value=""/> 的value模块
|
||||
-->
|
||||
<configuration debug="false" scan="false">
|
||||
<property name="log.path" value="logs/${project.artifactId}"/>
|
||||
<!-- 彩色日志格式 -->
|
||||
<property name="CONSOLE_LOG_PATTERN"
|
||||
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
|
||||
<!-- 彩色日志依赖的渲染类 -->
|
||||
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter"/>
|
||||
<conversionRule conversionWord="wex"
|
||||
converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter"/>
|
||||
<conversionRule conversionWord="wEx"
|
||||
converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter"/>
|
||||
<!-- Console log output -->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${CONSOLE_LOG_PATTERN}</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file debug output -->
|
||||
<appender name="debug" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/debug.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM, aux}/debug.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!-- Log file error output -->
|
||||
<appender name="error" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>${log.path}/error.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<fileNamePattern>${log.path}/%d{yyyy-MM}/error.%d{yyyy-MM-dd}.%i.log.gz</fileNamePattern>
|
||||
<maxFileSize>50MB</maxFileSize>
|
||||
<maxHistory>30</maxHistory>
|
||||
</rollingPolicy>
|
||||
<encoder>
|
||||
<pattern>%date [%thread] %-5level [%logger{50}] %file:%line - %msg%n</pattern>
|
||||
</encoder>
|
||||
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
|
||||
<level>ERROR</level>
|
||||
</filter>
|
||||
</appender>
|
||||
|
||||
<logger name="org.activiti.engine.impl.db" level="DEBUG">
|
||||
<appender-ref ref="debug"/>
|
||||
</logger>
|
||||
|
||||
<!--nacos 心跳 INFO 屏蔽-->
|
||||
<logger name="com.alibaba.nacos" level="OFF">
|
||||
<appender-ref ref="error"/>
|
||||
</logger>
|
||||
<!-- Level: FATAL 0 ERROR 3 WARN 4 INFO 6 DEBUG 7 -->
|
||||
<root level="INFO">
|
||||
<appender-ref ref="console"/>
|
||||
<appender-ref ref="debug"/>
|
||||
</root>
|
||||
</configuration>
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.pig4cloud.pigx.dynamic.mapper.TestMapper">
|
||||
|
||||
<select id="getTest2" resultType="com.pig4cloud.pigx.dynamic.vo.UserVO">
|
||||
SELECT * FROM user
|
||||
</select>
|
||||
<select id="getTest3" resultType="com.pig4cloud.pigx.dynamic.vo.UserVO">
|
||||
SELECT * FROM user
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,179 @@
|
||||
<?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>pigx-visual</artifactId>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<version>3.5.0</version>
|
||||
</parent>
|
||||
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>pigx-dynamic-datasource</artifactId>
|
||||
<packaging>pom</packaging>
|
||||
<name>pigx-dynamic-datasource</name>
|
||||
|
||||
<properties>
|
||||
<spring-boot.version>2.1.10.RELEASE</spring-boot.version>
|
||||
<spring-cloud.version>Greenwich.SR3</spring-cloud.version>
|
||||
<spring-cloud-alibaba.version>2.1.0.RELEASE</spring-cloud-alibaba.version>
|
||||
<spring-platform.version>Cairo-SR8</spring-platform.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<maven.compiler.source>1.8</maven.compiler.source>
|
||||
<maven.compiler.target>1.8</maven.compiler.target>
|
||||
<hutool.version>5.0.5</hutool.version>
|
||||
<pigx.bom.version>3.5.0</pigx.bom.version>
|
||||
<kaptcha.version>0.0.9</kaptcha.version>
|
||||
<jasypt.version>2.1.1</jasypt.version>
|
||||
<ttl.version>2.10.2</ttl.version>
|
||||
<spring-boot-admin.version>2.1.6</spring-boot-admin.version>
|
||||
<security.oauth.version>2.3.6.RELEASE</security.oauth.version>
|
||||
</properties>
|
||||
|
||||
<!--项目子模块-->
|
||||
<modules>
|
||||
<module>pigx-dynamic-datasource-api</module>
|
||||
<module>pigx-dynamic-datasource-biz</module>
|
||||
</modules>
|
||||
|
||||
<dependencies>
|
||||
<!--配置文件处理器-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-configuration-processor</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<!--jasypt配置文件加解密-->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>${jasypt.version}</version>
|
||||
</dependency>
|
||||
<!--监控-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!--监控客户端-->
|
||||
<dependency>
|
||||
<groupId>de.codecentric</groupId>
|
||||
<artifactId>spring-boot-admin-starter-client</artifactId>
|
||||
<version>${spring-boot-admin.version}</version>
|
||||
</dependency>
|
||||
<!--Lombok-->
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<!--测试依赖-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-dependencies</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.spring.platform</groupId>
|
||||
<artifactId>platform-bom</artifactId>
|
||||
<version>${spring-platform.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.pig4cloud</groupId>
|
||||
<artifactId>pigx-common-bom</artifactId>
|
||||
<version>${pigx.bom.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<!--spring cloud alibaba-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba.cloud</groupId>
|
||||
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
|
||||
<version>${spring-cloud-alibaba.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
<!--稳定版本,替代spring security bom内置-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.security.oauth</groupId>
|
||||
<artifactId>spring-security-oauth2</artifactId>
|
||||
<version>${security.oauth.version}</version>
|
||||
</dependency>
|
||||
<!--web 模块-->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<exclusions>
|
||||
<!--排除tomcat依赖-->
|
||||
<exclusion>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<finalName>${project.name}</finalName>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<filtering>true</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</pluginManagement>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<artifactId>maven-compiler-plugin</artifactId>
|
||||
<version>3.8.0</version>
|
||||
<configuration>
|
||||
<target>${maven.compiler.target}</target>
|
||||
<source>${maven.compiler.source}</source>
|
||||
<encoding>UTF-8</encoding>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>pl.project13.maven</groupId>
|
||||
<artifactId>git-commit-id-plugin</artifactId>
|
||||
<version>2.2.5</version>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
</project>
|
||||
@@ -42,5 +42,6 @@
|
||||
<module>pigx-sso-client-demo</module>
|
||||
<module>pigx-sentinel-dashboard</module>
|
||||
<module>pigx-tx-manager</module>
|
||||
<module>pigx-dynamic-datasource</module>
|
||||
</modules>
|
||||
</project>
|
||||
Reference in new issue
Block a user