|
@@ -1,90 +1,141 @@
|
|
|
/*==============================================================*/
|
|
|
/* DBMS name: MySQL 5.0 */
|
|
|
-/* Created on: 2019/3/5 22:17:43 */
|
|
|
+/* Created on: 2019/3/10 10:03:43 */
|
|
|
/*==============================================================*/
|
|
|
|
|
|
|
|
|
-drop table if exists action_bar;
|
|
|
+drop table if exists action_bars;
|
|
|
|
|
|
-drop table if exists action_permission;
|
|
|
+drop table if exists group_users;
|
|
|
|
|
|
-drop table if exists user_permission;
|
|
|
+drop table if exists groups;
|
|
|
|
|
|
-drop table if exists user;
|
|
|
+drop table if exists user_action_bars;
|
|
|
+
|
|
|
+drop table if exists user_roles;
|
|
|
+
|
|
|
+drop table if exists users;
|
|
|
|
|
|
/*==============================================================*/
|
|
|
-/* Table: action_bar */
|
|
|
+/* Table: action_bars */
|
|
|
/*==============================================================*/
|
|
|
-create table action_bar
|
|
|
+create table action_bars
|
|
|
(
|
|
|
id int not null auto_increment,
|
|
|
parent int default 0 comment '该层菜单的上级菜单',
|
|
|
level int default 1 comment '该级菜单是第几级菜单',
|
|
|
+ name varchar(128),
|
|
|
+ description varchar(255),
|
|
|
+ icon varchar(255),
|
|
|
link_type char(32) comment '定义link的含义,可以是跳转,可以是发起请求',
|
|
|
link char(255),
|
|
|
- status char(32) comment '状态表,可能用户编辑了这个菜单,但是没有编辑完,所以只是存了一份草稿',
|
|
|
- create_time timestamp default CURRENT_TIMESTAMP,
|
|
|
- modify_time timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
+ status char(32) default 'normal' comment '状态表,可能用户编辑了这个菜单,但是没有编辑完,所以只是存了一份草稿',
|
|
|
+ created_at timestamp default CURRENT_TIMESTAMP,
|
|
|
+ updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
+ created_user_id int,
|
|
|
+ updated_user_id int,
|
|
|
is_del bool default false,
|
|
|
primary key (id)
|
|
|
);
|
|
|
|
|
|
-alter table action_bar comment '下拉菜单';
|
|
|
+alter table action_bars comment '下拉菜单';
|
|
|
|
|
|
/*==============================================================*/
|
|
|
-/* Table: action_permission */
|
|
|
+/* Table: group_users */
|
|
|
/*==============================================================*/
|
|
|
-create table action_permission
|
|
|
+create table group_users
|
|
|
(
|
|
|
- id int not null comment '用户id',
|
|
|
- bars varchar(128) comment '用户有权限的下拉列表,多个如1,2,3,4用逗号隔开',
|
|
|
- create_time timestamp default CURRENT_TIMESTAMP comment '创建时间',
|
|
|
- modify_time timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
|
|
|
- status char(32) comment '角色是否生效的状态',
|
|
|
- is_del bool default false comment '删除标志',
|
|
|
+ id int not null auto_increment,
|
|
|
+ group_id int,
|
|
|
+ user_id int,
|
|
|
+ status char(32) default 'normal',
|
|
|
+ created_at timestamp default CURRENT_TIMESTAMP,
|
|
|
+ updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
+ created_user_id int,
|
|
|
+ updated_user_id int,
|
|
|
+ is_del bool,
|
|
|
primary key (id)
|
|
|
);
|
|
|
|
|
|
-alter table action_permission comment '下拉菜单权限表';
|
|
|
+alter table group_users comment '用户组和用户的关联表';
|
|
|
|
|
|
/*==============================================================*/
|
|
|
-/* Table: user */
|
|
|
+/* Table: groups */
|
|
|
/*==============================================================*/
|
|
|
-create table user
|
|
|
+create table groups
|
|
|
(
|
|
|
- id int not null,
|
|
|
- username varchar(128) not null comment '用户名',
|
|
|
- password varchar(128) not null comment '用户密码',
|
|
|
- nickname varchar(255) comment '用户昵称',
|
|
|
- tel char(16) comment '用户电话',
|
|
|
- email char(64) comment '用户邮箱',
|
|
|
- create_time timestamp default CURRENT_TIMESTAMP comment '创建时间',
|
|
|
- modify_time timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
|
|
|
+ id int not null auto_increment,
|
|
|
+ name varchar(128),
|
|
|
+ description varchar(255),
|
|
|
+ icon varchar(255),
|
|
|
+ status char(32) default 'normal',
|
|
|
+ created_at timestamp default CURRENT_TIMESTAMP,
|
|
|
+ updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
+ created_user_id int,
|
|
|
+ updated_user_id int,
|
|
|
+ is_del bool default false,
|
|
|
+ primary key (id)
|
|
|
+);
|
|
|
+
|
|
|
+alter table groups comment '用户组';
|
|
|
+
|
|
|
+/*==============================================================*/
|
|
|
+/* Table: user_action_bars */
|
|
|
+/*==============================================================*/
|
|
|
+create table user_action_bars
|
|
|
+(
|
|
|
+ id int not null auto_increment comment '用户id',
|
|
|
+ user_id int,
|
|
|
+ bar_id int comment '用户有权限的下拉列表,多个如1,2,3,4用逗号隔开',
|
|
|
+ status char(32) default 'normal' comment '角色是否生效的状态',
|
|
|
+ created_at timestamp default CURRENT_TIMESTAMP comment '创建时间',
|
|
|
+ updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
|
|
|
+ created_user_id int,
|
|
|
+ updated_user_id int,
|
|
|
is_del bool default false comment '删除标志',
|
|
|
primary key (id)
|
|
|
);
|
|
|
|
|
|
-alter table user comment '用户表';
|
|
|
+alter table user_action_bars comment '下拉菜单权限表';
|
|
|
|
|
|
/*==============================================================*/
|
|
|
-/* Table: user_permission */
|
|
|
+/* Table: user_roles */
|
|
|
/*==============================================================*/
|
|
|
-create table user_permission
|
|
|
+create table user_roles
|
|
|
(
|
|
|
- id int not null comment '用户id',
|
|
|
+ id int not null auto_increment comment '用户id',
|
|
|
+ user_id int,
|
|
|
role int comment '用户权限,为管理员或者普通用户,取值为1,2,4,8,16...',
|
|
|
- create_time timestamp default CURRENT_TIMESTAMP,
|
|
|
- modify_time timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
- status char(32),
|
|
|
+ status char(32) default 'normal',
|
|
|
+ created_at timestamp default CURRENT_TIMESTAMP,
|
|
|
+ updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
+ created_user_id int,
|
|
|
+ updated_user_id int,
|
|
|
is_del bool default false,
|
|
|
primary key (id)
|
|
|
);
|
|
|
|
|
|
-alter table user_permission comment '用户权限表';
|
|
|
+alter table user_roles comment '用户权限表';
|
|
|
|
|
|
-alter table action_permission add constraint FK_bar_permission foreign key (id)
|
|
|
- references user (id) on delete restrict on update restrict;
|
|
|
+/*==============================================================*/
|
|
|
+/* Table: users */
|
|
|
+/*==============================================================*/
|
|
|
+create table users
|
|
|
+(
|
|
|
+ id int not null auto_increment,
|
|
|
+ username varchar(128) not null comment '用户名',
|
|
|
+ password varchar(128) not null comment '用户密码',
|
|
|
+ nickname varchar(255) comment '用户昵称',
|
|
|
+ icon varchar(255),
|
|
|
+ tel char(16) comment '用户电话',
|
|
|
+ email char(64) comment '用户邮箱',
|
|
|
+ created_at timestamp default CURRENT_TIMESTAMP comment '创建时间',
|
|
|
+ updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
|
|
|
+ created_user_id int,
|
|
|
+ updated_user_id int,
|
|
|
+ is_del bool default false comment '删除标志',
|
|
|
+ primary key (id)
|
|
|
+);
|
|
|
|
|
|
-alter table user_permission add constraint FK_user_permission foreign key (id)
|
|
|
- references user (id) on delete restrict on update restrict;
|
|
|
+alter table users comment '用户表';
|
|
|
|