mirror of
https://github.com/jeecgboot/JeecgBoot.git
synced 2026-02-05 18:15:28 +08:00
3.2.0-beta,重构很大:升级springboot2.6.6、spring-cloud-alibaba 2021.1、mybatisplus3.5.1、代码规范部分重构
This commit is contained in:
@ -21,6 +21,7 @@ CREATE TABLE `sys_log0` (
|
||||
KEY `index_operate_type` (`operate_type`) USING BTREE,
|
||||
KEY `index_createtime` (`create_time`) USING BTREE
|
||||
) ENGINE=MyISAM DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC COMMENT='系统日志表';
|
||||
|
||||
CREATE TABLE `sys_log1` (
|
||||
`id` varchar(32) NOT NULL,
|
||||
`log_type` int(2) DEFAULT NULL COMMENT '日志类型(1登录日志,2操作日志)',
|
||||
|
||||
@ -5,7 +5,7 @@
|
||||
<parent>
|
||||
<artifactId>jeecg-cloud-test</artifactId>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<version>3.1.0</version>
|
||||
<version>3.2.0</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
@ -15,7 +15,6 @@
|
||||
<dependency>
|
||||
<groupId>org.jeecgframework.boot</groupId>
|
||||
<artifactId>jeecg-boot-starter-shardingsphere</artifactId>
|
||||
<version>3.1.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
@ -23,18 +23,17 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@Slf4j
|
||||
@Api(tags = "分库分表测试")
|
||||
@RestController
|
||||
@RequestMapping("/sharding/")
|
||||
@RequestMapping("/sharding")
|
||||
public class JeecgShardingDemoController extends JeecgController<ShardingSysLog, IShardingSysLogService> {
|
||||
@Autowired
|
||||
private IShardingSysLogService shardingSysLogService;
|
||||
|
||||
/**
|
||||
* 单库分表
|
||||
* 单库分表 —— 添加
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/test1")
|
||||
@AutoLog(value = "单库分表")
|
||||
@ApiOperation(value = "单库分表", notes = "分库分表添加")
|
||||
@ApiOperation(value = "单库分表插入", notes = "单库分表")
|
||||
public Result<?> add() {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
ShardingSysLog shardingSysLog = new ShardingSysLog();
|
||||
@ -45,13 +44,23 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
}
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 双库分表
|
||||
* 单库分表 —— 查询
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/list1")
|
||||
@ApiOperation(value = "单库分表查询", notes = "单库分表")
|
||||
public Result<?> list() {
|
||||
return Result.OK(shardingSysLogService.list());
|
||||
}
|
||||
|
||||
/**
|
||||
* 双库分表 - 插入
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/test2")
|
||||
@AutoLog(value = "双库分表")
|
||||
@ApiOperation(value = "双库分表", notes = "双库分表")
|
||||
@ApiOperation(value = "双库分表插入", notes = "双库分表")
|
||||
public Result<?> test2() {
|
||||
for (int i = 20; i <= 30; i++) {
|
||||
ShardingSysLog shardingSysLog = new ShardingSysLog();
|
||||
@ -63,4 +72,14 @@ public class JeecgShardingDemoController extends JeecgController<ShardingSysLog,
|
||||
return Result.OK();
|
||||
}
|
||||
|
||||
/**
|
||||
* 双库分表 - 查询
|
||||
* @return
|
||||
*/
|
||||
@PostMapping(value = "/list2")
|
||||
@ApiOperation(value = "双库分表查询", notes = "双库分表")
|
||||
public Result<?> list2() {
|
||||
return Result.OK(shardingSysLogService.list());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
#单库分表配置
|
||||
spring:
|
||||
shardingsphere:
|
||||
props:
|
||||
@ -6,10 +7,10 @@ spring:
|
||||
#添加分库数据源
|
||||
ds0:
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3300/jeecg-boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://jeecg-boot-mysql:3306/jeecg-boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
username: root
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
password: root
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
names: ds0
|
||||
# 规则配置
|
||||
rules:
|
||||
|
||||
@ -6,13 +6,13 @@ spring:
|
||||
datasource:
|
||||
ds0:
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/jeecg-boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://jeecg-boot-mysql:3306/jeecg-boot?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
username: root
|
||||
password: root
|
||||
ds1:
|
||||
driverClassName: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/jeecg-boot2?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
url: jdbc:mysql://jeecg-boot-mysql:3306/jeecg-boot2?useSSL=false&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai
|
||||
type: com.alibaba.druid.pool.DruidDataSource
|
||||
username: root
|
||||
password: root
|
||||
|
||||
Reference in New Issue
Block a user