1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
| DROP TABLE IF EXISTS `sys_role`; CREATE TABLE `sys_role` ( `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '主键id', `role_name` VARCHAR(100) DEFAULT NULL COMMENT '角色名称', `description` VARCHAR(100) DEFAULT NULL COMMENT '描述', PRIMARY KEY (`id`) USING BTREE ) ENGINE=INNODB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色表'; INSERT INTO `sys_role`(`id`,`role_name`,`description`) VALUES (1,'admin','管理角色'),(2,'user','用户角色');
DROP TABLE IF EXISTS `sys_permission`; CREATE TABLE `sys_permission` ( `id` VARCHAR(32) NOT NULL COMMENT '主键id', `name` VARCHAR(100) DEFAULT NULL COMMENT '菜单标题', `url` VARCHAR(255) DEFAULT NULL COMMENT '路径', `menu_type` INT(11) DEFAULT NULL COMMENT '菜单类型(0:一级菜单; 1:子菜单:2:按钮权限)', `perms` VARCHAR(255) DEFAULT NULL COMMENT '菜单权限编码', `sort_no` INT(10) DEFAULT NULL COMMENT '菜单排序', `del_flag` INT(1) DEFAULT '0' COMMENT '删除状态 0正常 1已删除', PRIMARY KEY (`id`) USING BTREE, KEY `index_prem_sort_no` (`sort_no`) USING BTREE, KEY `index_prem_del_flag` (`del_flag`) USING BTREE ) ENGINE=INNODB DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='菜单权限表'; INSERT INTO `sys_permission`(`id`,`name`,`url`,`menu_type`,`perms`,`sort_no`,`del_flag`) VALUES ('1','新增用户','/user/add',2,'user:add',1,0),('2','删除用户','/user/delete',2,'user:delete',2,0),('3','修改用户','/user/update',2,'user:update',3,0),('4','查询用户','/user/list',2,'user:list',4,0);
DROP TABLE IF EXISTS `sys_role_permission`; CREATE TABLE `sys_role_permission` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `role_id` INT(11) DEFAULT NULL COMMENT '角色id', `permission_id` INT(11) DEFAULT NULL COMMENT '权限id', PRIMARY KEY (`id`) USING BTREE, KEY `index_group_role_per_id` (`role_id`,`permission_id`) USING BTREE, KEY `index_group_role_id` (`role_id`) USING BTREE, KEY `index_group_per_id` (`permission_id`) USING BTREE ) ENGINE=INNODB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8 ROW_FORMAT=COMPACT COMMENT='角色权限表'; INSERT INTO `sys_role_permission`(`id`,`role_id`,`permission_id`) VALUES (1,1,1),(2,1,2),(3,1,3),(4,1,4),(5,2,4);
|