基于Python-Flask的权限管理1:框架选择和数据库设计
一、前言
我们在做任何一款产品的时候,或多或少都会涉及到用户和权限的问题。譬如,做企业类软件,不同部门、不同职位的人的权限是不同的;最近想自己写一个网站,首先就要解决最基础的权限和菜单问题这块,在网上也查找了相关知识,找了一些开源框架模板,发现"RBAC"式的权限管理不错,于是准备以此模型为基础,完成权限管理功能。
二、什么是RBAC模型
RBAC(Role-Based Access Control)即:基于角色的权限控制。通过角色关联用户,角色关联权限的方式间接赋予用户权限。具体可以查看https://www.jianshu.com/p/5613fbf94829
三、技术选择
前端:基于VUE的开源后台管理模板D2admin,我用的是在此基础上的另一个开源项目d2-admin-xiya-go-cms,已经帮我们完成了基础的前端权限管理,在此基础上改就行。ps:毕竟不是前端,有现成的就用现成的
后端:python的flask框架
数据库: mysql,redis
四、数据库设计
1.菜单信息表:存放菜单信息
CREATE TABLE `t_menu` ( `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '菜单ID', `menu_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '菜单名称', `parent_id` int(11) NULL DEFAULT 0 COMMENT '父菜单ID', `order_num` int(4) NULL DEFAULT 0 COMMENT '显示顺序', `url` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '#' COMMENT '请求地址', `menu_type` tinyint(4) NULL DEFAULT NULL COMMENT '菜单类型(1,目录 2,菜单 3,按钮)', `visible` int(1) NULL DEFAULT 1 COMMENT '菜单状态(1显示 2隐藏)', `perms` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL COMMENT '权限标识', `icon` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '#' COMMENT '菜单图标', `is_frame` int(1) NULL DEFAULT 2 COMMENT '是否外链', `create_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '创建者', `created_at` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '创建时间', `update_by` varchar(64) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '更新者', `updated_at` timestamp(0) NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新时间', `remark` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '' COMMENT '备注', `route_name` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '', `route_path` varchar(100) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '', `route_cache` int(11) NULL DEFAULT 0, `route_component` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT '', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 72 CHARACTER SET = utf8 COLLATE = utf8_general_ci COMMENT = '菜单权限表' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1;
2.角色信息表:存放角色信息
CREATE TABLE `t_role` ( `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '角色ID', `role_name` VARCHAR(30) NOT NULL COMMENT '角色名称', `role_key` VARCHAR(100) NOT NULL COMMENT '角色权限字符串', `role_sort` INT(4) NOT NULL COMMENT '显示顺序', `data_scope` INT(1) NULL DEFAULT '1' COMMENT '数据范围(1:全部数据权限 2:自定数据权限)', `status` INT(1) NULL DEFAULT NULL COMMENT '角色状态(1正常 2停用)', `create_by` VARCHAR(64) NULL DEFAULT '' COMMENT '创建者', `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_by` VARCHAR(64) NULL DEFAULT '' COMMENT '更新者', `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) USING BTREE ) COMMENT='角色信息表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=17 ;
3.角色和菜单关联表:存放角色和菜单关联信息
CREATE TABLE `t_role_menu` ( `role_id` INT(11) NOT NULL COMMENT '角色ID', `menu_id` INT(11) NOT NULL COMMENT '菜单ID', `id` INT(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) COMMENT='角色和菜单关联表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=370 ;
4.岗位信息表:存放岗位信息
CREATE TABLE `t_post` ( `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '岗位ID', `post_code` VARCHAR(64) NOT NULL COMMENT '岗位编码', `post_name` VARCHAR(50) NOT NULL COMMENT '岗位名称', `post_sort` INT(4) NOT NULL COMMENT '显示顺序', `status` INT(1) NOT NULL DEFAULT '1' COMMENT '状态(1正常 2停用)', `create_by` VARCHAR(64) NULL DEFAULT '' COMMENT '创建者', `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_by` VARCHAR(64) NULL DEFAULT '' COMMENT '更新者', `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) USING BTREE ) COMMENT='岗位信息表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=9 ;
5.部门信息表:存放部门信息
CREATE TABLE `t_dept` ( `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '部门id', `parent_id` INT(11) NULL DEFAULT '0' COMMENT '父部门id', `dept_name` VARCHAR(30) NULL DEFAULT '' COMMENT '部门名称', `order_num` INT(4) NULL DEFAULT '0' COMMENT '显示顺序', `leader` VARCHAR(20) NULL DEFAULT NULL COMMENT '负责人', `phone` VARCHAR(11) NULL DEFAULT NULL COMMENT '联系电话', `email` VARCHAR(50) NULL DEFAULT NULL COMMENT '邮箱', `status` INT(1) NULL DEFAULT '0' COMMENT '部门状态(1正常2停用)', `create_by` VARCHAR(64) NULL DEFAULT '' COMMENT '创建者', `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_by` VARCHAR(64) NULL DEFAULT '' COMMENT '更新者', `updated_at` TIMESTAMP NULL DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `remark` VARCHAR(500) NULL DEFAULT '' COMMENT '备注', PRIMARY KEY (`id`) USING BTREE ) COMMENT='部门表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=12 ;
6.角色和部门关联表:存放角色和部门关联信息
CREATE TABLE `t_role_dept` ( `role_id` INT(11) NOT NULL COMMENT '角色ID', `dept_id` INT(11) NOT NULL COMMENT '部门ID', `id` INT(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) COMMENT='角色和部门关联表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=25 ;
7.用户信息表:存放用户信息
CREATE TABLE `t_user` ( `id` INT(11) NOT NULL AUTO_INCREMENT COMMENT '用户ID', `nickname` VARCHAR(30) NULL DEFAULT NULL COMMENT '登录账号' COLLATE 'latin1_swedish_ci', `user_name` VARCHAR(30) NULL DEFAULT NULL COMMENT '用户昵称' COLLATE 'latin1_swedish_ci', `user_type` INT(1) NULL DEFAULT NULL COMMENT '用户类型(1系统用户', `email` VARCHAR(50) NULL DEFAULT NULL COMMENT '用户邮箱' COLLATE 'latin1_swedish_ci', `phone` VARCHAR(20) NULL DEFAULT NULL COMMENT '手机号' COLLATE 'latin1_swedish_ci', `phonenumber` VARCHAR(11) NULL DEFAULT NULL COMMENT '手机号码' COLLATE 'latin1_swedish_ci', `sex` INT(1) NULL DEFAULT NULL COMMENT '用户性别(1男 2女 3未知)', `avatar` VARCHAR(100) NULL DEFAULT NULL COMMENT '头像路径' COLLATE 'latin1_swedish_ci', `password` VARCHAR(50) NULL DEFAULT NULL COMMENT '密码' COLLATE 'latin1_swedish_ci', `salt` VARCHAR(20) NULL DEFAULT NULL COMMENT '盐加密' COLLATE 'latin1_swedish_ci', `status` INT(1) NULL DEFAULT '1' COMMENT '帐号状态(1正常 2禁用', `dept_id` INT(11) NULL DEFAULT NULL, `del_flag` INT(1) NULL DEFAULT '1' COMMENT '删除标志(1代表存在 2代表删除)', `login_ip` VARCHAR(50) NULL DEFAULT NULL COMMENT '最后登陆IP' COLLATE 'latin1_swedish_ci', `login_date` TIMESTAMP NULL DEFAULT NULL COMMENT '最后登陆时间', `create_by` VARCHAR(64) NULL DEFAULT NULL COMMENT '创建者' COLLATE 'latin1_swedish_ci', `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_by` VARCHAR(64) NULL DEFAULT NULL COMMENT '更新者' COLLATE 'latin1_swedish_ci', `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `deleted_at` TIMESTAMP NULL DEFAULT NULL COMMENT '更新时间', `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注' COLLATE 'latin1_swedish_ci', PRIMARY KEY (`id`) ) COMMENT='用户信息表' COLLATE='utf32_general_ci' ENGINE=InnoDB AUTO_INCREMENT=11 ;
8.用户与岗位关联表:存放用户与岗位关联信息
CREATE TABLE `t_user_post` ( `user_id` INT(11) NOT NULL COMMENT '用户ID', `post_id` INT(11) NOT NULL COMMENT '岗位ID', `id` INT(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) COMMENT='用户与岗位关联表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=5 ;
9.用户和角色关联表:存放用户和角色关联信息
CREATE TABLE `t_user_role` ( `user_id` INT(11) NOT NULL COMMENT '用户ID', `role_id` INT(11) NOT NULL COMMENT '角色ID', `id` INT(11) NOT NULL AUTO_INCREMENT, PRIMARY KEY (`id`) ) COMMENT='用户和角色关联表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=18 ;
10.字典类型表:存放字典类型
CREATE TABLE `t_dict_type` ( `id` INT(11) NOT NULL AUTO_INCREMENT, `dict_name` VARCHAR(100) NULL DEFAULT '' COMMENT '字典名称', `dict_type` VARCHAR(100) NULL DEFAULT '' COMMENT '字典类型', `dict_value_type` INT(11) NULL DEFAULT '0' COMMENT '标识', `status` INT(1) NULL DEFAULT '1' COMMENT '状态(1正常 2停用)', `create_by` VARCHAR(64) NULL DEFAULT '' COMMENT '创建者', `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `update_by` VARCHAR(64) NULL DEFAULT '' COMMENT '更新者', `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`), UNIQUE INDEX `dict_type` (`dict_type`) ) COMMENT='字典类型表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=27 ;
11.字典数据表:存放字典数据
CREATE TABLE `t_dict_data` ( `dict_id` INT(11) NOT NULL COMMENT 'ID', `id` INT(11) NOT NULL AUTO_INCREMENT, `dict_sort` INT(4) NULL DEFAULT '0' COMMENT '字典排序', `dict_label` VARCHAR(100) NULL DEFAULT '' COMMENT '字典标签', `dict_value` VARCHAR(100) NULL DEFAULT '' COMMENT '字典键值', `dict_number` INT(11) NULL DEFAULT '0' COMMENT '字典值', `dict_type` VARCHAR(100) NULL DEFAULT '' COMMENT '字典类型', `dict_value_type` INT(11) NULL DEFAULT '1' COMMENT 'dict_value_type', `css_class` VARCHAR(100) NULL DEFAULT NULL COMMENT '样式属性(其他样式扩展)', `list_class` VARCHAR(100) NULL DEFAULT NULL COMMENT '表格回显样式', `is_default` INT(1) NULL DEFAULT '1' COMMENT '是否默认(1是 0否)', `status` INT(1) NULL DEFAULT '1' COMMENT '状态(1正常 2停用)', `create_by` VARCHAR(64) NULL DEFAULT '' COMMENT '创建者', `created_at` TIMESTAMP NULL DEFAULT NULL COMMENT '创建时间', `update_by` VARCHAR(64) NULL DEFAULT '' COMMENT '更新者', `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) USING BTREE ) COMMENT='字典数据表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=29 ;
12.参数配置表:存放可变参数
CREATE TABLE `t_configs` ( `id` INT(5) NOT NULL AUTO_INCREMENT COMMENT '参数主键', `config_name` VARCHAR(100) NULL DEFAULT '' COMMENT '参数名称', `config_key` VARCHAR(100) NULL DEFAULT '' COMMENT '参数键名', `config_value` VARCHAR(100) NULL DEFAULT '' COMMENT '参数键值', `config_type` INT(1) NULL DEFAULT '1' COMMENT '系统内置(1是 2否)', `create_by` VARCHAR(11) NULL DEFAULT NULL COMMENT '创建者', `update_by` VARCHAR(11) NULL DEFAULT NULL COMMENT '更新着', `created_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', `updated_at` TIMESTAMP NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', `remark` VARCHAR(500) NULL DEFAULT NULL COMMENT '备注', PRIMARY KEY (`id`) USING BTREE ) COMMENT='参数配置表' COLLATE='utf8_general_ci' ENGINE=InnoDB AUTO_INCREMENT=8 ;
五、基础数据
-- ---------------------------- -- Records of t_configs -- ---------------------------- INSERT INTO `t_configs` VALUES ('1', '用户管理 - 账号初始密码', 'sys.user.initPassword', '123456', '1', null, 'admin', '2020-03-22 14:01:59', '2020-03-22 14:38:28', null); -- ---------------------------- -- Records of t_dept -- ---------------------------- INSERT INTO `t_dept` VALUES ('1', '0', '公司', '1', '狄云', '13888888888', 'gs@qq.com', '1', '', null, 'admin', '2020-03-18 23:10:41', '3333'); INSERT INTO `t_dept` VALUES ('2', '1', '研发', '0', null, null, null, '1', '', null, '', '2020-03-18 22:29:17', ''); INSERT INTO `t_dept` VALUES ('3', '2', '研发组1', '0', null, null, null, '1', '', null, '', '2020-03-18 22:29:16', ''); INSERT INTO `t_dept` VALUES ('7', '0', '外包', '1', 'wb', '', '', '2', 'admin', '2020-03-19 21:10:05', 'admin', '2020-03-22 17:42:13', ''); INSERT INTO `t_dept` VALUES ('8', '1', '运维', '1', '', '', '', '1', 'admin', '2020-03-22 18:58:57', null, null, ''); INSERT INTO `t_dept` VALUES ('9', '8', '运维一组', '1', '', '', '', '1', 'admin', '2020-03-22 18:59:08', null, null, ''); INSERT INTO `t_dept` VALUES ('10', '7', '外包一部', '1', '', '', '', '1', 'admin', '2020-03-22 18:59:17', null, null, ''); INSERT INTO `t_dept` VALUES ('11', '7', '外包二部', '1', '', '', '', '1', 'admin', '2020-03-22 18:59:23', null, null, ''); -- ---------------------------- -- Records of t_dict_data -- ---------------------------- INSERT INTO `t_dict_data` VALUES ('1', '1', '1', '字符', '', '2', 'dict_value_type', '1', null, null, '1', '1', '', null, '', '2020-03-17 23:13:37', null); INSERT INTO `t_dict_data` VALUES ('1', '2', '2', '数字', '', '1', 'dict_value_type', '1', null, null, '1', '1', '', null, '', null, null); INSERT INTO `t_dict_data` VALUES ('3', '3', '1', '按钮', '', '2', 'menu_type', '1', null, null, '1', '1', '', null, '', null, null); INSERT INTO `t_dict_data` VALUES ('3', '4', '2', '菜单', '', '1', 'menu_type', '1', null, null, '1', '1', '', null, '', null, null); INSERT INTO `t_dict_data` VALUES ('5', '5', '1', '隐藏', '', '2', 'visible', '1', null, null, '1', '1', '', null, '', null, null); INSERT INTO `t_dict_data` VALUES ('5', '6', '2', '显示', '', '1', 'visible', '1', null, null, '1', '1', '', null, '', '2020-03-16 21:50:01', null); INSERT INTO `t_dict_data` VALUES ('4', '7', '1', '否', '', '2', 'is', '1', null, null, '1', '1', '', null, '', '2020-03-16 21:50:02', null); INSERT INTO `t_dict_data` VALUES ('4', '8', '2', '是', '', '1', 'is', '1', null, null, '1', '1', '', null, '', '2020-03-16 21:50:03', null); INSERT INTO `t_dict_data` VALUES ('7', '9', '1', '禁用', '', '2', 'status', '1', null, null, '1', '1', '', null, '', '2020-03-16 21:50:53', null); INSERT INTO `t_dict_data` VALUES ('7', '10', '2', '激活', '', '1', 'status', '1', null, null, '1', '1', '', null, '', '2020-03-16 21:51:21', null); INSERT INTO `t_dict_data` VALUES ('6', '17', '1', '男', '', '1', 'sex', '1', '', '', '1', '1', null, null, null, '2020-03-20 12:15:10', ''); INSERT INTO `t_dict_data` VALUES ('6', '18', '1', '女', '', '2', 'sex', '1', '', '', '1', '1', null, null, null, '2020-03-20 12:15:12', ''); INSERT INTO `t_dict_data` VALUES ('25', '23', '1', '全部', '', '1', 'data_scope', null, '', '', '1', '1', 'admin', null, null, '2020-03-20 12:14:42', ''); INSERT INTO `t_dict_data` VALUES ('25', '24', '1', '自定义', '', '2', 'data_scope', null, '', '', '1', '1', 'admin', null, null, '2020-03-20 12:36:21', ''); -- ---------------------------- -- Records of t_dict_type -- ---------------------------- INSERT INTO `t_dict_type` VALUES ('1', '字典值类型', 'dict_value_type', '1', '1', '', null, '', null, null); INSERT INTO `t_dict_type` VALUES ('3', '菜单类型', 'menu_type', '1', '1', '', null, '', null, null); INSERT INTO `t_dict_type` VALUES ('4', '是否', 'is', '1', '1', '', null, '', null, null); INSERT INTO `t_dict_type` VALUES ('5', '显示状态', 'visible', '1', '1', '', null, '', null, null); INSERT INTO `t_dict_type` VALUES ('6', '性别', 'sex', '1', '1', '', null, '', null, null); INSERT INTO `t_dict_type` VALUES ('7', '状态', 'status', '1', '2', '', null, '', '2020-03-17 18:54:00', null); INSERT INTO `t_dict_type` VALUES ('25', '数据权限', 'data_scope', '1', '1', 'admin', '2020-03-20 01:03:55', null, '2020-03-20 01:03:55', ''); -- ---------------------------- -- Records of t_menu -- ---------------------------- INSERT INTO `t_menu` VALUES ('1', '系统管理', '0', '1', '#', '1', '1', null, 'cog', '2', '', null, '', null, '', '', '', '0', ''); INSERT INTO `t_menu` VALUES ('2', '菜单管理', '1', '1', '/management/menu', '1', '1', '', 'navicon', '2', '', null, '', '2020-03-16 21:34:11', '', 'management-menu', 'management/menu', '2', 'management/menu'); INSERT INTO `t_menu` VALUES ('3', '菜单查询', '2', '0', '#', '2', '1', 'system:menu:query', '#', '0', '', null, '', null, '', '', '', '0', ''); INSERT INTO `t_menu` VALUES ('4', '菜单删除', '2', '0', '#', '2', '1', 'system:menu:remove', '#', '0', '', null, '', null, '', '', '', '0', ''); INSERT INTO `t_menu` VALUES ('5', '菜单新增', '2', '0', '#', '2', '1', 'system:menu:add', '#', '0', '', null, '', null, '', '', '', '0', ''); INSERT INTO `t_menu` VALUES ('6', '菜单修改', '2', '0', '#', '2', '1', 'system:menu:edit', '#', '0', '', null, '', '2020-03-15 15:45:28', '', '', '', '0', ''); INSERT INTO `t_menu` VALUES ('22', '用户管理', '1', '2', '/management/user', '1', '1', '', 'user-circle', '2', '1', '2020-03-16 20:48:06', null, '2020-03-16 21:34:31', '', 'management-user', 'management/user', '2', 'management/user'); INSERT INTO `t_menu` VALUES ('23', '用户查询', '22', '1', null, '2', '1', 'system:user:query', null, null, '1', '2020-03-16 20:49:26', null, '2020-03-16 20:55:31', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('24', '用户新增', '22', '1', null, '2', null, 'system:user:add', null, null, '1', '2020-03-16 21:03:36', null, '2020-03-16 21:03:36', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('25', '用户修改', '22', '1', null, '2', null, 'system:user:edit', null, null, '1', '2020-03-16 21:08:26', null, '2020-03-16 21:08:26', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('26', '用户删除', '22', '1', null, '2', null, 'system:user:remove', null, null, '1', '2020-03-16 21:08:39', null, '2020-03-16 21:08:39', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('27', '角色管理', '1', '3', '/management/role', '1', '1', '', 'users', '2', '1', '2020-03-16 21:10:32', null, '2020-03-16 21:34:42', '', 'management-role', 'management/role', '2', 'management/role'); INSERT INTO `t_menu` VALUES ('28', '角色查询', '27', '1', null, '2', null, 'system:role:query', null, null, '1', '2020-03-16 21:10:58', null, '2020-03-16 21:10:58', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('29', '角色添加', '27', '1', null, '2', null, 'system:role:add', null, null, '1', '2020-03-16 21:11:27', null, '2020-03-16 21:11:27', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('30', '角色修改', '27', '1', null, '2', null, 'system:role:edit', null, null, '1', '2020-03-16 21:11:38', null, '2020-03-16 21:11:38', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('31', '角色删除', '27', '1', null, '2', null, 'system:role:remove', null, null, '1', '2020-03-16 21:11:51', null, '2020-03-16 21:11:51', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('32', '角色修改-数据权限', '27', '1', null, '2', null, 'system:role:editData', null, null, '1', '2020-03-16 21:13:04', null, '2020-03-16 21:13:04', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('33', '部门管理', '1', '4', '/management/dept', '1', '1', '', 'bank', '2', '1', '2020-03-16 21:14:52', null, '2020-03-16 21:33:49', '', 'management-dept', 'management/dept', '2', 'management/dept'); INSERT INTO `t_menu` VALUES ('34', '部门查询', '33', '1', null, '2', null, 'system:dept:query', null, null, '1', '2020-03-16 21:15:21', null, '2020-03-16 21:15:21', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('35', '部门新增', '33', '1', null, '2', null, 'system:dept:add', null, null, '1', '2020-03-16 21:16:10', null, '2020-03-16 21:16:10', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('36', '部门修改', '33', '1', null, '2', null, 'system:dept:edit', null, null, '1', '2020-03-16 21:16:21', null, '2020-03-16 21:16:21', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('37', '部门删除', '33', '1', null, '2', null, 'system:dept:remove', null, null, '1', '2020-03-16 21:16:35', null, '2020-03-16 21:16:35', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('38', '岗位管理', '1', '5', '/management/post', '1', '1', '', 'briefcase', '2', '1', '2020-03-16 21:18:27', null, '2020-03-16 21:34:58', '', 'management-post', 'management/post', '2', 'management/post'); INSERT INTO `t_menu` VALUES ('39', '岗位查询', '38', '1', null, '2', null, 'system:post:query', null, null, '1', '2020-03-16 21:18:50', null, '2020-03-16 21:18:50', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('40', '岗位增加', '38', '1', null, '2', null, 'system:post:add', null, null, '1', '2020-03-16 21:19:06', null, '2020-03-16 21:19:06', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('41', '岗位修改', '38', '1', null, '2', null, 'system:post:edit', null, null, '1', '2020-03-16 21:19:26', null, '2020-03-16 21:19:26', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('42', '岗位删除', '38', '1', null, '2', null, 'system:post:remove', null, null, '1', '2020-03-16 21:19:41', null, '2020-03-16 21:19:41', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('43', '字典管理', '1', '6', '/management/dict', '1', '1', '', 'book', '2', '1', '2020-03-16 21:20:33', null, '2020-03-16 21:35:11', '', 'management-dict', 'management/dict', '2', 'management/dict'); INSERT INTO `t_menu` VALUES ('44', '字典查询', '43', '1', null, '2', null, 'system:dict:query', null, null, '1', '2020-03-16 21:21:20', null, '2020-03-16 21:21:20', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('45', '字典新增', '43', '1', null, '2', null, 'system:dict:add', null, null, '1', '2020-03-16 21:21:40', null, '2020-03-16 21:21:40', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('46', '字典修改', '43', '1', null, '2', null, 'system:dict:edit', null, null, '1', '2020-03-16 21:21:59', null, '2020-03-16 21:21:59', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('47', '字典删除', '43', '1', null, '2', null, 'system:dict:remove', null, null, '1', '2020-03-16 21:22:22', null, '2020-03-16 21:22:22', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('48', '字典详情', '43', '1', null, '2', null, 'system:dict:detail', null, null, '1', '2020-03-16 21:23:00', null, '2020-03-16 21:23:00', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('49', '字典数据', '1', '7', '/management/dict-data', '1', '2', '', '', null, '1', '2020-03-16 21:25:19', null, '2020-03-16 23:30:52', '', 'management-dict-data', 'management/dict-data', '2', 'management/dict-data'); INSERT INTO `t_menu` VALUES ('50', '字典数据查询', '49', '1', null, '2', null, 'system:dict-data:query', null, null, '1', '2020-03-16 21:25:45', null, '2020-03-16 21:25:45', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('51', '字典数据新增', '49', '1', null, '2', null, 'system:dict-data:add', null, null, '1', '2020-03-16 21:26:01', null, '2020-03-16 21:26:01', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('52', '字典数据修改', '49', '1', null, '2', null, 'system:dict-data:edit', null, null, '1', '2020-03-16 21:26:15', null, '2020-03-16 21:26:15', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('53', '字典数据删除', '49', '1', null, '2', null, 'system:dict-data:remove', null, null, '1', '2020-03-16 21:26:27', null, '2020-03-16 21:26:27', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('54', '参数设置', '1', '8', '/management/config', '1', '1', '', 'cubes', '2', '1', '2020-03-16 21:28:00', null, '2020-03-16 21:35:26', '', 'management-config', 'management/config', '1', 'management/config'); INSERT INTO `t_menu` VALUES ('55', '参数查询', '54', '1', null, '2', null, 'system:config:query', null, null, '1', '2020-03-16 21:28:23', null, '2020-03-16 21:28:23', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('56', '参数添加', '54', '1', null, '2', null, 'system:config:add', null, null, '1', '2020-03-16 21:28:33', null, '2020-03-16 21:28:33', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('57', '参数修改', '54', '1', null, '2', null, 'system:config:edit', null, null, '1', '2020-03-16 21:28:57', null, '2020-03-16 21:28:57', '', null, null, null, null); INSERT INTO `t_menu` VALUES ('58', '参数删除', '54', '1', null, '2', null, 'system:config:remove', null, null, '1', '2020-03-16 21:29:09', null, '2020-03-16 21:29:09', '', null, null, null, null); -- ---------------------------- -- Records of t_post -- ---------------------------- INSERT INTO `t_post` VALUES ('5', 'dev-server', '后端开发工程师', '2', '1', 'admin', '2020-03-18 21:55:28', 'admin', '2020-03-18 22:02:06', ''); INSERT INTO `t_post` VALUES ('6', 'dev-web', '前端开发工程师', '3', '1', 'admin', '2020-03-18 21:55:42', 'admin', '2020-03-18 22:02:12', ''); INSERT INTO `t_post` VALUES ('7', 'pm', '产品经理', '4', '1', 'admin', '2020-03-18 21:55:56', 'admin', '2020-03-18 22:02:22', ''); INSERT INTO `t_post` VALUES ('8', 'ui', 'UI 设计', '1', '1', 'admin', '2020-03-18 21:56:15', null, '2020-03-18 21:56:15', ''); -- ---------------------------- -- Records of t_role -- ---------------------------- INSERT INTO `t_role` VALUES ('1', '管理员', 'admin', '1', '1', '1', '', '2020-03-19 21:42:11', 'admin', '2020-03-21 19:20:44', null); INSERT INTO `t_role` VALUES ('16', '游客', 'guide', '1', '1', '1', 'admin', '2020-03-21 19:31:41', null, '2020-03-21 19:31:41', ''); -- ---------------------------- -- Records of t_role_dept -- ---------------------------- INSERT INTO `t_role_dept` VALUES ('1', '1', '1'); -- ---------------------------- -- Records of t_role_menu -- ---------------------------- INSERT INTO `t_role_menu` VALUES ('1', '1', '1'); -- ---------------------------- -- Records of t_user -- ---------------------------- INSERT INTO `t_user` VALUES ('1', 'admin', 'admin', null, 'admin@qq.com', '18888888888', null, '1', null, 'eb7c670dbd05eafe15b8fa94059b3069', null, '1', '1', '1', '127.0.0.1', '2020-03-21 17:25:27', null, null, 'admin', '2020-03-21 17:25:27', null, null); -- ---------------------------- -- Records of t_user_post -- ---------------------------- INSERT INTO `t_user_post` VALUES ('1', '1', '1'); -- ---------------------------- -- Records of t_user_role -- ---------------------------- INSERT INTO `t_user_role` VALUES ('1', '1', '1');
本文来自博客园,作者:HuTiger,转载请注明原文链接:https://www.cnblogs.com/huguodong/p/12433643.html,欢迎加入qq群927460240学习讨论