/* Navicat Premium Data Transfer Source Server : 腾讯云 Source Server Type : MySQL Source Server Version : 80033 Source Host : 101.35.234.160:32306 Source Schema : admin3 Target Server Type : MySQL Target Server Version : 80033 File Encoding : 65001 Date: 07/12/2023 16:34:32 */ SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; -- ---------------------------- -- Table structure for role -- ---------------------------- CREATE TABLE IF NOT EXISTS `rbac_role` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', `available` bit(1) NULL DEFAULT NULL COMMENT '是否有效', `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限描述', `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限名称', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `UK_8sewwnpamngi6b1dwaa88askk` (`name` ASC) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic COMMENT '权限'; -- ---------------------------- -- Table structure for role_resource -- ---------------------------- CREATE TABLE IF NOT EXISTS `rbac_role_resource` ( `role_id` bigint NOT NULL COMMENT '权限id', `resource_id` bigint NOT NULL COMMENT '权限资源id', `authorize` bit(1) NULL DEFAULT NULL COMMENT '0: deny, 1: allow', PRIMARY KEY (`resource_id`, `role_id`) USING BTREE, INDEX `FKh8lunkrwoyio367ec8y12bis1` (`role_id` ASC) USING BTREE, CONSTRAINT `FKh8lunkrwoyio367ec8y12bis1` FOREIGN KEY (`role_id`) REFERENCES `rbac_role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, CONSTRAINT `FKr2orp5em3dob6f299ra9oyexr` FOREIGN KEY (`resource_id`) REFERENCES `rbac_resource_data` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic COMMENT '权限资源'; -- ---------------------------- -- Table structure for user -- ---------------------------- CREATE TABLE IF NOT EXISTS `rbac_user` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', `uid` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL UNIQUE COMMENT '用户UUID', `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户名', `created_time` datetime(6) NOT NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间', `gender` bigint NOT NULL COMMENT '创建用户', `role_id` bigint(20) NOT NULL COMMENT '用户权限组', `delete_time` datetime NULL DEFAULT NULL COMMENT '逻辑删除标记', PRIMARY KEY (`id`) USING BTREE, INDEX `fk_role_id` (`role_id`) USING BTREE, CONSTRAINT `fk_role_id` FOREIGN KEY (`role_id`) REFERENCES `rbac_role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1000 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic COMMENT '用户表'; -- ---------------------------- -- Table structure for user_credential -- ---------------------------- CREATE TABLE IF NOT EXISTS `rbac_user_credential` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', `credential` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户密码', `identifier` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '用户标识', `identity_type` smallint NULL DEFAULT NULL COMMENT '登录类型', `user_id` bigint NOT NULL DEFAULT -1 COMMENT '用户id', `state` smallint NOT NULL COMMENT '当前状态(CommonStatus):0-->正常,1-->锁定,2-->禁用,3-->删除', `error_cnt` smallint NOT NULL DEFAULT 0 COMMENT '密码错误次数', `lock_at` datetime(6) NULL COMMENT '账户锁定时间', `delete_time` datetime NULL DEFAULT NULL COMMENT '逻辑删除标记', PRIMARY KEY (`id`) USING BTREE, INDEX `FK6y499rs9ocqqa3kdpu2f32m86` (`user_id` ASC) USING BTREE, CONSTRAINT `FK6y499rs9ocqqa3kdpu2f32m86` FOREIGN KEY (`user_id`) REFERENCES `rbac_user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT ) ENGINE = InnoDB AUTO_INCREMENT = 1000 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic COMMENT '用户认证'; -- ---------------------------- -- Table structure for user_role -- ---------------------------- -- DROP TABLE IF EXISTS `user_role`; -- CREATE TABLE `user_role` -- ( -- `user_id` bigint NOT NULL COMMENT '用户id', -- `role_id` bigint NOT NULL COMMENT '权限id', -- PRIMARY KEY (`role_id`, `user_id`) USING BTREE, -- INDEX `FKfgsgxvihks805qcq8sq26ab7c` (`user_id` ASC) USING BTREE, -- CONSTRAINT `FKa68196081fvovjhkek5m97n3y` FOREIGN KEY (`role_id`) REFERENCES `role` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, -- CONSTRAINT `FKfgsgxvihks805qcq8sq26ab7c` FOREIGN KEY (`user_id`) REFERENCES `user` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT -- ) ENGINE = InnoDB -- CHARACTER SET = utf8mb4 -- COLLATE = utf8mb4_general_ci -- ROW_FORMAT = Dynamic COMMENT '用户权限'; -- ---------------------------- -- Table structure for resource -- ---------------------------- CREATE TABLE IF NOT EXISTS `rbac_resource_data` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', `uid` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL UNIQUE COMMENT '资源UUID', `path` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '资源URL', `name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '资源名称', `http_method` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'GET' COMMENT '资源访问 HTTP 方法 GET/POST/DELETE/...', `type_id` smallint NOT NULL COMMENT '资源类型(resource_type):0-->路由,1-->菜单,2-->按钮,...', CONSTRAINT `FKa68196081fvovjhkekresourcetype` FOREIGN KEY (`type_id`) REFERENCES `rbac_resource_type` (`type_id`) ON DELETE RESTRICT ON UPDATE RESTRICT, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1000 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for resource -- ---------------------------- CREATE TABLE IF NOT EXISTS `rbac_resource_type` ( `type_id` smallint NOT NULL COMMENT '资源类型:0-->路由,1-->菜单,2-->按钮,...', `name` varchar(256) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '资源名称', PRIMARY KEY (`type_id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1000 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic; -- ---------------------------- -- Table structure for stored_event -- ---------------------------- CREATE TABLE IF NOT EXISTS `sys_operation_log` ( `id` bigint NOT NULL AUTO_INCREMENT COMMENT 'id', `uid` varchar(48) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL UNIQUE COMMENT '操作日志UUID', `module` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作模块', `operation_type` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作类型', `operation_status` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作状态', `description` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作说明', `request_ip` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求来源 IP 地址', `call_function` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求接口', `http_method` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'HTTP 请求类型', `http_path` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '请求URI', `transmit_delay` bigint NULL DEFAULT NULL COMMENT '传输延时(ms)', `expend_time` bigint NULL DEFAULT NULL COMMENT '响应时间(ms)', `user_id` bigint NULL DEFAULT NULL COMMENT '操作用户id', `operation_time` datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '操作时间', `request_headers` varchar(4095) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'HTTP 请求头所有参数', `request` varchar(4095) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作请求参数', `result` varchar(4095) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '操作返回结果', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 1 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci ROW_FORMAT = Dynamic COMMENT '系统操作日志'; CREATE TABLE IF NOT EXISTS `sys_dict_data` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字典编码', `dict_sort` int(4) NULL DEFAULT 0 COMMENT '字典排序', `dict_label` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典标签', `dict_value` smallint NOT NULL COMMENT '字典键值', `type_id` bigint(20) NOT NULL COMMENT '字典类型', `css_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '样式属性(其他样式扩展)', `list_class` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '表格回显样式', `is_default` char(1) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT 'N' COMMENT '是否默认(Y是 N否)', `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', `create_time` datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间', `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', `update_time` datetime NULL DEFAULT NULL COMMENT '更新时间', `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', `delete_time` datetime NULL DEFAULT NULL COMMENT '逻辑删除标记', CONSTRAINT `FKa68196081fvovjhkekdicttype` FOREIGN KEY (`type_id`) REFERENCES `sys_dict_type` (`id`) ON DELETE RESTRICT ON UPDATE RESTRICT, PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '字典数据表' ROW_FORMAT = Dynamic; CREATE TABLE IF NOT EXISTS `sys_dict_type` ( `id` bigint(20) NOT NULL AUTO_INCREMENT COMMENT '字典主键', `dict_name` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典名称', `dict_type` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '字典类型', `create_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '创建者', `create_time` datetime(6) NULL DEFAULT CURRENT_TIMESTAMP(6) COMMENT '创建时间', `update_by` varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT '' COMMENT '更新者', `update_time` datetime(6) NULL DEFAULT NULL COMMENT '更新时间', `remark` varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '备注', `delete_time` datetime NULL DEFAULT NULL COMMENT '逻辑删除标记', PRIMARY KEY (`id`) USING BTREE, UNIQUE INDEX `dict_type` (`dict_type`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 100 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '字典类型表' ROW_FORMAT = Dynamic; SET FOREIGN_KEY_CHECKS = 1;