SET NAMES utf8mb4;
SET FOREIGN_KEY_CHECKS = 0;

DROP TABLE IF EXISTS `permission`;
CREATE TABLE `permission`  (
  `id` bigint NOT NULL COMMENT '权限ID (=前端permissionTree的key值)',
  `uuid` varchar(36) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '唯一标识符',
  `permission_name` varchar(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限名称',
  `permission_code` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '权限编码',
  `parent_id` bigint NULL DEFAULT NULL COMMENT '父权限ID',
  `type` tinyint NULL DEFAULT 1 COMMENT '1菜单 2按钮 3接口',
  `path` varchar(200) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '路由路径',
  `icon` varchar(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标',
  `sort_order` int NULL DEFAULT 0 COMMENT '排序',
  `status` tinyint NULL DEFAULT 1 COMMENT '1启用0禁用',
  `create_time` datetime NULL DEFAULT CURRENT_TIMESTAMP,
  `update_time` datetime NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`) USING BTREE,
  UNIQUE INDEX `uk_uuid`(`uuid` ASC) USING BTREE,
  UNIQUE INDEX `uk_code`(`permission_code` ASC) USING BTREE
) ENGINE = InnoDB CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '权限表' ROW_FORMAT = DYNAMIC;

INSERT INTO `permission` VALUES (1, 'k01', '制度文件查看和学习', 'read', NULL, 1, '/read', 'FileTextOutlined', 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (2, 'k02', '制度文件管理', 'manage', NULL, 1, '/manage', 'FolderOutlined', 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (3, 'k03', '知识问答', 'qa', NULL, 1, '/qa', 'MessageOutlined', 3, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (4, 'k04', '考察和训练', 'exam', NULL, 1, '/exam', 'FileSearchOutlined', 4, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (5, 'k05', '纲要学习', 'mind', NULL, 1, '/mind', 'UnorderedListOutlined', 5, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (6, 'k06', '综合看板', 'dashboard', NULL, 1, '/dashboard', 'DashboardOutlined', 6, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (7, 'k07', '权限管理', 'permission', NULL, 1, '/permission', 'TeamOutlined', 7, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (8, 'k08', '查看文件列表', 'read:view', 1, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (9, 'k09', '阅读文档', 'read:read', 1, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (10, 'k10', '上传文件', 'read:upload', 1, 2, NULL, NULL, 3, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (11, 'k11', '下载文件', 'read:download', 1, 2, NULL, NULL, 4, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (12, 'k12', '收藏功能', 'read:favorite', 1, 2, NULL, NULL, 5, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (13, 'k13', '管理文件', 'manage:file', 2, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (14, 'k14', '知识库同步', 'manage:sync', 2, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (15, 'k15', '题库维护', 'manage:question', 2, 2, NULL, NULL, 3, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (16, 'k16', '智能对话', 'qa:chat', 3, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (17, 'k17', 'FAQ管理', 'qa:faq', 3, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (18, 'k18', 'AI出题', 'exam:ai', 4, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (19, 'k19', '题库管理', 'exam:bank', 4, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (20, 'k20', '智能组卷', 'exam:paper', 4, 2, NULL, NULL, 3, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (21, 'k21', '互动训练', 'exam:train', 4, 2, NULL, NULL, 4, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (22, 'k22', '纲要生成', 'mind:generate', 5, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (23, 'k23', '智能预警', 'dashboard:alert', 6, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (24, 'k24', '决策支持', 'dashboard:decision', 6, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (25, 'k25', '角色管理', 'role', 7, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (26, 'k26', '用户管理', 'user', 7, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (27, 'k27', '互动学习', 'mind:learn', 5, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (33, 'k33', '日志管理', 'log:manage', 6, 1, '/logs', 'FileTextOutlined', 3, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (34, 'k34', '日志查询', 'log:query', 33, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (35, 'k35', '系统配置', 'config:manage', 6, 1, '/config', 'SettingOutlined', 4, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (36, 'k36', '配置查询', 'config:query', 35, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (37, 'k37', '配置修改', 'config:update', 35, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (38, 'k38', '用户管理(详细)', 'user:manage', 7, 1, NULL, NULL, 5, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (39, 'k39', '用户查询', 'user:query', 38, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (40, 'k40', '用户创建', 'user:create', 38, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (41, 'k41', '用户修改', 'user:update', 38, 2, NULL, NULL, 3, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (42, 'k42', '用户删除', 'user:delete', 38, 2, NULL, NULL, 4, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (43, 'k43', '角色管理(详细)', 'role:manage', 7, 1, NULL, NULL, 6, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (44, 'k44', '角色查询', 'role:query', 43, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (45, 'k45', '角色创建', 'role:create', 43, 2, NULL, NULL, 2, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (46, 'k46', '角色修改', 'role:update', 43, 2, NULL, NULL, 3, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (47, 'k47', '角色删除', 'role:delete', 43, 2, NULL, NULL, 4, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (48, 'k48', '权限管理(详细)', 'permission:manage', 7, 1, NULL, NULL, 7, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (49, 'k49', '权限查询', 'permission:query', 48, 2, NULL, NULL, 1, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (53, 'k53', '超级管理员', 'super_admin', NULL, 1, NULL, NULL, 0, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (54, 'k54', '管理员', 'admin', NULL, 1, NULL, NULL, 0, 1, '2026-04-17 14:17:11', '2026-04-17 14:17:11');
INSERT INTO `permission` VALUES (55, 'k55', '公司管理', 'company:manage', 7, 1, '/companies', 'BankOutlined', 3, 1, '2026-04-18 11:01:52', '2026-04-18 11:01:52');
INSERT INTO `permission` VALUES (60, 'k60', '部门管理', 'dept:manage', 7, 1, '/departments', 'ApartmentOutlined', 4, 1, '2026-04-18 11:01:52', '2026-04-18 11:01:52');
INSERT INTO `permission` VALUES (65, 'k65', '组织管理', 'organization:manage', 7, 1, '/organization', 'ApartmentOutlined', 3, 1, '2026-04-23 00:00:00', '2026-04-23 00:00:00');
INSERT INTO `permission` VALUES (66, 'k66', '文件审批', 'read:approve', 1, 2, NULL, NULL, 6, 1, '2026-05-02 00:00:00', '2026-05-02 00:00:00');
INSERT INTO `permission` VALUES (67, 'k67', '试卷考核', 'exam:exam', 4, 2, NULL, NULL, 5, 1, '2026-05-10 21:22:13', '2026-05-10 21:22:13');
INSERT INTO `permission` VALUES (68, 'k68', '题目管理与审批', 'read:questionBank', 1, 2, NULL, NULL, 7, 1, '2026-05-31 00:00:00', '2026-05-31 00:00:00');

SET FOREIGN_KEY_CHECKS = 1;
