SpringSecurity开发
RBAC
数据库权限表结构设计与创建
sys_user表
CREATE TABLE sysuser
(id INT(10) unsigned PRIMARY KEY NOT NULL COMMENT '用户ID' AUTO_INCREMENT,
username VARCHAR(25) COMMENT '用户名',
realname VARCHAR(25) COMMENT '真实姓名',
password VARCHAR(25) COMMENT '密码',
email VARCHAR(50) COMMENT '邮箱',
phone VARCHAR(20) COMMENT '电话',
createDate TIMESTAMP COMMENT '创建日期',
lastLoginTime TIMESTAMP COMMENT '最后登录时间',
enabled VARCHAR(5) COMMENT '是否可用',
accountNonExpired int(5) COMMENT '是否过期',
accountNonLocked int(5) COMMENT '是否锁定',
credentialNonExpired int(5) COMMENT '证书是否过期'
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
sys_role表
CREATE TABLE sys_role
(id INT(10) unsigned PRIMARY KEY NOT NULL COMMENT '角色ID' AUTO_INCREMENT,
roleName VARCHAR(25) COMMENT '角色名',
roleDesc VARCHAR(25) COMMENT '角色说明'
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
sys_permission表
CREATE TABLE sys_permission
(id INT(10) unsigned PRIMARY KEY NOT NULL COMMENT '权限ID' AUTO_INCREMENT,
permName VARCHAR(25) COMMENT '权限名',
permTag VARCHAR(25) COMMENT '权限标识符'
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
sys_user_role
CREATE TABLE sys_user_role
(
user_id INT(10) COMMENT '用户ID',
role_id VARCHAR(25) COMMENT '角色ID'
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;
sys_role_permission
CREATE TABLE sys_role_permission
(
role_id INT(10) COMMENT '角色ID',
permission_id VARCHAR(25) COMMENT '权限ID'
)ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8;