From f2892a672a495a78562836561f51a2a274cd16aa Mon Sep 17 00:00:00 2001
From: WangBQ <wangbinglilac@sina.com>
Date: 星期一, 29 五月 2023 10:26:10 +0800
Subject: [PATCH] !349 代码生成 从对应数据源加载表结构信息 存储到主数据源 实现存储统一 * 数据库脚本修改,gen_table增加data_name字段,存储对应数据源名称 * 代码生成 从对应数据源加载表结构信息 存储到主数据源 实现存储统一(表结构需要增加对应的数据来源字段) https://gitee.com/…

---
 script/sql/ry_vue_5.X.sql |   53 ++++++++++++++++++++++++++++++-----------------------
 1 files changed, 30 insertions(+), 23 deletions(-)

diff --git a/script/sql/ry_vue_5.X.sql b/script/sql/ry_vue_5.X.sql
index da10377..713d962 100644
--- a/script/sql/ry_vue_5.X.sql
+++ b/script/sql/ry_vue_5.X.sql
@@ -62,7 +62,7 @@
 drop table if exists sys_dept;
 create table sys_dept (
   dept_id           bigint(20)      not null                   comment '閮ㄩ棬id',
-  tenant_id         varchar(20)     not null                   comment '绉熸埛缂栧彿',
+  tenant_id         varchar(20)     default '000000'           comment '绉熸埛缂栧彿',
   parent_id         bigint(20)      default 0                  comment '鐖堕儴闂╥d',
   ancestors         varchar(500)    default ''                 comment '绁栫骇鍒楄〃',
   dept_name         varchar(30)     default ''                 comment '閮ㄩ棬鍚嶇О',
@@ -103,7 +103,7 @@
 drop table if exists sys_user;
 create table sys_user (
   user_id           bigint(20)      not null                   comment '鐢ㄦ埛ID',
-  tenant_id         varchar(20)     not null                   comment '绉熸埛缂栧彿',
+  tenant_id         varchar(20)     default '000000'           comment '绉熸埛缂栧彿',
   dept_id           bigint(20)      default null               comment '閮ㄩ棬ID',
   user_name         varchar(30)     not null                   comment '鐢ㄦ埛璐﹀彿',
   nick_name         varchar(30)     not null                   comment '鐢ㄦ埛鏄电О',
@@ -140,7 +140,7 @@
 create table sys_post
 (
   post_id       bigint(20)      not null                   comment '宀椾綅ID',
-  tenant_id     varchar(20)     not null                   comment '绉熸埛缂栧彿',
+  tenant_id     varchar(20)     default '000000'           comment '绉熸埛缂栧彿',
   post_code     varchar(64)     not null                   comment '宀椾綅缂栫爜',
   post_name     varchar(50)     not null                   comment '宀椾綅鍚嶇О',
   post_sort     int(4)          not null                   comment '鏄剧ず椤哄簭',
@@ -169,7 +169,7 @@
 drop table if exists sys_role;
 create table sys_role (
   role_id              bigint(20)      not null                   comment '瑙掕壊ID',
-  tenant_id            varchar(20)     not null                   comment '绉熸埛缂栧彿',
+  tenant_id            varchar(20)     default '000000'           comment '绉熸埛缂栧彿',
   role_name            varchar(30)     not null                   comment '瑙掕壊鍚嶇О',
   role_key             varchar(100)    not null                   comment '瑙掕壊鏉冮檺瀛楃涓�',
   role_sort            int(4)          not null                   comment '鏄剧ず椤哄簭',
@@ -179,9 +179,9 @@
   status               char(1)         not null                   comment '瑙掕壊鐘舵�侊紙0姝e父 1鍋滅敤锛�',
   del_flag             char(1)         default '0'                comment '鍒犻櫎鏍囧織锛�0浠h〃瀛樺湪 2浠h〃鍒犻櫎锛�',
   create_dept          bigint(20)      default null               comment '鍒涘缓閮ㄩ棬',
-  create_by            varchar(64)     default null               comment '鍒涘缓鑰�',
+  create_by            bigint(20)      default null               comment '鍒涘缓鑰�',
   create_time          datetime                                   comment '鍒涘缓鏃堕棿',
-  update_by            varchar(64)     default null               comment '鏇存柊鑰�',
+  update_by            bigint(20)      default null               comment '鏇存柊鑰�',
   update_time          datetime                                   comment '鏇存柊鏃堕棿',
   remark               varchar(500)    default null               comment '澶囨敞',
   primary key (role_id)
@@ -230,7 +230,7 @@
 insert into sys_menu values('6', '绉熸埛绠$悊', '0', '2', 'tenant',           null, '', 1, 0, 'M', '0', '0', '', 'chart',    103, 1, sysdate(), null, null, '绉熸埛绠$悊鐩綍');
 insert into sys_menu values('2', '绯荤粺鐩戞帶', '0', '3', 'monitor',          null, '', 1, 0, 'M', '0', '0', '', 'monitor',  103, 1, sysdate(), null, null, '绯荤粺鐩戞帶鐩綍');
 insert into sys_menu values('3', '绯荤粺宸ュ叿', '0', '4', 'tool',             null, '', 1, 0, 'M', '0', '0', '', 'tool',     103, 1, sysdate(), null, null, '绯荤粺宸ュ叿鐩綍');
-insert into sys_menu values('4', 'PLUS瀹樼綉', '0', '5', 'https://gitee.com/JavaLionLi/RuoYi-Vue-Plus', null, '', 0, 0, 'M', '0', '0', '', 'guide',    103, 1, sysdate(), null, null, 'RuoYi-Vue-Plus瀹樼綉鍦板潃');
+insert into sys_menu values('4', 'PLUS瀹樼綉', '0', '5', 'https://gitee.com/dromara/RuoYi-Vue-Plus', null, '', 0, 0, 'M', '0', '0', '', 'guide',    103, 1, sysdate(), null, null, 'RuoYi-Vue-Plus瀹樼綉鍦板潃');
 -- 浜岀骇鑿滃崟
 insert into sys_menu values('100',  '鐢ㄦ埛绠$悊',     '1',   '1', 'user',             'system/user/index',            '', 1, 0, 'C', '0', '0', 'system:user:list',            'user',          103, 1, sysdate(), null, null, '鐢ㄦ埛绠$悊鑿滃崟');
 insert into sys_menu values('101',  '瑙掕壊绠$悊',     '1',   '2', 'role',             'system/role/index',            '', 1, 0, 'C', '0', '0', 'system:role:list',            'peoples',       103, 1, sysdate(), null, null, '瑙掕壊绠$悊鑿滃崟');
@@ -498,7 +498,7 @@
 drop table if exists sys_oper_log;
 create table sys_oper_log (
   oper_id           bigint(20)      not null                   comment '鏃ュ織涓婚敭',
-  tenant_id         varchar(20)     not null                   comment '绉熸埛缂栧彿',
+  tenant_id         varchar(20)     default '000000'           comment '绉熸埛缂栧彿',
   title             varchar(50)     default ''                 comment '妯″潡鏍囬',
   business_type     int(2)          default 0                  comment '涓氬姟绫诲瀷锛�0鍏跺畠 1鏂板 2淇敼 3鍒犻櫎锛�',
   method            varchar(100)    default ''                 comment '鏂规硶鍚嶇О',
@@ -514,7 +514,11 @@
   status            int(1)          default 0                  comment '鎿嶄綔鐘舵�侊紙0姝e父 1寮傚父锛�',
   error_msg         varchar(2000)   default ''                 comment '閿欒娑堟伅',
   oper_time         datetime                                   comment '鎿嶄綔鏃堕棿',
-  primary key (oper_id)
+  cost_time         bigint(20)      default 0                  comment '娑堣�楁椂闂�',
+  primary key (oper_id),
+  key idx_sys_oper_log_bt (business_type),
+  key idx_sys_oper_log_s  (status),
+  key idx_sys_oper_log_ot (oper_time)
 ) engine=innodb comment = '鎿嶄綔鏃ュ織璁板綍';
 
 
@@ -525,14 +529,14 @@
 create table sys_dict_type
 (
   dict_id          bigint(20)      not null                   comment '瀛楀吀涓婚敭',
-  tenant_id        varchar(20)     not null                   comment '绉熸埛缂栧彿',
+  tenant_id        varchar(20)     default '000000'           comment '绉熸埛缂栧彿',
   dict_name        varchar(100)    default ''                 comment '瀛楀吀鍚嶇О',
   dict_type        varchar(100)    default ''                 comment '瀛楀吀绫诲瀷',
   status           char(1)         default '0'                comment '鐘舵�侊紙0姝e父 1鍋滅敤锛�',
   create_dept      bigint(20)      default null               comment '鍒涘缓閮ㄩ棬',
-  create_by        varchar(64)     default null               comment '鍒涘缓鑰�',
+  create_by        bigint(20)      default null               comment '鍒涘缓鑰�',
   create_time      datetime                                   comment '鍒涘缓鏃堕棿',
-  update_by        varchar(64)     default null               comment '鏇存柊鑰�',
+  update_by        bigint(20)      default null               comment '鏇存柊鑰�',
   update_time      datetime                                   comment '鏇存柊鏃堕棿',
   remark           varchar(500)    default null               comment '澶囨敞',
   primary key (dict_id),
@@ -556,7 +560,7 @@
 create table sys_dict_data
 (
   dict_code        bigint(20)      not null                   comment '瀛楀吀缂栫爜',
-  tenant_id        varchar(20)     not null                   comment '绉熸埛缂栧彿',
+  tenant_id        varchar(20)     default '000000'           comment '绉熸埛缂栧彿',
   dict_sort        int(4)          default 0                  comment '瀛楀吀鎺掑簭',
   dict_label       varchar(100)    default ''                 comment '瀛楀吀鏍囩',
   dict_value       varchar(100)    default ''                 comment '瀛楀吀閿��',
@@ -566,9 +570,9 @@
   is_default       char(1)         default 'N'                comment '鏄惁榛樿锛圷鏄� N鍚︼級',
   status           char(1)         default '0'                comment '鐘舵�侊紙0姝e父 1鍋滅敤锛�',
   create_dept      bigint(20)      default null               comment '鍒涘缓閮ㄩ棬',
-  create_by        varchar(64)     default null               comment '鍒涘缓鑰�',
+  create_by        bigint(20)      default null               comment '鍒涘缓鑰�',
   create_time      datetime                                   comment '鍒涘缓鏃堕棿',
-  update_by        varchar(64)     default null               comment '鏇存柊鑰�',
+  update_by        bigint(20)      default null               comment '鏇存柊鑰�',
   update_time      datetime                                   comment '鏇存柊鏃堕棿',
   remark           varchar(500)    default null               comment '澶囨敞',
   primary key (dict_code)
@@ -607,7 +611,7 @@
 drop table if exists sys_config;
 create table sys_config (
   config_id         bigint(20)      not null                   comment '鍙傛暟涓婚敭',
-  tenant_id         varchar(20)    not null                    comment '绉熸埛缂栧彿',
+  tenant_id         varchar(20)     default '000000'           comment '绉熸埛缂栧彿',
   config_name       varchar(100)    default ''                 comment '鍙傛暟鍚嶇О',
   config_key        varchar(100)    default ''                 comment '鍙傛暟閿悕',
   config_value      varchar(500)    default ''                 comment '鍙傛暟閿��',
@@ -634,7 +638,7 @@
 drop table if exists sys_logininfor;
 create table sys_logininfor (
   info_id        bigint(20)     not null                  comment '璁块棶ID',
-  tenant_id      varchar(20)    not null                  comment '绉熸埛缂栧彿',
+  tenant_id      varchar(20)    default '000000'          comment '绉熸埛缂栧彿',
   user_name      varchar(50)    default ''                comment '鐢ㄦ埛璐﹀彿',
   ipaddr         varchar(128)   default ''                comment '鐧诲綍IP鍦板潃',
   login_location varchar(255)   default ''                comment '鐧诲綍鍦扮偣',
@@ -643,7 +647,9 @@
   status         char(1)        default '0'               comment '鐧诲綍鐘舵�侊紙0鎴愬姛 1澶辫触锛�',
   msg            varchar(255)   default ''                comment '鎻愮ず娑堟伅',
   login_time     datetime                                 comment '璁块棶鏃堕棿',
-  primary key (info_id)
+  primary key (info_id),
+  key idx_sys_logininfor_s  (status),
+  key idx_sys_logininfor_lt (login_time)
 ) engine=innodb comment = '绯荤粺璁块棶璁板綍';
 
 
@@ -653,7 +659,7 @@
 drop table if exists sys_notice;
 create table sys_notice (
   notice_id         bigint(20)      not null                   comment '鍏憡ID',
-  tenant_id         varchar(20)     not null                   comment '绉熸埛缂栧彿',
+  tenant_id         varchar(20)     default '000000'           comment '绉熸埛缂栧彿',
   notice_title      varchar(50)     not null                   comment '鍏憡鏍囬',
   notice_type       char(1)         not null                   comment '鍏憡绫诲瀷锛�1閫氱煡 2鍏憡锛�',
   notice_content    longblob        default null               comment '鍏憡鍐呭',
@@ -680,6 +686,7 @@
 drop table if exists gen_table;
 create table gen_table (
   table_id          bigint(20)      not null                   comment '缂栧彿',
+  data_name         varchar(200)    default ''                 comment '鏁版嵁婧愬悕绉�',
   table_name        varchar(200)    default ''                 comment '琛ㄥ悕绉�',
   table_comment     varchar(500)    default ''                 comment '琛ㄦ弿杩�',
   sub_table_name    varchar(64)     default null               comment '鍏宠仈瀛愯〃鐨勮〃鍚�',
@@ -741,7 +748,7 @@
 drop table if exists sys_oss;
 create table sys_oss (
   oss_id          bigint(20)   not null                   comment '瀵硅薄瀛樺偍涓婚敭',
-  tenant_id       varchar(20)  not null                   comment '绉熸埛缂栧彿',
+  tenant_id       varchar(20)           default '000000'  comment '绉熸埛缂栧彿',
   file_name       varchar(255) not null default ''        comment '鏂囦欢鍚�',
   original_name   varchar(255) not null default ''        comment '鍘熷悕',
   file_suffix     varchar(10)  not null default ''        comment '鏂囦欢鍚庣紑鍚�',
@@ -761,7 +768,7 @@
 drop table if exists sys_oss_config;
 create table sys_oss_config (
   oss_config_id   bigint(20)    not null                  comment '涓诲缓',
-  tenant_id       varchar(20)   not null                  comment '绉熸埛缂栧彿',
+  tenant_id       varchar(20)             default '000000'comment '绉熸埛缂栧彿',
   config_key      varchar(20)   not null  default ''      comment '閰嶇疆key',
   access_key      varchar(255)            default ''      comment 'accessKey',
   secret_key      varchar(255)            default ''      comment '绉橀挜',
@@ -772,14 +779,14 @@
   is_https        char(1)                 default 'N'     comment '鏄惁https锛圷=鏄�,N=鍚︼級',
   region          varchar(255)            default ''      comment '鍩�',
   access_policy   char(1)       not null  default '1'     comment '妗舵潈闄愮被鍨�(0=private 1=public 2=custom)',
-  status          char(1)                 default '1'     comment '鐘舵�侊紙0=姝e父,1=鍋滅敤锛�',
+  status          char(1)                 default '1'     comment '鏄惁榛樿锛�0=鏄�,1=鍚︼級',
   ext1            varchar(255)            default ''      comment '鎵╁睍瀛楁',
   create_dept     bigint(20)              default null    comment '鍒涘缓閮ㄩ棬',
   create_by       bigint(20)              default null    comment '鍒涘缓鑰�',
   create_time     datetime                default null    comment '鍒涘缓鏃堕棿',
   update_by       bigint(20)              default null    comment '鏇存柊鑰�',
   update_time     datetime                default null    comment '鏇存柊鏃堕棿',
-  remark           varchar(500)           default null    comment '澶囨敞',
+  remark          varchar(500)            default null    comment '澶囨敞',
   primary key (oss_config_id)
 ) engine=innodb comment='瀵硅薄瀛樺偍閰嶇疆琛�';
 

--
Gitblit v1.9.3