From ac17cf180598a6eb7154508da773fc55a5834b76 Mon Sep 17 00:00:00 2001 From: YunaiV Date: Mon, 8 Mar 2021 21:12:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=E5=8D=95=E5=85=83=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=EF=BC=8C=E6=96=B0=E5=A2=9E=20BaseDbUnitTest=20?= =?UTF-8?q?=E5=92=8C=20BaseDbAndRedisUnitTest=20=E5=9F=BA=E7=B1=BB?= =?UTF-8?q?=EF=BC=8C=E8=A7=A3=E5=86=B3=20SpringBoot=20=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E9=85=8D=E7=BD=AE=EF=BC=8C=E5=AF=BC=E8=87=B4=E5=90=AF=E5=8A=A8?= =?UTF-8?q?=E8=BF=87=E6=85=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatis/config/MybatisConfiguration.java | 3 +- .../dashboard/BaseDbAndRedisUnitTest.java | 46 +++++++++++++++++++ .../cn/iocoder/dashboard/BaseDbUnitTest.java | 37 +++++++++++++++ .../dashboard/BaseSpringBootUnitTest.java | 1 + .../config/RedisTestConfiguration.java | 2 - .../config/SecurityTestConfiguration.java | 16 ------- .../service/config/InfConfigServiceTest.java | 6 ++- .../service/auth/SysAuthServiceImplTest.java | 22 ++++++++- .../service/dict/SysDictDataServiceTest.java | 6 ++- .../service/dict/SysDictTypeServiceTest.java | 7 +-- src/test/resources/application-unit-test.yaml | 45 +++--------------- src/test/resources/sql/create_tables.sql | 28 +++++------ 12 files changed, 138 insertions(+), 81 deletions(-) create mode 100644 src/test/java/cn/iocoder/dashboard/BaseDbAndRedisUnitTest.java create mode 100644 src/test/java/cn/iocoder/dashboard/BaseDbUnitTest.java delete mode 100644 src/test/java/cn/iocoder/dashboard/config/SecurityTestConfiguration.java diff --git a/src/main/java/cn/iocoder/dashboard/framework/mybatis/config/MybatisConfiguration.java b/src/main/java/cn/iocoder/dashboard/framework/mybatis/config/MybatisConfiguration.java index a955c402e..2a70b53d4 100644 --- a/src/main/java/cn/iocoder/dashboard/framework/mybatis/config/MybatisConfiguration.java +++ b/src/main/java/cn/iocoder/dashboard/framework/mybatis/config/MybatisConfiguration.java @@ -13,7 +13,8 @@ import org.springframework.context.annotation.Configuration; * @author 芋道源码 */ @Configuration -@MapperScan(value = "${yudao.info.base-package}", annotationClass = Mapper.class) +@MapperScan(value = "${yudao.info.base-package}", annotationClass = Mapper.class, + lazyInitialization = "${mybatis.lazy-initialization:false}") // Mapper 懒加载,目前仅用于单元测试 public class MybatisConfiguration { @Bean diff --git a/src/test/java/cn/iocoder/dashboard/BaseDbAndRedisUnitTest.java b/src/test/java/cn/iocoder/dashboard/BaseDbAndRedisUnitTest.java new file mode 100644 index 000000000..59bacb052 --- /dev/null +++ b/src/test/java/cn/iocoder/dashboard/BaseDbAndRedisUnitTest.java @@ -0,0 +1,46 @@ +package cn.iocoder.dashboard; + +import cn.iocoder.dashboard.config.RedisTestConfiguration; +import cn.iocoder.dashboard.framework.datasource.config.DataSourceConfiguration; +import cn.iocoder.dashboard.framework.mybatis.config.MybatisConfiguration; +import cn.iocoder.dashboard.framework.redis.config.RedisConfig; +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; +import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; +import org.redisson.spring.starter.RedissonAutoConfiguration; +import org.springframework.boot.autoconfigure.data.redis.RedisAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Import; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.jdbc.Sql; + +/** + * 依赖内存 DB 的单元测试 + * + * 注意,Service 层同样适用。对于 Service 层的单元测试,我们针对自己模块的 Mapper 走的是 H2 内存数据库,针对别的模块的 Service 走的是 Mock 方法 + * + * @author 芋道源码 + */ +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbAndRedisUnitTest.Application.class) +@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件 +@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB +public class BaseDbAndRedisUnitTest { + + @Import({ + // DB 配置类 + DataSourceConfiguration.class, // 自己的 DB 配置类 + DataSourceAutoConfiguration.class, // Spring DB 自动配置类 + DruidDataSourceAutoConfigure.class, // Druid 自动配置类 + // MyBatis 配置类 + MybatisConfiguration.class, // 自己的 MyBatis 配置类 + MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类 + // Redis 配置类 + RedisTestConfiguration.class, // Redis 测试配置类,用于启动 RedisServer + RedisAutoConfiguration.class, // Spring Redis 自动配置类 + RedisConfig.class, // 自己的 Redis 配置类 + RedissonAutoConfiguration.class, // Redisson 自动高配置类 + }) + public static class Application { + } + +} diff --git a/src/test/java/cn/iocoder/dashboard/BaseDbUnitTest.java b/src/test/java/cn/iocoder/dashboard/BaseDbUnitTest.java new file mode 100644 index 000000000..821118279 --- /dev/null +++ b/src/test/java/cn/iocoder/dashboard/BaseDbUnitTest.java @@ -0,0 +1,37 @@ +package cn.iocoder.dashboard; + +import cn.iocoder.dashboard.framework.datasource.config.DataSourceConfiguration; +import cn.iocoder.dashboard.framework.mybatis.config.MybatisConfiguration; +import com.alibaba.druid.spring.boot.autoconfigure.DruidDataSourceAutoConfigure; +import com.baomidou.mybatisplus.autoconfigure.MybatisPlusAutoConfiguration; +import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.context.annotation.Import; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.jdbc.Sql; + +/** + * 依赖内存 DB 的单元测试 + * + * 注意,Service 层同样适用。对于 Service 层的单元测试,我们针对自己模块的 Mapper 走的是 H2 内存数据库,针对别的模块的 Service 走的是 Mock 方法 + * + * @author 芋道源码 + */ +@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE, classes = BaseDbUnitTest.Application.class) +@ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件 +@Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB +public class BaseDbUnitTest { + + @Import({ + // DB 配置类 + DataSourceConfiguration.class, // 自己的 DB 配置类 + DataSourceAutoConfiguration.class, // Spring DB 自动配置类 + DruidDataSourceAutoConfigure.class, // Druid 自动配置类 + // MyBatis 配置类 + MybatisConfiguration.class, // 自己的 MyBatis 配置类 + MybatisPlusAutoConfiguration.class, // MyBatis 的自动配置类 + }) + public static class Application { + } + +} diff --git a/src/test/java/cn/iocoder/dashboard/BaseSpringBootUnitTest.java b/src/test/java/cn/iocoder/dashboard/BaseSpringBootUnitTest.java index a00fc472d..fe615dcaf 100644 --- a/src/test/java/cn/iocoder/dashboard/BaseSpringBootUnitTest.java +++ b/src/test/java/cn/iocoder/dashboard/BaseSpringBootUnitTest.java @@ -12,6 +12,7 @@ import javax.annotation.Resource; @SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.NONE) @ActiveProfiles("unit-test") // 设置使用 application-unit-test 配置文件 @Sql(scripts = "/sql/clean.sql", executionPhase = Sql.ExecutionPhase.AFTER_TEST_METHOD) // 每个单元测试结束后,清理 DB +@Deprecated public class BaseSpringBootUnitTest { @Resource diff --git a/src/test/java/cn/iocoder/dashboard/config/RedisTestConfiguration.java b/src/test/java/cn/iocoder/dashboard/config/RedisTestConfiguration.java index 1cddd9e1c..c93d766a4 100644 --- a/src/test/java/cn/iocoder/dashboard/config/RedisTestConfiguration.java +++ b/src/test/java/cn/iocoder/dashboard/config/RedisTestConfiguration.java @@ -8,12 +8,10 @@ import org.springframework.boot.autoconfigure.data.redis.RedisProperties; import org.springframework.boot.context.properties.EnableConfigurationProperties; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Lazy; import java.io.IOException; @Configuration(proxyBeanMethods = false) -@Lazy(false) // 禁用懒加载,因为需要保证 Redis Server 必须先启动 @EnableConfigurationProperties(RedisProperties.class) @AutoConfigureBefore({RedisAutoConfiguration.class, RedissonAutoConfiguration.class}) // 在 Redis 自动配置前,进行初始化 public class RedisTestConfiguration { diff --git a/src/test/java/cn/iocoder/dashboard/config/SecurityTestConfiguration.java b/src/test/java/cn/iocoder/dashboard/config/SecurityTestConfiguration.java deleted file mode 100644 index 08738388a..000000000 --- a/src/test/java/cn/iocoder/dashboard/config/SecurityTestConfiguration.java +++ /dev/null @@ -1,16 +0,0 @@ -package cn.iocoder.dashboard.config; - -import org.mockito.Mockito; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.security.authentication.AuthenticationManager; - -@Configuration -public class SecurityTestConfiguration { - - @Bean - public AuthenticationManager authenticationManager() { - return Mockito.mock(AuthenticationManager.class); - } - -} diff --git a/src/test/java/cn/iocoder/dashboard/modules/infra/service/config/InfConfigServiceTest.java b/src/test/java/cn/iocoder/dashboard/modules/infra/service/config/InfConfigServiceTest.java index 94903e6dc..a01330527 100644 --- a/src/test/java/cn/iocoder/dashboard/modules/infra/service/config/InfConfigServiceTest.java +++ b/src/test/java/cn/iocoder/dashboard/modules/infra/service/config/InfConfigServiceTest.java @@ -1,6 +1,6 @@ package cn.iocoder.dashboard.modules.infra.service.config; -import cn.iocoder.dashboard.BaseSpringBootUnitTest; +import cn.iocoder.dashboard.BaseDbUnitTest; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.infra.controller.config.vo.InfConfigCreateReqVO; import cn.iocoder.dashboard.modules.infra.controller.config.vo.InfConfigExportReqVO; @@ -15,6 +15,7 @@ import cn.iocoder.dashboard.util.collection.ArrayUtils; import cn.iocoder.dashboard.util.object.ObjectUtils; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.util.List; @@ -35,7 +36,8 @@ import static org.mockito.Mockito.verify; * * @author 芋道源码 */ -public class InfConfigServiceTest extends BaseSpringBootUnitTest { +@Import(InfConfigServiceImpl.class) +public class InfConfigServiceTest extends BaseDbUnitTest { @Resource private InfConfigServiceImpl configService; diff --git a/src/test/java/cn/iocoder/dashboard/modules/system/service/auth/SysAuthServiceImplTest.java b/src/test/java/cn/iocoder/dashboard/modules/system/service/auth/SysAuthServiceImplTest.java index 5d9ac58a7..1be999efb 100644 --- a/src/test/java/cn/iocoder/dashboard/modules/system/service/auth/SysAuthServiceImplTest.java +++ b/src/test/java/cn/iocoder/dashboard/modules/system/service/auth/SysAuthServiceImplTest.java @@ -1,15 +1,19 @@ package cn.iocoder.dashboard.modules.system.service.auth; -import cn.iocoder.dashboard.BaseSpringBootUnitTest; +import cn.iocoder.dashboard.BaseDbUnitTest; import cn.iocoder.dashboard.common.enums.CommonStatusEnum; import cn.iocoder.dashboard.framework.security.core.LoginUser; import cn.iocoder.dashboard.modules.system.dal.dataobject.user.SysUserDO; import cn.iocoder.dashboard.modules.system.service.auth.impl.SysAuthServiceImpl; +import cn.iocoder.dashboard.modules.system.service.common.SysCaptchaService; +import cn.iocoder.dashboard.modules.system.service.logger.SysLoginLogService; import cn.iocoder.dashboard.modules.system.service.permission.SysPermissionService; import cn.iocoder.dashboard.modules.system.service.user.SysUserService; import cn.iocoder.dashboard.util.AssertUtils; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; +import org.springframework.security.authentication.AuthenticationManager; import org.springframework.security.core.userdetails.UsernameNotFoundException; import javax.annotation.Resource; @@ -21,7 +25,13 @@ import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.eq; import static org.mockito.Mockito.when; -public class SysAuthServiceImplTest extends BaseSpringBootUnitTest { +/** + * {@link SysAuthServiceImpl} 的单元测试 + * + * @author 芋道源码 + */ +@Import(SysAuthServiceImpl.class) +public class SysAuthServiceImplTest extends BaseDbUnitTest { @Resource private SysAuthServiceImpl authService; @@ -30,6 +40,14 @@ public class SysAuthServiceImplTest extends BaseSpringBootUnitTest { private SysUserService userService; @MockBean private SysPermissionService permissionService; + @MockBean + private AuthenticationManager authenticationManager; + @MockBean + private SysCaptchaService captchaService; + @MockBean + private SysLoginLogService loginLogService; + @MockBean + private SysUserSessionService userSessionService; @Test public void testLoadUserByUsername_success() { diff --git a/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataServiceTest.java b/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataServiceTest.java index ae029f73b..79c89518d 100644 --- a/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataServiceTest.java +++ b/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictDataServiceTest.java @@ -1,6 +1,6 @@ package cn.iocoder.dashboard.modules.system.service.dict; -import cn.iocoder.dashboard.BaseSpringBootUnitTest; +import cn.iocoder.dashboard.BaseDbUnitTest; import cn.iocoder.dashboard.common.enums.CommonStatusEnum; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.dict.vo.data.SysDictDataCreateReqVO; @@ -17,6 +17,7 @@ import cn.iocoder.dashboard.util.object.ObjectUtils; import com.google.common.collect.ImmutableTable; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.util.Date; @@ -37,7 +38,8 @@ import static org.mockito.Mockito.*; * * @author 芋道源码 */ -public class SysDictDataServiceTest extends BaseSpringBootUnitTest { +@Import(SysDictDataServiceImpl.class) +public class SysDictDataServiceTest extends BaseDbUnitTest { @Resource private SysDictDataServiceImpl dictDataService; diff --git a/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictTypeServiceTest.java b/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictTypeServiceTest.java index ae8d0662b..9dd072733 100644 --- a/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictTypeServiceTest.java +++ b/src/test/java/cn/iocoder/dashboard/modules/system/service/dict/SysDictTypeServiceTest.java @@ -1,6 +1,6 @@ package cn.iocoder.dashboard.modules.system.service.dict; -import cn.iocoder.dashboard.BaseSpringBootUnitTest; +import cn.iocoder.dashboard.BaseDbUnitTest; import cn.iocoder.dashboard.common.enums.CommonStatusEnum; import cn.iocoder.dashboard.common.pojo.PageResult; import cn.iocoder.dashboard.modules.system.controller.dict.vo.type.SysDictTypeCreateReqVO; @@ -14,6 +14,7 @@ import cn.iocoder.dashboard.util.collection.ArrayUtils; import cn.iocoder.dashboard.util.object.ObjectUtils; import org.junit.jupiter.api.Test; import org.springframework.boot.test.mock.mockito.MockBean; +import org.springframework.context.annotation.Import; import javax.annotation.Resource; import java.util.List; @@ -24,7 +25,6 @@ import static cn.iocoder.dashboard.modules.system.enums.SysErrorCodeConstants.*; import static cn.iocoder.dashboard.util.AssertUtils.assertPojoEquals; import static cn.iocoder.dashboard.util.AssertUtils.assertServiceException; import static cn.iocoder.dashboard.util.RandomUtils.*; -import static cn.iocoder.dashboard.util.RandomUtils.randomString; import static cn.iocoder.dashboard.util.date.DateUtils.buildTime; import static org.junit.jupiter.api.Assertions.*; import static org.mockito.ArgumentMatchers.eq; @@ -35,7 +35,8 @@ import static org.mockito.Mockito.when; * * @author 芋道源码 */ -public class SysDictTypeServiceTest extends BaseSpringBootUnitTest { +@Import(SysDictTypeServiceImpl.class) +public class SysDictTypeServiceTest extends BaseDbUnitTest { @Resource private SysDictTypeServiceImpl dictTypeService; diff --git a/src/test/resources/application-unit-test.yaml b/src/test/resources/application-unit-test.yaml index b8406322c..70cecc4c3 100644 --- a/src/test/resources/application-unit-test.yaml +++ b/src/test/resources/application-unit-test.yaml @@ -3,21 +3,6 @@ spring: lazy-initialization: true # 开启懒加载,加快速度 banner-mode: off # 单元测试,禁用 Banner - # 去除的自动配置项 - autoconfigure: - exclude: - - org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration # 单元测试,禁用 SpringSecurity - - org.springframework.boot.autoconfigure.security.reactive.ReactiveSecurityAutoConfiguration # 单元测试,禁用 SpringSecurity - - org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration # 单元测试,禁用 Quartz - - com.baomidou.lock.spring.boot.autoconfigure.LockAutoConfiguration # 单元测试,禁用 Lock4j 分布式锁 - - org.springframework.boot.autoconfigure.task.TaskSchedulingAutoConfiguration # 单元测试,禁用 Scheduler 定时任务 - - org.springframework.boot.autoconfigure.data.redis.RedisRepositoriesAutoConfiguration # 项目没有使用 Spring Data,所以禁用配置类,加速启动 - -# Swagger 接口文档的自动配置(单元测试,禁用 Swagger) -springfox: - documentation: - auto-startup: false - --- #################### 数据库相关配置 #################### spring: @@ -29,6 +14,9 @@ spring: username: sa password: schema: classpath:sql/create_tables.sql # MySQL 转 H2 的语句,使用 https://www.jooq.org/translate/ 工具 + druid: + async-init: true # 单元测试,异步初始化 Druid 连接池,提升启动速度 + initial-size: 1 # 单元测试,配置为 1,提升启动速度 # Redis 配置。Redisson 默认的配置足够使用,一般不需要进行调优 redis: @@ -36,17 +24,13 @@ spring: port: 16379 # 端口(单元测试,使用 16379 端口) database: 0 # 数据库索引 +mybatis: + lazy-initialization: true # 单元测试,设置 MyBatis Mapper 延迟加载,加速每个单元测试 + --- #################### 定时任务相关配置 #################### -# Quartz 配置项,对应 QuartzProperties 配置类(单元测试,禁用 Quartz) - --- #################### 配置中心相关配置 #################### -# Apollo 配置中心 -apollo: - bootstrap: - enabled: false # 单元测试,禁用配置中心 - --- #################### 服务保障相关配置 #################### # Lock4j 配置项(单元测试,禁用 Lock4j) @@ -63,23 +47,6 @@ resilience4j: --- #################### 监控相关配置 #################### -# Actuator 监控端点的配置项 -management: - endpoints: - enabled-by-default: false - -# Spring Boot Admin 配置项 -spring: - boot: - admin: - # Spring Boot Admin Client 客户端的相关配置 - client: - enabled: false - # Spring Boot Admin Server 服务端的相关配置 - context-path: /admin # 配置 Spring - -# 日志文件配置(不需要配置) - --- #################### 芋道相关配置 #################### # 芋道配置项,设置当前项目所有自定义的配置 diff --git a/src/test/resources/sql/create_tables.sql b/src/test/resources/sql/create_tables.sql index 29078224e..a5fb42520 100644 --- a/src/test/resources/sql/create_tables.sql +++ b/src/test/resources/sql/create_tables.sql @@ -9,9 +9,9 @@ CREATE TABLE IF NOT EXISTS "inf_config" ( "value" varchar(500) NOT NULL DEFAULT '', "sensitive" bit NOT NULL, "remark" varchar(500) DEFAULT NULL, - "create_by" varchar(64) DEFAULT '', + "creator" varchar(64) DEFAULT '', "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "update_by" varchar(64) DEFAULT '', + "updater" varchar(64) DEFAULT '', "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, "deleted" bit NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") @@ -28,9 +28,9 @@ CREATE TABLE IF NOT EXISTS "sys_dept" ( "phone" varchar(11) DEFAULT NULL, "email" varchar(50) DEFAULT NULL, "status" tinyint NOT NULL, - "create_by" varchar(64) DEFAULT '', + "creator" varchar(64) DEFAULT '', "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "update_by" varchar(64) DEFAULT '', + "updater" varchar(64) DEFAULT '', "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, "deleted" bit NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") @@ -44,9 +44,9 @@ CREATE TABLE IF NOT EXISTS "sys_dict_data" ( "dict_type" varchar(100) NOT NULL DEFAULT '', "status" tinyint NOT NULL DEFAULT '0', "remark" varchar(500) DEFAULT NULL, - "create_by" varchar(64) DEFAULT '', + "creator" varchar(64) DEFAULT '', "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "update_by" varchar(64) DEFAULT '', + "updater" varchar(64) DEFAULT '', "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, "deleted" bit NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") @@ -62,9 +62,9 @@ CREATE TABLE IF NOT EXISTS "sys_role" ( "status" tinyint NOT NULL, "type" tinyint NOT NULL, "remark" varchar(500) DEFAULT NULL, - "create_by" varchar(64) DEFAULT '', + "creator" varchar(64) DEFAULT '', "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "update_by" varchar(64) DEFAULT '', + "updater" varchar(64) DEFAULT '', "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, "deleted" bit NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") @@ -74,9 +74,9 @@ CREATE TABLE IF NOT EXISTS "sys_role_menu" ( "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, "role_id" bigint NOT NULL, "menu_id" bigint NOT NULL, - "create_by" varchar(64) DEFAULT '', + "creator" varchar(64) DEFAULT '', "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "update_by" varchar(64) DEFAULT '', + "updater" varchar(64) DEFAULT '', "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, "deleted" bit NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") @@ -93,9 +93,9 @@ CREATE TABLE IF NOT EXISTS "sys_menu" ( "icon" varchar(100) DEFAULT '#', "component" varchar(255) DEFAULT NULL, "status" tinyint NOT NULL DEFAULT '0', - "create_by" varchar(64) DEFAULT '', + "creator" varchar(64) DEFAULT '', "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "update_by" varchar(64) DEFAULT '', + "updater" varchar(64) DEFAULT '', "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, "deleted" bit NOT NULL DEFAULT FALSE, PRIMARY KEY ("id") @@ -107,9 +107,9 @@ CREATE TABLE "sys_dict_type" ( "type" varchar(100) NOT NULL DEFAULT '', "status" tinyint NOT NULL DEFAULT '0', "remark" varchar(500) DEFAULT NULL, - "create_by" varchar(64) DEFAULT '', + "creator" varchar(64) DEFAULT '', "create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, - "update_by" varchar(64) DEFAULT '', + "updater" varchar(64) DEFAULT '', "update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP, "deleted" bit NOT NULL DEFAULT FALSE, PRIMARY KEY ("id")