forked from yudaocode/SpringBoot-Labs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
YunaiV
committed
Nov 20, 2019
1 parent
f4934df
commit 611be14
Showing
76 changed files
with
1,769 additions
and
2 deletions.
There are no files selected for viewing
5 changes: 5 additions & 0 deletions
5
lab-11/lab-07-spring-data-redis-with-jedis/target/classes/lua/compareAndSet2.lua
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
if redis.call('GET', KEYS[1]) != ARGV[1] then | ||
return {0} | ||
end | ||
redis.call('SET', KEYS[2], ARGV[2]) | ||
return {1} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
spring: | ||
# datasource 数据源配置内容 | ||
datasource: | ||
url: jdbc:mysql://47.112.193.81:3306/testb5f4?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: testb5f4 | ||
password: F4df4db0ed86@11 | ||
# JPA 配置内容,对应 JpaProperties 类 | ||
jpa: | ||
show-sql: true # 打印 SQL 。生产环境,建议关闭 | ||
# Hibernate 配置内容,对应 HibernateProperties 类 | ||
hibernate: | ||
ddl-auto: none |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
spring: | ||
# datasource 数据源配置内容 | ||
datasource: | ||
url: jdbc:mysql://47.112.193.81:3306/testb5f4?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: testb5f4 | ||
password: F4df4db0ed86@11 |
6 changes: 6 additions & 0 deletions
6
lab-15/lab-15-spring-data-elasticsearch/target/classes/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
spring: | ||
data: | ||
# Elasticsearch 配置项 | ||
elasticsearch: | ||
cluster-name: elasticsearch # 集群名 | ||
cluster-nodes: 127.0.0.1:9300 # 集群节点 |
5 changes: 5 additions & 0 deletions
5
lab-15/lab-15-spring-data-jest/target/classes/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
spring: | ||
data: | ||
# Jest 配置项 | ||
jest: | ||
uri: http://127.0.0.1:9200 |
18 changes: 18 additions & 0 deletions
18
lab-16/lab-16-spring-data-mongodb/target/classes/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
spring: | ||
data: | ||
# MongoDB 配置项,对应 MongoProperties 类 | ||
mongodb: | ||
host: 127.0.0.1 | ||
port: 27017 | ||
database: yourdatabase | ||
username: test01 | ||
password: password01 | ||
# 上述属性,也可以只配置 uri | ||
|
||
logging: | ||
level: | ||
org: | ||
springframework: | ||
data: | ||
mongodb: | ||
core: DEBUG # 打印 mongodb 操作的具体语句。生产环境下,不建议开启。 |
24 changes: 24 additions & 0 deletions
24
lab-17/lab-17-dynamic-datasource-baomidou-01/target/classes/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
spring: | ||
datasource: | ||
# dynamic-datasource-spring-boot-starter 动态数据源的配置内容 | ||
dynamic: | ||
primary: users # 设置默认的数据源或者数据源组,默认值即为 master | ||
datasource: | ||
# 订单 orders 数据源配置 | ||
orders: | ||
url: jdbc:mysql://127.0.0.1:3306/test_orders?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: | ||
# 用户 users 数据源配置 | ||
users: | ||
url: jdbc:mysql://127.0.0.1:3306/test_users?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: | ||
|
||
# mybatis 配置内容 | ||
mybatis: | ||
config-location: classpath:mybatis-config.xml # 配置 MyBatis 配置文件路径 | ||
mapper-locations: classpath:mapper/*.xml # 配置 Mapper XML 地址 | ||
type-aliases-package: cn.iocoder.springboot.lab17.dynamicdatasource.dataobject # 配置数据库实体包路径 |
16 changes: 16 additions & 0 deletions
16
lab-17/lab-17-dynamic-datasource-baomidou-01/target/classes/mapper/OrderMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?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="cn.iocoder.springboot.lab17.dynamicdatasource.mapper.OrderMapper"> | ||
|
||
<sql id="FIELDS"> | ||
id, user_id | ||
</sql> | ||
|
||
<select id="selectById" parameterType="Integer" resultType="OrderDO"> | ||
SELECT | ||
<include refid="FIELDS" /> | ||
FROM orders | ||
WHERE id = #{id} | ||
</select> | ||
|
||
</mapper> |
16 changes: 16 additions & 0 deletions
16
lab-17/lab-17-dynamic-datasource-baomidou-01/target/classes/mapper/UserMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?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="cn.iocoder.springboot.lab17.dynamicdatasource.mapper.UserMapper"> | ||
|
||
<sql id="FIELDS"> | ||
id, username | ||
</sql> | ||
|
||
<select id="selectById" parameterType="Integer" resultType="UserDO"> | ||
SELECT | ||
<include refid="FIELDS" /> | ||
FROM users | ||
WHERE id = #{id} | ||
</select> | ||
|
||
</mapper> |
19 changes: 19 additions & 0 deletions
19
lab-17/lab-17-dynamic-datasource-baomidou-01/target/classes/mybatis-config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> | ||
<configuration> | ||
|
||
<settings> | ||
<!-- 使用驼峰命名法转换字段。 --> | ||
<setting name="mapUnderscoreToCamelCase" value="true"/> | ||
</settings> | ||
|
||
<typeAliases> | ||
<typeAlias alias="Integer" type="java.lang.Integer"/> | ||
<typeAlias alias="Long" type="java.lang.Long"/> | ||
<typeAlias alias="HashMap" type="java.util.HashMap"/> | ||
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap"/> | ||
<typeAlias alias="ArrayList" type="java.util.ArrayList"/> | ||
<typeAlias alias="LinkedList" type="java.util.LinkedList"/> | ||
</typeAliases> | ||
|
||
</configuration> |
13 changes: 13 additions & 0 deletions
13
lab-17/lab-17-dynamic-datasource-baomidou-01/target/classes/sql/db.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CREATE TABLE `users` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号', | ||
`username` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '账号', | ||
PRIMARY KEY (`id`), | ||
UNIQUE KEY `idx_username` (`username`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; | ||
|
||
|
||
|
||
CREATE TABLE `orders` ( | ||
`id` int(11) DEFAULT NULL COMMENT '订单编号', | ||
`user_id` int(16) DEFAULT NULL COMMENT '用户编号' | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='订单表'; |
30 changes: 30 additions & 0 deletions
30
lab-17/lab-17-dynamic-datasource-baomidou-02/target/classes/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
spring: | ||
datasource: | ||
# dynamic-datasource-spring-boot-starter 动态数据源的配置内容 | ||
dynamic: | ||
primary: master # 设置默认的数据源或者数据源组,默认值即为 master | ||
datasource: | ||
# 订单 orders 主库的数据源配置 | ||
master: | ||
url: jdbc:mysql://127.0.0.1:3306/test_orders?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: | ||
# 订单 orders 从库数据源配置 | ||
slave_1: | ||
url: jdbc:mysql://127.0.0.1:3306/test_orders_01?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: | ||
# 订单 orders 从库数据源配置 | ||
slave_2: | ||
url: jdbc:mysql://127.0.0.1:3306/test_orders_02?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: | ||
|
||
# mybatis 配置内容 | ||
mybatis: | ||
config-location: classpath:mybatis-config.xml # 配置 MyBatis 配置文件路径 | ||
mapper-locations: classpath:mapper/*.xml # 配置 Mapper XML 地址 | ||
type-aliases-package: cn.iocoder.springboot.lab17.dynamicdatasource.dataobject # 配置数据库实体包路径 |
24 changes: 24 additions & 0 deletions
24
lab-17/lab-17-dynamic-datasource-baomidou-02/target/classes/mapper/OrderMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?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="cn.iocoder.springboot.lab17.dynamicdatasource.mapper.OrderMapper"> | ||
|
||
<sql id="FIELDS"> | ||
id, user_id | ||
</sql> | ||
|
||
<select id="selectById" parameterType="Integer" resultType="OrderDO"> | ||
SELECT | ||
<include refid="FIELDS" /> | ||
FROM orders | ||
WHERE id = #{id} | ||
</select> | ||
|
||
<insert id="insert" parameterType="OrderDO" useGeneratedKeys="true" keyProperty="id"> | ||
INSERT INTO orders ( | ||
user_id | ||
) VALUES ( | ||
#{userId} | ||
) | ||
</insert> | ||
|
||
</mapper> |
19 changes: 19 additions & 0 deletions
19
lab-17/lab-17-dynamic-datasource-baomidou-02/target/classes/mybatis-config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> | ||
<configuration> | ||
|
||
<settings> | ||
<!-- 使用驼峰命名法转换字段。 --> | ||
<setting name="mapUnderscoreToCamelCase" value="true"/> | ||
</settings> | ||
|
||
<typeAliases> | ||
<typeAlias alias="Integer" type="java.lang.Integer"/> | ||
<typeAlias alias="Long" type="java.lang.Long"/> | ||
<typeAlias alias="HashMap" type="java.util.HashMap"/> | ||
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap"/> | ||
<typeAlias alias="ArrayList" type="java.util.ArrayList"/> | ||
<typeAlias alias="LinkedList" type="java.util.LinkedList"/> | ||
</typeAliases> | ||
|
||
</configuration> |
13 changes: 13 additions & 0 deletions
13
lab-17/lab-17-dynamic-datasource-baomidou-02/target/classes/sql/db.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CREATE TABLE `users` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号', | ||
`username` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '账号', | ||
PRIMARY KEY (`id`), | ||
UNIQUE KEY `idx_username` (`username`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; | ||
|
||
|
||
|
||
CREATE TABLE `orders` ( | ||
`id` int(11) DEFAULT NULL COMMENT '订单编号', | ||
`user_id` int(16) DEFAULT NULL COMMENT '用户编号' | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='订单表'; |
15 changes: 15 additions & 0 deletions
15
lab-17/lab-17-dynamic-datasource-jdbctemplate/target/classes/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
spring: | ||
# datasource 数据源配置内容 | ||
datasource: | ||
# 订单数据源配置 | ||
orders: | ||
jdbc-url: jdbc:mysql://127.0.0.1:3306/test_orders?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: | ||
# 用户数据源配置 | ||
users: | ||
jdbc-url: jdbc:mysql://127.0.0.1:3306/test_users?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: |
20 changes: 20 additions & 0 deletions
20
lab-17/lab-17-dynamic-datasource-mybatis/target/classes/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
spring: | ||
# datasource 数据源配置内容 | ||
datasource: | ||
# 订单数据源配置 | ||
orders: | ||
jdbc-url: jdbc:mysql://127.0.0.1:3306/test_orders?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: | ||
# 用户数据源配置 | ||
users: | ||
jdbc-url: jdbc:mysql://127.0.0.1:3306/test_users?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
username: root | ||
password: | ||
|
||
# mybatis 配置内容 | ||
#mybatis: | ||
# config-location: classpath:mybatis-config.xml # 配置 MyBatis 配置文件路径 | ||
# type-aliases-package: cn.iocoder.springboot.lab17.dynamicdatasource.dataobject # 配置数据库实体包路径 |
16 changes: 16 additions & 0 deletions
16
lab-17/lab-17-dynamic-datasource-mybatis/target/classes/mapper/orders/OrderMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?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="cn.iocoder.springboot.lab17.dynamicdatasource.mapper.orders.OrderMapper"> | ||
|
||
<sql id="FIELDS"> | ||
id, user_id | ||
</sql> | ||
|
||
<select id="selectById" parameterType="Integer" resultType="OrderDO"> | ||
SELECT | ||
<include refid="FIELDS" /> | ||
FROM orders | ||
WHERE id = #{id} | ||
</select> | ||
|
||
</mapper> |
16 changes: 16 additions & 0 deletions
16
lab-17/lab-17-dynamic-datasource-mybatis/target/classes/mapper/users/UserMapper.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<?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="cn.iocoder.springboot.lab17.dynamicdatasource.mapper.users.UserMapper"> | ||
|
||
<sql id="FIELDS"> | ||
id, username | ||
</sql> | ||
|
||
<select id="selectById" parameterType="Integer" resultType="UserDO"> | ||
SELECT | ||
<include refid="FIELDS" /> | ||
FROM users | ||
WHERE id = #{id} | ||
</select> | ||
|
||
</mapper> |
19 changes: 19 additions & 0 deletions
19
lab-17/lab-17-dynamic-datasource-mybatis/target/classes/mybatis-config.xml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<?xml version="1.0" encoding="UTF-8" ?> | ||
<!DOCTYPE configuration PUBLIC "-//mybatis.org//DTD Config 3.0//EN" "http://mybatis.org/dtd/mybatis-3-config.dtd"> | ||
<configuration> | ||
|
||
<settings> | ||
<!-- 使用驼峰命名法转换字段。 --> | ||
<setting name="mapUnderscoreToCamelCase" value="true"/> | ||
</settings> | ||
|
||
<typeAliases> | ||
<typeAlias alias="Integer" type="java.lang.Integer"/> | ||
<typeAlias alias="Long" type="java.lang.Long"/> | ||
<typeAlias alias="HashMap" type="java.util.HashMap"/> | ||
<typeAlias alias="LinkedHashMap" type="java.util.LinkedHashMap"/> | ||
<typeAlias alias="ArrayList" type="java.util.ArrayList"/> | ||
<typeAlias alias="LinkedList" type="java.util.LinkedList"/> | ||
</typeAliases> | ||
|
||
</configuration> |
13 changes: 13 additions & 0 deletions
13
lab-17/lab-17-dynamic-datasource-mybatis/target/classes/sql/db.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
CREATE TABLE `users` ( | ||
`id` int(11) NOT NULL AUTO_INCREMENT COMMENT '用户编号', | ||
`username` varchar(64) COLLATE utf8mb4_bin DEFAULT NULL COMMENT '账号', | ||
PRIMARY KEY (`id`), | ||
UNIQUE KEY `idx_username` (`username`) | ||
) ENGINE=InnoDB AUTO_INCREMENT=7 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin; | ||
|
||
|
||
|
||
CREATE TABLE `orders` ( | ||
`id` int(11) DEFAULT NULL COMMENT '订单编号', | ||
`user_id` int(16) DEFAULT NULL COMMENT '用户编号' | ||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin COMMENT='订单表'; |
35 changes: 35 additions & 0 deletions
35
lab-17/lab-17-dynamic-datasource-sharding-jdbc-01/target/classes/application.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
spring: | ||
# ShardingSphere 配置项 | ||
shardingsphere: | ||
datasource: | ||
# 所有数据源的名字 | ||
names: ds-orders, ds-users | ||
# 订单 orders 数据源配置 | ||
ds-orders: | ||
type: com.zaxxer.hikari.HikariDataSource # 使用 Hikari 数据库连接池 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
jdbc-url: jdbc:mysql://127.0.0.1:3306/test_orders?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
username: root | ||
password: | ||
# 订单 users 数据源配置 | ||
ds-users: | ||
type: com.zaxxer.hikari.HikariDataSource # 使用 Hikari 数据库连接池 | ||
driver-class-name: com.mysql.jdbc.Driver | ||
jdbc-url: jdbc:mysql://127.0.0.1:3306/test_users?useSSL=false&useUnicode=true&characterEncoding=UTF-8 | ||
username: root | ||
password: | ||
# 分片规则 | ||
sharding: | ||
tables: | ||
# orders 表配置 | ||
orders: | ||
actualDataNodes: ds-orders.orders # 映射到 ds-orders 数据源的 orders 表 | ||
# users 表配置 | ||
users: | ||
actualDataNodes: ds-users.users # 映射到 ds-users 数据源的 users 表 | ||
|
||
# mybatis 配置内容 | ||
mybatis: | ||
config-location: classpath:mybatis-config.xml # 配置 MyBatis 配置文件路径 | ||
mapper-locations: classpath:mapper/*.xml # 配置 Mapper XML 地址 | ||
type-aliases-package: cn.iocoder.springboot.lab17.dynamicdatasource.dataobject # 配置数据库实体包路径 |
Oops, something went wrong.