中小型toB 应用实现系列 - 权限

中小型toB 应用实现系列 - 导航

系统权限

权限 为理论基础, 采用 RBAC0 设计, 框架使用 spring security

表结构

drop table if exists role;
create table if not exists role
(
	id varchar(20) not null comment '主键id',
	
	no varchar(20) not null comment '编码',	
	name varchar(20) not null comment '名称',
	description varchar(200) not null default '' comment '描述',
	
	create_time datetime(3) not null comment '',
	update_time datetime(3) not null comment '',
	constraint pk_id primary key (id),
	unique key uk_no (no)
)comment='角色表' engine=InnoDB;

drop table if exists resource;
create table if not exists resource
(
	id varchar(20) not null comment '主键id',
	
	module_id varchar(20) not null default '' comment '模块id; module.id',
		
	name varchar(20) not null comment '名称',
	description varchar(200) not null default '' comment '描述',
	url varchar(200) not null comment 'url',
	
	create_time datetime(3) not null comment '',
	update_time datetime(3) not null comment '',
	constraint pk_id primary key (id)
)comment='资源表' engine=InnoDB;

drop table if exists role_resource;
create table if not exists role_resource
(
	id varchar(20) not null comment '主键id',
	
	role_id varchar(20) not null comment '角色id; role.id',
	resource_id varchar(20) not null comment '资源id; resource.id',
	
	create_time datetime(3) not null comment '',
	update_time datetime(3) not null comment '',
	constraint pk_id primary key (id),
	unique key uk_role_id_resource_id (role_id, resource_id)
)comment='角色资源关系表' engine=InnoDB;

drop table if exists user_role;
create table if not exists user_role
(
	id varchar(20) not null comment '主键id',
	
	user_id varchar(20) not null comment '用户id; user.id',
	role_id varchar(20) not null comment '角色id; role.id',	
	
	create_time datetime(3) not null comment '',
	update_time datetime(3) not null comment '',
	constraint pk_id primary key (id),
	unique key uk_user_id_role_id (user_id, role_id)
)comment='用户角色关系表' engine=InnoDB;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值