Browse Source

Updated files

master
adiao 3 years ago
parent
commit
6eaa8a2b05
  1. 45
      v.md

45
v.md

@ -408,7 +408,50 @@ create table repairs(
)character set = UTF8MB4; )character set = UTF8MB4;
# ----------------------------------------------------------- # -----------------------------------------------------------
# 最新的四表 # 最新的四表分层权限结构。
# 用户
create table users(
id int primary key auto_increment, # 自动递增主键
name varchar(244),
password varchar(244),
rolesid int, # 外键 关联角色的ID
createdate timestamp,
updatedate timestamp
) character set = UTF8MB4;
# 角色
create table roles(
id int not null default 0 , # 主键 默认0
name varchar(30),
permissionid int not null auto_increment, # 非主键 约束唯一索引 自动递增 并 外键 关联 permission 的ID
createdate timestamp,
updatedate timestamp,
primary key (`id`),
unique key (`permissionid`)
)character set = UTF8MB4;
# 权限表
create table permission(
id int primary key auto_increment, # 自动递增主键
rolesid int,
name varchar(20),
operationid int, # 外键 关联operation的ID
createdate timestamp,
updatedate timestamp
)character set = UTF8MB4;
# menu操作权限访问模块表
create table operation(
id int primary key , # 主键 非自动递增
name varchar(20),
url varchar(20),
createdate timestamp,
updatedate timestamp
)character set = UTF8MB4;
# 用户---角色的外键
alter table users add constraint ur foreign key (rolesid) references roles(id);
# 角色---权限 & 权限---menu访问模块 的外键。
alter table permission add constraint op foreign key (operationid) references operation(id);
alter table permission add constraint pr foreign key (rolesid) references roles(id);
# ----------------------------------------------------------- # -----------------------------------------------------------
# 资产管理员角色所负责的表 # 资产管理员角色所负责的表

Loading…
Cancel
Save