1. 管理后台,增加租户管理

2. 修复大量因为租户报错的单元测试
This commit is contained in:
YunaiV
2021-12-14 22:39:43 +08:00
parent a582a6e726
commit 098c5b4723
45 changed files with 1240 additions and 178 deletions

View File

@ -24,3 +24,4 @@ DELETE FROM "sys_sms_template";
DELETE FROM "sys_sms_log";
DELETE FROM "sys_error_code";
DELETE FROM "sys_social_user";
DELETE FROM "sys_tenant";

View File

@ -1,7 +1,7 @@
-- inf 开头的 DB
CREATE TABLE IF NOT EXISTS "inf_config" (
"id" int NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"id" bigint(20) NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"group" varchar(50) NOT NULL,
"type" tinyint NOT NULL,
"name" varchar(100) NOT NULL DEFAULT '',
@ -26,6 +26,7 @@ CREATE TABLE IF NOT EXISTS "inf_file" (
"updater" varchar(64) DEFAULT '',
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint not null default '0',
PRIMARY KEY ("id")
) COMMENT '文件表';
@ -82,6 +83,7 @@ CREATE TABLE IF NOT EXISTS "sys_dept" (
"updater" varchar(64) DEFAULT '',
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint not null default '0',
PRIMARY KEY ("id")
) COMMENT '部门表';
@ -189,6 +191,7 @@ CREATE TABLE IF NOT EXISTS `sys_user_session` (
`updater` varchar(64) DEFAULT '' ,
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint not null default '0',
PRIMARY KEY (`id`)
) COMMENT '用户在线 Session';
@ -204,6 +207,7 @@ CREATE TABLE IF NOT EXISTS "sys_post" (
"updater" varchar(64) DEFAULT '',
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint not null default '0',
PRIMARY KEY ("id")
) COMMENT '岗位信息表';
@ -218,7 +222,8 @@ CREATE TABLE IF NOT EXISTS "sys_notice" (
"updater" varchar(64) DEFAULT '' COMMENT '更新者',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
"deleted" bit NOT NULL DEFAULT 0 COMMENT '是否删除',
PRIMARY KEY("id")
"tenant_id" bigint not null default '0',
PRIMARY KEY("id")
) COMMENT '通知公告表';
CREATE TABLE IF NOT EXISTS `sys_login_log` (
@ -264,6 +269,7 @@ CREATE TABLE IF NOT EXISTS `sys_operate_log` (
`updater` varchar(64) DEFAULT '',
`update_time` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
`deleted` bit(1) NOT NULL DEFAULT '0',
"tenant_id" bigint not null default '0',
PRIMARY KEY (`id`)
) COMMENT ='操作日志记录';
@ -312,11 +318,12 @@ CREATE TABLE IF NOT EXISTS "inf_api_access_log" (
"updater" varchar(64) default '',
"update_time" timestamp not null default current_timestamp,
"deleted" bit not null default false,
"tenant_id" bigint not null default '0',
primary key ("id")
) COMMENT 'API 访问日志表';
CREATE TABLE IF NOT EXISTS "inf_api_error_log" (
"id" integer not null GENERATED BY DEFAULT AS IDENTITY,
"id" bigint not null GENERATED BY DEFAULT AS IDENTITY,
"trace_id" varchar(64) not null,
"user_id" bigint not null default '0',
"user_type" tinyint not null default '0',
@ -343,6 +350,7 @@ CREATE TABLE IF NOT EXISTS "inf_api_error_log" (
"updater" varchar(64) default '',
"update_time" timestamp not null default current_timestamp,
"deleted" bit not null default false,
"tenant_id" bigint not null default '0',
primary key ("id")
) COMMENT '系统异常日志';
@ -450,3 +458,17 @@ CREATE TABLE IF NOT EXISTS "sys_social_user" (
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '社交用户';
CREATE TABLE IF NOT EXISTS "sys_tenant" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"name" varchar(63) NOT NULL,
"contact_name" varchar(255) NOT NULL,
"contact_mobile" varchar(255),
"status" tinyint NOT NULL,
"creator" varchar(64) DEFAULT '',
"create_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar(64) DEFAULT '',
"update_time" timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
PRIMARY KEY ("id")
) COMMENT '租户';