1. RBAC模型的权限控制
CREATE TABLE t_sys_menu( id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT "主键", parent INT UNSIGNED NOT NULL COMMENT "父级菜单id", `name` VARCHAR(200) NOT NULL COMMENT "菜单名称", icon VARCHAR(200) COMMENT "图标", path VARCHAR(200) NOT NULL COMMENT "路径", weight INT UNSIGNED NOT NULL DEFAULT 0 COMMENT "权重", `status` TINYINT UNSIGNED NOT NULL COMMENT "状态:1启用,0隐藏", is_menu TINYINT UNSIGNED NOT NULL COMMENT "是否菜单:1是,0否", tips VARCHAR(500) COMMENT "备注", create_time TIMESTAMP NOT NULL DEFAULT NOW() COMMENT "创建时间", last_update_time TIMESTAMP NOT NULL DEFAULT NOW() COMMENT "最后修改时间", UNIQUE unq_name(`name`), INDEX idx_parent(parent), INDEX idx_status(`status`), INDEX idx_is_menu(is_menu) ) COMMENT = "系统菜单表"; CREATE TABLE t_sys_role( id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT "主键", parent INT UNSIGNED NOT NULL COMMENT "父级菜单id", `name` VARCHAR(200) NOT NULL COMMENT "角色名称", `status` TINYINT UNSIGNED NOT NULL COMMENT "状态:1启用,0隐藏", create_time TIMESTAMP NOT NULL DEFAULT NOW() COMMENT "创建时间", last_update_time TIMESTAMP NOT NULL DEFAULT NOW() COMMENT "最后修改时间", UNIQUE unq_name(`name`), INDEX idx_parent(parent), INDEX idx_status(`status`) ) COMMENT = "系统角色表"; CREATE TABLE t_sys_role_menu( role_id INT UNSIGNED COMMENT "角色ID", menu_id INT UNSIGNED COMMENT "菜单ID", PRIMARY KEY(role_id, menu_id) ) COMMENT = "角色与菜单关联表"; CREATE TABLE t_sys_user( id INT UNSIGNED PRIMARY KEY AUTO_INCREMENT COMMENT "主键", username VARCHAR(200) NOT NULL COMMENT "用户名", `password` VARCHAR(2000) NOT NULL COMMENT "密码", avatar VARCHAR(2000) NULL COMMENT "用户头像", role_id INT UNSIGNED NOT NULL COMMENT "角色ID", `status` TINYINT UNSIGNED NOT NULL COMMENT "状态: 1可用,2禁用", create_time TIMESTAMP NOT NULL DEFAULT NOW() COMMENT "添加时间", last_update_time TIMESTAMP NOT NULL DEFAULT NOW() COMMENT "最后修改时间", UNIQUE unq_username(username), INDEX idx_username(username), INDEX idx_emp_id(emp_id), INDEX idx_role_id(role_id), INDEX idx_status(`status`) ) COMMENT = "系统用户表";
2. Bootstrap表格的屏幕自适应