|
@@ -1,6 +1,6 @@
|
|
/*==============================================================*/
|
|
/*==============================================================*/
|
|
/* DBMS name: MySQL 5.0 */
|
|
/* DBMS name: MySQL 5.0 */
|
|
-/* Created on: 2019/3/10 10:03:43 */
|
|
|
|
|
|
+/* Created on: 2019/3/11 11:36:08 */
|
|
/*==============================================================*/
|
|
/*==============================================================*/
|
|
|
|
|
|
|
|
|
|
@@ -10,6 +10,8 @@ drop table if exists group_users;
|
|
|
|
|
|
drop table if exists groups;
|
|
drop table if exists groups;
|
|
|
|
|
|
|
|
+drop table if exists roles;
|
|
|
|
+
|
|
drop table if exists user_action_bars;
|
|
drop table if exists user_action_bars;
|
|
|
|
|
|
drop table if exists user_roles;
|
|
drop table if exists user_roles;
|
|
@@ -22,8 +24,7 @@ drop table if exists users;
|
|
create table action_bars
|
|
create table action_bars
|
|
(
|
|
(
|
|
id int not null auto_increment,
|
|
id int not null auto_increment,
|
|
- parent int default 0 comment '该层菜单的上级菜单',
|
|
|
|
- level int default 1 comment '该级菜单是第几级菜单',
|
|
|
|
|
|
+ parent int default 0 comment '该层菜单的上级菜单,第一层的上级菜单是0',
|
|
name varchar(128),
|
|
name varchar(128),
|
|
description varchar(255),
|
|
description varchar(255),
|
|
icon varchar(255),
|
|
icon varchar(255),
|
|
@@ -79,15 +80,35 @@ create table groups
|
|
|
|
|
|
alter table groups comment '用户组';
|
|
alter table groups comment '用户组';
|
|
|
|
|
|
|
|
+/*==============================================================*/
|
|
|
|
+/* Table: roles */
|
|
|
|
+/*==============================================================*/
|
|
|
|
+create table roles
|
|
|
|
+(
|
|
|
|
+ id int not null auto_increment,
|
|
|
|
+ name varchar(128) comment '角色的名字',
|
|
|
|
+ description varchar(255) comment '角色的描述',
|
|
|
|
+ status char(32) comment '状态信息',
|
|
|
|
+ created_at timestamp default CURRENT_TIMESTAMP,
|
|
|
|
+ updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
|
|
+ created_user_at int,
|
|
|
|
+ updated_user_at int,
|
|
|
|
+ is_del bool default false,
|
|
|
|
+ primary key (id)
|
|
|
|
+);
|
|
|
|
+
|
|
|
|
+alter table roles comment '用户角色表';
|
|
|
|
+
|
|
/*==============================================================*/
|
|
/*==============================================================*/
|
|
/* Table: user_action_bars */
|
|
/* Table: user_action_bars */
|
|
/*==============================================================*/
|
|
/*==============================================================*/
|
|
create 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 '角色是否生效的状态',
|
|
|
|
|
|
+ id int not null auto_increment,
|
|
|
|
+ owner_type char(16) default 'user' comment '拥有者的类型,值: user/group/role',
|
|
|
|
+ owner_id int,
|
|
|
|
+ bar_id int comment 'action bar的id',
|
|
|
|
+ status char(32) default 'normal' comment '状态信息,比如角色是否生效的状态',
|
|
created_at timestamp default CURRENT_TIMESTAMP comment '创建时间',
|
|
created_at timestamp default CURRENT_TIMESTAMP comment '创建时间',
|
|
updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
|
|
updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP comment '最后更新时间',
|
|
created_user_id int,
|
|
created_user_id int,
|
|
@@ -105,7 +126,7 @@ create table user_roles
|
|
(
|
|
(
|
|
id int not null auto_increment comment '用户id',
|
|
id int not null auto_increment comment '用户id',
|
|
user_id int,
|
|
user_id int,
|
|
- role int comment '用户权限,为管理员或者普通用户,取值为1,2,4,8,16...',
|
|
|
|
|
|
+ role_id int comment '用户角色id',
|
|
status char(32) default 'normal',
|
|
status char(32) default 'normal',
|
|
created_at timestamp default CURRENT_TIMESTAMP,
|
|
created_at timestamp default CURRENT_TIMESTAMP,
|
|
updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
|
updated_at timestamp default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|