支持多层级租户,租户父子关系依托与组织机构的父子关系

This commit is contained in:
陈博文
2025-06-20 08:50:06 +08:00
parent f7241a843d
commit 3730c07a44
33 changed files with 808 additions and 306 deletions

View File

@@ -0,0 +1,32 @@
-- 用户-租户关系表
create table "RUOYI-VUE-PRO".SYSTEM_USER_TENANT
(
ID BIGINT not null,
USER_ID BIGINT not null,
TENANT_ID BIGINT not null,
CREATOR VARCHAR(256) default '',
CREATE_TIME TIMESTAMP default CURRENT_TIMESTAMP not null,
UPDATER VARCHAR(256) default '',
UPDATE_TIME TIMESTAMP default CURRENT_TIMESTAMP not null,
DELETED TINYINT default 0 not null
);
comment on table "RUOYI-VUE-PRO".SYSTEM_USER_TENANT is '用户-租户关系表';
comment on column "RUOYI-VUE-PRO".SYSTEM_USER_TENANT.ID is '主键ID';
comment on column "RUOYI-VUE-PRO".SYSTEM_USER_TENANT.USER_ID is '用户ID';
comment on column "RUOYI-VUE-PRO".SYSTEM_USER_TENANT.TENANT_ID is '租户ID';
comment on column "RUOYI-VUE-PRO".SYSTEM_USER_TENANT.CREATOR is '创建者';
comment on column "RUOYI-VUE-PRO".SYSTEM_USER_TENANT.CREATE_TIME is '创建时间';
comment on column "RUOYI-VUE-PRO".SYSTEM_USER_TENANT.UPDATER is '更新者';
comment on column "RUOYI-VUE-PRO".SYSTEM_USER_TENANT.UPDATE_TIME is '更新时间';
comment on column "RUOYI-VUE-PRO".SYSTEM_USER_TENANT.DELETED is '是否删除';
create unique index "RUOYI-VUE-PRO".IDX_SYSTEM_USER_TENANT_ID
on "RUOYI-VUE-PRO".SYSTEM_USER_TENANT (ID);
create unique index "RUOYI-VUE-PRO".IDX_SYSTEM_USER_TENANT_UNIQUE
on "RUOYI-VUE-PRO".SYSTEM_USER_TENANT (USER_ID, TENANT_ID);
alter table "RUOYI-VUE-PRO".SYSTEM_USER_TENANT
add constraint PK_SYSTEM_USER_TENANT_ID
primary key (ID);

View File

@@ -0,0 +1,6 @@
alter table "RUOYI-VUE-PRO".SYSTEM_DEPT
add IS_TENANT TINYINT default false not null;
comment
on column "RUOYI-VUE-PRO".SYSTEM_DEPT.IS_TENANT is '组织机构是否为租户';

View File

@@ -30,4 +30,7 @@ create unique index "RUOYI-VUE-PRO".IDX_ROLE_MENU_EXCLUSION_ID
alter table "RUOYI-VUE-PRO".SYSTEM_ROLE_MENU_EXCLUSION
add constraint PK_ROLE_MENU_EXCLUSION_ID
primary key (ID);
primary key (ID);
alter table "RUOYI-VUE-PRO".SYSTEM_ROLE
add PARENT_ID BIGINT default 0 not null;