Explorar el Código

Update 优化Sql

YueYunyun hace 2 años
padre
commit
f7045f04f1

+ 0 - 5
SERVER/YanZhongXYH/script/sql/UpdateUser20231230.sql

@@ -1,5 +0,0 @@
-USE `YanZhongXYH`;
-ALTER TABLE sys_user
-    ADD COLUMN union_id varchar(50) DEFAULT NULL COMMENT '在WX开放平台的唯一标识符' AFTER login_date;
-ALTER TABLE sys_user
-    ADD COLUMN open_id varchar(50) DEFAULT NULL COMMENT 'WX用户唯一标识' AFTER login_date;

+ 42 - 10
SERVER/YanZhongXYH/script/sql/XYHSQL.sql

@@ -9,7 +9,7 @@ SET FOREIGN_KEY_CHECKS = 0;
 drop table if exists am_alumnus;
 drop table if exists am_alumnus;
 create table am_alumnus
 create table am_alumnus
 (
 (
-    am_id         bigint(20)  not null comment '校友id',
+    am_id         bigint(20)  not null AUTO_INCREMENT comment '校友id',
     user_id       bigint(20)  not null comment '用户id',
     user_id       bigint(20)  not null comment '用户id',
     name          varchar(30) not null comment '姓名',
     name          varchar(30) not null comment '姓名',
     gender        char(1)     not null comment '性别',
     gender        char(1)     not null comment '性别',
@@ -67,13 +67,14 @@ create table am_alumnus_ex
 drop table if exists am_study;
 drop table if exists am_study;
 create table am_study
 create table am_study
 (
 (
+    study_id         bigint(20)  not null comment '校友id',
     am_id         bigint(20)  not null comment '校友id',
     am_id         bigint(20)  not null comment '校友id',
     study         varchar(30) not null comment '专业名称',
     study         varchar(30) not null comment '专业名称',
     enrol_year    char(4)     not null comment '入学年份',
     enrol_year    char(4)     not null comment '入学年份',
     graduate_year char(4)     not null comment '毕业年份',
     graduate_year char(4)     not null comment '毕业年份',
     create_by     varchar(64) default '' comment '创建者',
     create_by     varchar(64) default '' comment '创建者',
     create_time   datetime comment '创建时间',
     create_time   datetime comment '创建时间',
-    primary key (am_id, friend_id)
+    primary key (study_id)
 ) engine = innodb
 ) engine = innodb
   auto_increment = 100 comment = '学习经历信息';
   auto_increment = 100 comment = '学习经历信息';
 
 
@@ -96,10 +97,10 @@ create table am_friends
 -- ----------------------------
 -- ----------------------------
 -- 5、好友申请信息
 -- 5、好友申请信息
 -- ----------------------------
 -- ----------------------------
-drop table if exists am_friends;
-create table am_friends
+drop table if exists am_friends_apply;
+create table am_friends_apply
 (
 (
-    apply_id    bigint(20) not null comment 'id',
+    apply_id    bigint(20) not null AUTO_INCREMENT comment 'id',
     am_id       bigint(20) not null comment '校友id',
     am_id       bigint(20) not null comment '校友id',
     friend_id   bigint(20) not null comment '好友id',
     friend_id   bigint(20) not null comment '好友id',
     status      char(4)      default 0 comment '状态(0申请中 1通过 2拒绝)',
     status      char(4)      default 0 comment '状态(0申请中 1通过 2拒绝)',
@@ -132,7 +133,7 @@ create table am_news
 -- ----------------------------
 -- ----------------------------
 -- 7、活动信息
 -- 7、活动信息
 -- ----------------------------
 -- ----------------------------
-drop table if exists am_activit;
+drop table if exists am_activity;
 create table am_activity
 create table am_activity
 (
 (
     activity_id   char(20)     not null comment '活动id',
     activity_id   char(20)     not null comment '活动id',
@@ -159,7 +160,7 @@ create table am_activity
 drop table if exists am_activity_apply;
 drop table if exists am_activity_apply;
 create table am_activity_apply
 create table am_activity_apply
 (
 (
-    apply_id     bigint(20) not null comment 'id',
+    apply_id     bigint(20) not null AUTO_INCREMENT comment 'id',
     activity_id  char(20)   not null comment '活动id',
     activity_id  char(20)   not null comment '活动id',
     audit_status char(4)        default 0 comment '状态(1申请中 2通过 3拒绝)',
     audit_status char(4)        default 0 comment '状态(1申请中 2通过 3拒绝)',
     audit_time   datetime comment '创建时间',
     audit_time   datetime comment '创建时间',
@@ -220,7 +221,7 @@ create table am_comment
 drop table if exists am_attach;
 drop table if exists am_attach;
 create table am_attach
 create table am_attach
 (
 (
-    att_id      bigint(20)   not null comment '附件id',
+    att_id      bigint(20)   not null AUTO_INCREMENT comment '附件id',
     source_id   char(20)     not null comment '源id',
     source_id   char(20)     not null comment '源id',
     source_type char(20)     default '' comment '源类型',
     source_type char(20)     default '' comment '源类型',
     file_type   char(1)      not null comment '附件类型(1图片 2视频)',
     file_type   char(1)      not null comment '附件类型(1图片 2视频)',
@@ -229,7 +230,7 @@ create table am_attach
     create_by   varchar(64)  default '' comment '创建者',
     create_by   varchar(64)  default '' comment '创建者',
     create_time datetime comment '创建时间',
     create_time datetime comment '创建时间',
     remark      varchar(500) default null comment '备注',
     remark      varchar(500) default null comment '备注',
-    primary key (apply_id)
+    primary key (att_id)
 ) engine = innodb
 ) engine = innodb
   auto_increment = 100 comment = '图片附件信息';
   auto_increment = 100 comment = '图片附件信息';
 
 
@@ -271,15 +272,46 @@ create table am_follow
 drop table if exists sys_category;
 drop table if exists sys_category;
 create table sys_category
 create table sys_category
 (
 (
-    category_id   bigint(20)  not null comment '类别id',
+    category_id   bigint(20)  not null AUTO_INCREMENT comment '类别id',
     parent_id     bigint(20)   default '0' comment '父类别id',
     parent_id     bigint(20)   default '0' comment '父类别id',
     category_name varchar(20) not null comment '类别名称',
     category_name varchar(20) not null comment '类别名称',
     category_type char(4)     not null comment '类别类型',
     category_type char(4)     not null comment '类别类型',
+    sort  int(4)   default 0 comment '类别排序',
     status        char(1)      default '0' comment '类别状态(0禁用 1启用)',
     status        char(1)      default '0' comment '类别状态(0禁用 1启用)',
     remark        varchar(500) default null comment '备注',
     remark        varchar(500) default null comment '备注',
     primary key (category_id)
     primary key (category_id)
 ) engine = innodb comment = '类别信息';
 ) engine = innodb comment = '类别信息';
 
 
+insert into sys_category values (1, 0, '要闻', 'N', 1,'1', null);
+insert into sys_category values (2, 0, '通知', 'N', 2,'1', null);
+insert into sys_category values (3, 0, '校友风采', 'N', 3,'1', null);
+insert into sys_category values (4, 0, '校企展示', 'N', 4,'1', null);
+insert into sys_category values (5, 0, '盐中新闻', 'N', 5,'1', null);
+insert into sys_category values (6, 0, '其他', 'A', 6,'1', null);
+
+insert into sys_category values (20, 0, '文体娱乐', 'A', 1,'1', null);
+insert into sys_category values (21, 0, '户外活动', 'A', 2,'1', null);
+insert into sys_category values (22, 0, '闲聊小聚', 'A', 3,'1', null);
+insert into sys_category values (23, 0, '创业碰撞', 'A', 4,'1', null);
+insert into sys_category values (24, 0, '公益活动', 'A', 5,'1', null);
+insert into sys_category values (25, 0, '旅游度假', 'A', 6,'1', null);
+insert into sys_category values (26, 0, '摄影摄像', 'A', 7,'1', null);
+insert into sys_category values (27, 0, '校友聚会', 'A', 8,'1', null);
+insert into sys_category values (28, 0, '教育培训', 'A', 9,'1', null);
+insert into sys_category values (29, 0, '学术活动', 'A', 10,'1', null);
+insert into sys_category values (30, 0, '游戏动漫', 'A', 11,'1', null);
+insert into sys_category values (31, 0, '线上会议', 'A', 12,'1', null);
+insert into sys_category values (32, 0, '其他', 'A', 13,'1', null);
+
+insert into sys_category values (50, 0, '创业合作', 'H', 1,'1', null);
+insert into sys_category values (51, 0, '资源合作', 'H', 2,'1', null);
+insert into sys_category values (52, 0, '招聘求职', 'H', 3,'1', null);
+insert into sys_category values (53, 0, '企业推介', 'H', 4,'1', null);
+insert into sys_category values (54, 0, '供应采购', 'H', 5,'1', null);
+insert into sys_category values (55, 0, '商务合作', 'H', 6,'1', null);
+insert into sys_category values (56, 0, '服务咨询', 'H', 7,'1', null);
+insert into sys_category values (57, 0, '二手交易', 'H', 8,'1', null);
+insert into sys_category values (58, 0, '其他', 'H', 9,'1', null);
 
 
 
 
 SET FOREIGN_KEY_CHECKS = 1;
 SET FOREIGN_KEY_CHECKS = 1;

+ 28 - 21
SERVER/YanZhongXYH/script/sql/YanZhongXYH.sql

@@ -11,7 +11,7 @@ SET FOREIGN_KEY_CHECKS = 0;
 drop table if exists sys_org;
 drop table if exists sys_org;
 create table sys_org
 create table sys_org
 (
 (
-    org_id      bigint(20) not null comment '组织结构id',
+    org_id      bigint(20) not null AUTO_INCREMENT comment '组织结构id',
     parent_id   bigint(20)   default 0 comment '父组织结构id',
     parent_id   bigint(20)   default 0 comment '父组织结构id',
     ancestors   varchar(500) default '' comment '祖级列表',
     ancestors   varchar(500) default '' comment '祖级列表',
     org_name    varchar(30)  default '' comment '组织结构名称',
     org_name    varchar(30)  default '' comment '组织结构名称',
@@ -68,7 +68,7 @@ values (108, 100, '0,100', '海外校友会', 8, '宋', '15888888888', 'vber@iwb
 drop table if exists sys_user;
 drop table if exists sys_user;
 create table sys_user
 create table sys_user
 (
 (
-    user_id     bigint(20)  not null comment '用户ID',
+    user_id     bigint(20)  not null AUTO_INCREMENT comment '用户ID',
     org_id      bigint(20)   default null comment '组织结构ID',
     org_id      bigint(20)   default null comment '组织结构ID',
     user_name   varchar(30) not null comment '用户账号',
     user_name   varchar(30) not null comment '用户账号',
     nick_name   varchar(30) not null comment '用户昵称',
     nick_name   varchar(30) not null comment '用户昵称',
@@ -82,6 +82,8 @@ create table sys_user
     del_flag    char(1)      default '0' comment '删除标志(0代表存在 2代表删除)',
     del_flag    char(1)      default '0' comment '删除标志(0代表存在 2代表删除)',
     login_ip    varchar(128) default '' comment '最后登录IP',
     login_ip    varchar(128) default '' comment '最后登录IP',
     login_date  datetime comment '最后登录时间',
     login_date  datetime comment '最后登录时间',
+    union_id    varchar(50)  DEFAULT NULL COMMENT '在WX开放平台的唯一标识符',
+    open_id     varchar(50)  DEFAULT NULL COMMENT 'WX用户唯一标识',
     create_by   varchar(64)  default '' comment '创建者',
     create_by   varchar(64)  default '' comment '创建者',
     create_time datetime comment '创建时间',
     create_time datetime comment '创建时间',
     update_by   varchar(64)  default '' comment '更新者',
     update_by   varchar(64)  default '' comment '更新者',
@@ -96,21 +98,22 @@ create table sys_user
 -- ----------------------------
 -- ----------------------------
 insert into sys_user
 insert into sys_user
 values (1, 100, 'admin', 'Admin', 'sys_user', 'admin@iwbnet.com', '15888888888', '1', '',
 values (1, 100, 'admin', 'Admin', 'sys_user', 'admin@iwbnet.com', '15888888888', '1', '',
-        '$2a$10$cIq6acwdCeA4O2us8al1..GznPKoB9Ds1jmutg8JsUupHxtchlQF6', '0', '0', '127.0.0.1', sysdate(), 'admin',
+        '$2a$10$cIq6acwdCeA4O2us8al1..GznPKoB9Ds1jmutg8JsUupHxtchlQF6', '0', '0', '127.0.0.1', sysdate(), null, null,
+        'admin',
         sysdate(), '', null, '管理员');
         sysdate(), '', null, '管理员');
 insert into sys_user
 insert into sys_user
 values (2, 100, 'system', 'System', 'sys_user', 'system@iwbnet.com', '15666666666', '1', '',
 values (2, 100, 'system', 'System', 'sys_user', 'system@iwbnet.com', '15666666666', '1', '',
-        '$2a$10$CS9QMV5DdFObCECq.hEcwe9Lv0KzNHmBiUU7B6twemY31qKTRy4O.', '0', '0', '127.0.0.1', sysdate(), 'admin',
+        '$2a$10$CS9QMV5DdFObCECq.hEcwe9Lv0KzNHmBiUU7B6twemY31qKTRy4O.', '0', '0', '127.0.0.1', sysdate(), null, null,
+        'admin',
         sysdate(), '', null, '测试员');
         sysdate(), '', null, '测试员');
 
 
-
 -- ----------------------------
 -- ----------------------------
 -- 3、行业/兴趣分会分会信息表
 -- 3、行业/兴趣分会分会信息表
 -- ----------------------------
 -- ----------------------------
 drop table if exists sys_post;
 drop table if exists sys_post;
 create table sys_post
 create table sys_post
 (
 (
-    post_id     bigint(20)  not null comment '行业/兴趣分会ID',
+    post_id     bigint(20)  not null AUTO_INCREMENT comment '行业/兴趣分会ID',
     post_type   int(4)      not null comment '行业/兴趣分会类型(0行业 1兴趣)',
     post_type   int(4)      not null comment '行业/兴趣分会类型(0行业 1兴趣)',
     post_name   varchar(50) not null comment '行业/兴趣分会名称',
     post_name   varchar(50) not null comment '行业/兴趣分会名称',
     post_sort   int(4)      not null comment '显示顺序',
     post_sort   int(4)      not null comment '显示顺序',
@@ -136,7 +139,6 @@ values (3, 1, '乒乓球分会', 3, '0', 'admin', sysdate(), '', null, '');
 insert into sys_post
 insert into sys_post
 values (4, 1, '羽毛球分会', 4, '0', 'admin', sysdate(), '', null, '');
 values (4, 1, '羽毛球分会', 4, '0', 'admin', sysdate(), '', null, '');
 
 
-
 -- ----------------------------
 -- ----------------------------
 -- 4、角色信息表
 -- 4、角色信息表
 -- ----------------------------
 -- ----------------------------
@@ -169,14 +171,13 @@ values ('1', '超级管理员', 'admin', 1, 1, 1, 1, '0', '0', 'admin', sysdate(
 insert into sys_role
 insert into sys_role
 values ('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色');
 values ('2', '普通角色', 'common', 2, 2, 1, 1, '0', '0', 'admin', sysdate(), '', null, '普通角色');
 
 
-
 -- ----------------------------
 -- ----------------------------
 -- 5、菜单权限表
 -- 5、菜单权限表
 -- ----------------------------
 -- ----------------------------
 drop table if exists sys_menu;
 drop table if exists sys_menu;
 create table sys_menu
 create table sys_menu
 (
 (
-    menu_id     bigint(20)  not null comment '菜单ID',
+    menu_id     bigint(20)  not null AUTO_INCREMENT comment '菜单ID',
     menu_name   varchar(50) not null comment '菜单名称',
     menu_name   varchar(50) not null comment '菜单名称',
     parent_id   bigint(20)   default 0 comment '父菜单ID',
     parent_id   bigint(20)   default 0 comment '父菜单ID',
     order_num   int(4)       default 0 comment '显示顺序',
     order_num   int(4)       default 0 comment '显示顺序',
@@ -428,13 +429,14 @@ insert into sys_menu
 values ('1048', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', '', '',
 values ('1048', '单条强退', '109', '3', '#', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', '', '',
         'admin', sysdate(), '', null, '');
         'admin', sysdate(), '', null, '');
 
 
+
 -- ----------------------------
 -- ----------------------------
 -- 6、用户和角色关联表  用户N-1角色
 -- 6、用户和角色关联表  用户N-1角色
 -- ----------------------------
 -- ----------------------------
 drop table if exists sys_user_role;
 drop table if exists sys_user_role;
 create table sys_user_role
 create table sys_user_role
 (
 (
-    user_id bigint(20) not null comment '用户ID',
+    user_id bigint(20) not null AUTO_INCREMENT comment '用户ID',
     role_id bigint(20) not null comment '角色ID',
     role_id bigint(20) not null comment '角色ID',
     primary key (user_id, role_id)
     primary key (user_id, role_id)
 ) engine = innodb comment = '用户和角色关联表';
 ) engine = innodb comment = '用户和角色关联表';
@@ -669,7 +671,7 @@ values ('2', '2');
 drop table if exists sys_oper_log;
 drop table if exists sys_oper_log;
 create table sys_oper_log
 create table sys_oper_log
 (
 (
-    oper_id        bigint(20) not null comment '日志主键',
+    oper_id        bigint(20) not null AUTO_INCREMENT comment '日志主键',
     title          varchar(50)   default '' comment '模块标题',
     title          varchar(50)   default '' comment '模块标题',
     business_type  int(2)        default 0 comment '业务类型(0其它 1新增 2修改 3删除)',
     business_type  int(2)        default 0 comment '业务类型(0其它 1新增 2修改 3删除)',
     method         varchar(100)  default '' comment '方法名称',
     method         varchar(100)  default '' comment '方法名称',
@@ -691,14 +693,13 @@ create table sys_oper_log
     key idx_sys_oper_log_ot (oper_time)
     key idx_sys_oper_log_ot (oper_time)
 ) engine = innodb comment = '操作日志记录';
 ) engine = innodb comment = '操作日志记录';
 
 
-
 -- ----------------------------
 -- ----------------------------
 -- 11、字典类型表
 -- 11、字典类型表
 -- ----------------------------
 -- ----------------------------
 drop table if exists sys_dict_type;
 drop table if exists sys_dict_type;
 create table sys_dict_type
 create table sys_dict_type
 (
 (
-    dict_id     bigint(20) not null comment '字典主键',
+    dict_id     bigint(20) not null AUTO_INCREMENT comment '字典主键',
     dict_name   varchar(100) default '' comment '字典名称',
     dict_name   varchar(100) default '' comment '字典名称',
     dict_type   varchar(100) default '' comment '字典类型',
     dict_type   varchar(100) default '' comment '字典类型',
     status      char(1)      default '0' comment '状态(0正常 1停用)',
     status      char(1)      default '0' comment '状态(0正常 1停用)',
@@ -732,7 +733,8 @@ insert into sys_dict_type
 values (11, '分会类型', 'sys_branch_type', '0', 'admin', sysdate(), '', null, '行业/兴趣分会类型');
 values (11, '分会类型', 'sys_branch_type', '0', 'admin', sysdate(), '', null, '行业/兴趣分会类型');
 insert into sys_dict_type
 insert into sys_dict_type
 values (12, '校友身份', 'am_alumnus_type', '0', 'admin', sysdate(), '', null, '校友类型');
 values (12, '校友身份', 'am_alumnus_type', '0', 'admin', sysdate(), '', null, '校友类型');
-
+insert into sys_dict_type
+values (13, '类目名称', 'category_type', '0', 'admin', sysdate(), '', null, '校友类型');
 
 
 -- ----------------------------
 -- ----------------------------
 -- 12、字典数据表
 -- 12、字典数据表
@@ -740,7 +742,7 @@ values (12, '校友身份', 'am_alumnus_type', '0', 'admin', sysdate(), '', null
 drop table if exists sys_dict_data;
 drop table if exists sys_dict_data;
 create table sys_dict_data
 create table sys_dict_data
 (
 (
-    dict_code   bigint(20) not null comment '字典编码',
+    dict_code   bigint(20) not null AUTO_INCREMENT comment '字典编码',
     dict_sort   int(4)       default 0 comment '字典排序',
     dict_sort   int(4)       default 0 comment '字典排序',
     dict_label  varchar(100) default '' comment '字典标签',
     dict_label  varchar(100) default '' comment '字典标签',
     dict_value  varchar(100) default '' comment '字典键值',
     dict_value  varchar(100) default '' comment '字典键值',
@@ -821,6 +823,12 @@ values (35, 3, '校友及教职工', '2', 'am_alumnus_type', '', 'danger', 'N',
         '既是校友又是教职工');
         '既是校友又是教职工');
 insert into sys_dict_data
 insert into sys_dict_data
 values (36, 4, '其他', '3', 'am_alumnus_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '其他人员');
 values (36, 4, '其他', '3', 'am_alumnus_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '其他人员');
+insert into sys_dict_data
+values (37, 1, '新闻资讯', 'N', 'category_type', '', 'info', 'N', '0', 'admin', sysdate(), '', null, '新闻资讯');
+insert into sys_dict_data
+values (38, 2, '活动资讯', 'A', 'category_type', '', 'primary', 'N', '0', 'admin', sysdate(), '', null, '活动资讯');
+insert into sys_dict_data
+values (39, 3, '校友互助', 'H', 'category_type', '', 'danger', 'N', '0', 'admin', sysdate(), '', null, '互助信息');
 
 
 
 
 -- ----------------------------
 -- ----------------------------
@@ -829,7 +837,7 @@ values (36, 4, '其他', '3', 'am_alumnus_type', '', 'info', 'N', '0', 'admin',
 drop table if exists sys_config;
 drop table if exists sys_config;
 create table sys_config
 create table sys_config
 (
 (
-    config_id    bigint(20) not null comment '参数主键',
+    config_id    bigint(20) not null AUTO_INCREMENT comment '参数主键',
     config_name  varchar(100) default '' comment '参数名称',
     config_name  varchar(100) default '' comment '参数名称',
     config_key   varchar(100) default '' comment '参数键名',
     config_key   varchar(100) default '' comment '参数键名',
     config_value varchar(500) default '' comment '参数键值',
     config_value varchar(500) default '' comment '参数键值',
@@ -860,7 +868,7 @@ values (3, '账号自助-是否开启用户注册功能', 'sys.account.registerU
 drop table if exists sys_logininfor;
 drop table if exists sys_logininfor;
 create table sys_logininfor
 create table sys_logininfor
 (
 (
-    info_id        bigint(20) not null comment '访问ID',
+    info_id        bigint(20) not null AUTO_INCREMENT comment '访问ID',
     user_name      varchar(50)  default '' comment '用户账号',
     user_name      varchar(50)  default '' comment '用户账号',
     ipaddr         varchar(128) default '' comment '登录IP地址',
     ipaddr         varchar(128) default '' comment '登录IP地址',
     login_location varchar(255) default '' comment '登录地点',
     login_location varchar(255) default '' comment '登录地点',
@@ -881,7 +889,7 @@ create table sys_logininfor
 drop table if exists sys_notice;
 drop table if exists sys_notice;
 create table sys_notice
 create table sys_notice
 (
 (
-    notice_id      bigint(20)  not null comment '公告ID',
+    notice_id      bigint(20)  not null AUTO_INCREMENT comment '公告ID',
     notice_title   varchar(50) not null comment '公告标题',
     notice_title   varchar(50) not null comment '公告标题',
     notice_type    char(1)     not null comment '公告类型(1通知 2公告)',
     notice_type    char(1)     not null comment '公告类型(1通知 2公告)',
     notice_content longblob     default null comment '公告内容',
     notice_content longblob     default null comment '公告内容',
@@ -902,14 +910,13 @@ values ('1', '温馨提醒:2018-07-01 新版本发布啦', '2', '新版本内
 insert into sys_notice
 insert into sys_notice
 values ('2', '维护通知:2018-07-01 系统凌晨维护', '1', '维护内容', '0', 'admin', sysdate(), '', null, '管理员');
 values ('2', '维护通知:2018-07-01 系统凌晨维护', '1', '维护内容', '0', 'admin', sysdate(), '', null, '管理员');
 
 
-
 -- ----------------------------
 -- ----------------------------
 -- 18、代码生成业务表
 -- 18、代码生成业务表
 -- ----------------------------
 -- ----------------------------
 drop table if exists gen_table;
 drop table if exists gen_table;
 create table gen_table
 create table gen_table
 (
 (
-    table_id          bigint(20) not null comment '编号',
+    table_id          bigint(20) not null AUTO_INCREMENT comment '编号',
     table_name        varchar(200) default '' comment '表名称',
     table_name        varchar(200) default '' comment '表名称',
     table_comment     varchar(500) default '' comment '表描述',
     table_comment     varchar(500) default '' comment '表描述',
     sub_table_name    varchar(64)  default null comment '关联子表的表名',
     sub_table_name    varchar(64)  default null comment '关联子表的表名',
@@ -939,7 +946,7 @@ create table gen_table
 drop table if exists gen_table_column;
 drop table if exists gen_table_column;
 create table gen_table_column
 create table gen_table_column
 (
 (
-    column_id      bigint(20) not null comment '编号',
+    column_id      bigint(20) not null AUTO_INCREMENT comment '编号',
     table_id       bigint(20) comment '归属表编号',
     table_id       bigint(20) comment '归属表编号',
     column_name    varchar(200) comment '列名称',
     column_name    varchar(200) comment '列名称',
     column_comment varchar(500) comment '列描述',
     column_comment varchar(500) comment '列描述',