Add group role tables
This commit is contained in:
@@ -41,9 +41,9 @@ on duplicate key update name = values(name),
|
||||
|
||||
insert into t_element(id, name, power_id, menu_id)
|
||||
values (1010100, '公用', id, 1010000),
|
||||
(101010100, '基础', id, 101010000),
|
||||
(102010100, '基础', id, 102010000),
|
||||
(103010100, '基础', id, 103010000)
|
||||
(101010100, '角色基础', id, 101010000),
|
||||
(102010100, '用户组基础', id, 102010000),
|
||||
(103010100, '用户基础', id, 103010000)
|
||||
on duplicate key update name = values(name),
|
||||
power_id=values(power_id),
|
||||
menu_id = values(menu_id);
|
||||
|
||||
@@ -2,6 +2,6 @@ drop table if exists t_power;
|
||||
|
||||
create table if not exists t_power
|
||||
(
|
||||
`id` bigint not null primary key,
|
||||
`type_id` bigint not null comment '权限类型'
|
||||
id bigint not null primary key,
|
||||
type_id bigint not null comment '权限类型'
|
||||
) comment '权限';
|
||||
@@ -2,9 +2,9 @@ drop table if exists t_menu;
|
||||
|
||||
create table if not exists t_menu
|
||||
(
|
||||
`id` bigint not null primary key,
|
||||
`name` varchar(30) not null comment ' 菜单名',
|
||||
`url` varchar(100) null comment 'URL',
|
||||
`power_id` bigint not null comment '权限ID',
|
||||
`parent_id` bigint null comment '父ID'
|
||||
id bigint not null primary key,
|
||||
name varchar(30) not null comment ' 菜单名',
|
||||
url varchar(100) null comment 'URL',
|
||||
power_id bigint not null comment '权限ID',
|
||||
parent_id bigint null comment '父ID'
|
||||
) comment '菜单';
|
||||
@@ -2,8 +2,8 @@ drop table if exists t_element;
|
||||
|
||||
create table if not exists t_element
|
||||
(
|
||||
`id` bigint not null primary key,
|
||||
`name` varchar(100) not null comment '元素名',
|
||||
`power_id` bigint not null comment '权限ID',
|
||||
`menu_id` bigint not null comment '菜单ID'
|
||||
id bigint not null primary key,
|
||||
name varchar(100) not null comment '元素名',
|
||||
power_id bigint not null comment '权限ID',
|
||||
menu_id bigint not null comment '菜单ID'
|
||||
) comment '页面元素';
|
||||
@@ -2,10 +2,10 @@ drop table if exists t_operation;
|
||||
|
||||
create table if not exists t_operation
|
||||
(
|
||||
`id` bigint not null primary key,
|
||||
`name` varchar(50) not null comment '功能名',
|
||||
`code` varchar(50) null comment '功能编码',
|
||||
`power_id` bigint not null comment '权限ID',
|
||||
`parent_id` bigint null comment '父ID',
|
||||
`element_id` bigint not null comment '页面元素ID'
|
||||
id bigint not null primary key,
|
||||
name varchar(50) not null comment '功能名',
|
||||
code varchar(50) null comment '功能编码',
|
||||
power_id bigint not null comment '权限ID',
|
||||
parent_id bigint null comment '父ID',
|
||||
element_id bigint not null comment '页面元素ID'
|
||||
) comment '功能';
|
||||
@@ -0,0 +1,11 @@
|
||||
drop table if exists t_group;
|
||||
|
||||
create table if not exists t_group
|
||||
(
|
||||
id bigint not null primary key,
|
||||
name varchar(30) not null comment '用户组名',
|
||||
enable int not null comment '启用',
|
||||
deleted bigint not null default 0,
|
||||
version int not null default 0,
|
||||
constraint t_group_unique unique (name, deleted)
|
||||
) comment '用户组';
|
||||
@@ -0,0 +1,10 @@
|
||||
drop table if exists t_user_group;
|
||||
|
||||
create table if not exists t_user_group
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint not null comment '用户',
|
||||
group_id bigint not null comment '用户组',
|
||||
deleted bigint not null default 0,
|
||||
version int not null default 0
|
||||
) comment '中间表-用户-用户组';
|
||||
@@ -0,0 +1,11 @@
|
||||
drop table if exists t_role;
|
||||
|
||||
create table if not exists t_role
|
||||
(
|
||||
id bigint not null primary key,
|
||||
name varchar(20) not null comment '角色名',
|
||||
enable int not null comment '启用',
|
||||
deleted bigint not null default 0,
|
||||
version int not null default 0,
|
||||
constraint t_role_unique unique (name, deleted)
|
||||
) comment '角色';
|
||||
@@ -0,0 +1,10 @@
|
||||
drop table if exists t_role_group;
|
||||
|
||||
create table if not exists t_role_group
|
||||
(
|
||||
id bigint not null primary key,
|
||||
role_id bigint not null comment '角色',
|
||||
group_id bigint not null comment '群组',
|
||||
deleted bigint not null default 0,
|
||||
version int not null default 0
|
||||
) comment '中间表-角色-用户组';
|
||||
@@ -0,0 +1,10 @@
|
||||
drop table if exists t_user_role;
|
||||
|
||||
create table if not exists t_user_role
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint not null comment '用户',
|
||||
role_id bigint not null comment '角色',
|
||||
deleted bigint not null default 0,
|
||||
version int not null default 0
|
||||
) comment '中间表-用户-角色';
|
||||
@@ -0,0 +1,10 @@
|
||||
drop table if exists t_power_role;
|
||||
|
||||
create table if not exists t_power_role
|
||||
(
|
||||
id bigint not null primary key,
|
||||
power_id bigint not null comment '权限',
|
||||
role_id bigint not null comment '角色',
|
||||
deleted bigint not null default 0,
|
||||
version int not null default 0
|
||||
) comment '中间表-权限-角色';
|
||||
Reference in New Issue
Block a user