use school_news;

-- 插入默认超级管理员用户（必须最先创建，因为后续数据的creator都需要引用此用户）
INSERT INTO `tb_sys_user` (id, username, password, email, status, create_time) VALUES
('1', 'superadmin', '$2a$10$/Bo2SXboVUpYfR6EA.y8puYQaMGBcuNYFY/EkQRY3w27IH56EuEcS', 'superadmin@example.com', 0, now());

-- 插入默认用户信息数据
INSERT INTO `tb_sys_user_info` (id, user_id, full_name, avatar, create_time) VALUES 
('1', '1', '超级管理员', 'default', now());

-- 插入部门数据（包含dept_path字段）
INSERT INTO `tb_sys_dept` (id, dept_id, name, parent_id, dept_path, description, creator, create_time) VALUES 
('1', 'root_department', '超级部门', NULL, '/root_department/', '系统超级部门', '1', now());
INSERT INTO `tb_sys_dept` (id, dept_id, name, parent_id, dept_path, description, creator, create_time) VALUES 
('2', 'default_department', '默认部门', 'root_department', '/root_department/default_department/', '系统默认创建的部门', '1', now());

-- 插入角色数据
INSERT INTO `tb_sys_role` (id,role_id, name, description, creator, create_time) VALUES 
('1','superadmin', '超级管理员', '超级管理员角色', '1', now());
INSERT INTO `tb_sys_role` (id,role_id, name, description, creator, create_time) VALUES 
('2','admin', '管理员', '管理员角色', '1', now());
INSERT INTO `tb_sys_role` (id,role_id, name, description, creator, create_time) VALUES 
('3','freedom', '自由角色', '自由角色', '1', now());

-- 插入部门-角色关联数据
INSERT INTO `tb_sys_dept_role` (id, dept_id, role_id, creator, create_time) VALUES 
('1', 'root_department', 'superadmin', '1', now()),
('2', 'default_department', 'admin', '1', now()),
('3', 'default_department', 'freedom', '1', now());

-- 插入用户-部门-角色关联数据（root_department的superadmin）
INSERT INTO `tb_sys_user_dept_role` (id, user_id, dept_id, role_id, creator, create_time) VALUES 
('1', '1', 'root_department', 'superadmin', '1', now());

-- 插入模块数据
INSERT INTO `tb_sys_module` (id, module_id, name, code, description, icon, order_num, status, creator, create_time) VALUES
('1', 'module_system', '系统管理', 'system', '系统管理模块', 'el-icon-setting', 1, 1, '1', now()),
('2', 'module_news', '新闻管理', 'news', '新闻管理模块', 'el-icon-document', 2, 1, '1', now()),
('3', 'module_study', '学习管理', 'study', '学习管理模块', 'el-icon-reading', 3, 1, '1', now()),
('4', 'module_ai', 'AI管理', 'ai', 'AI管理模块', 'el-icon-cpu', 4, 1, '1', now()),
('5', 'module_usercenter', '用户中心', 'usercenter', '用户中心模块', 'el-icon-user', 5, 1, '1', now()),
('6', 'module_file', '文件管理', 'file', '文件管理模块', 'el-icon-folder', 6, 1, '1', now()),
('7', 'module_crontab', '定时任务', 'crontab', '定时任务管理模块', 'el-icon-alarm-clock', 7, 1, '1', now()),
('8', 'module_message', '消息通知', 'message', '消息通知管理模块', 'el-icon-message', 8, 1, '1', now()),
('9', 'module_sensitive', '敏感词管理', 'sensitive', '敏感词管理模块', 'el-icon-warning', 9, 1, '1', now());

-- 插入权限数据
-- ============================================
-- 权限ID分配规则（每个模块预留100个ID）：
-- 9000-9999: 前端用户权限（默认权限）
-- 100-999:   超级管理员专属权限
-- 1000-8999: 普通管理员权限
-- ============================================

INSERT INTO `tb_sys_permission` (id, permission_id, name, code, description, module_id, creator, create_time) VALUES
-- ========== 前端用户权限 (9000-9999) ==========
-- 9000-9099: 默认权限和基础视图
('9000', 'perm_default', '默认权限', 'default', '所有登录用户的默认权限', 'module_system', '1', now()),
('9001', 'perm_view_home', '首页访问', 'view:home', '访问首页视图权限', 'module_usercenter', '1', now()),
('9002', 'perm_view_resource_hot', '热门资源访问', 'view:resource:hot', '访问热门资源视图权限', 'module_news', '1', now()),
('9003', 'perm_view_resource_center', '资源中心访问', 'view:resource:center', '访问资源中心视图权限', 'module_news', '1', now()),
('9004', 'perm_view_search', '搜索访问', 'view:search', '访问搜索视图权限', 'module_news', '1', now()),
('9005', 'perm_view_article_show', '文章展示访问', 'view:article:show', '访问文章展示视图权限', 'module_news', '1', now()),

-- 9100-9199: 学习计划相关
('9100', 'perm_view_study_tasks', '学习任务访问', 'view:study:tasks', '访问学习任务视图权限', 'module_study', '1', now()),
('9101', 'perm_view_course_center', '课程中心访问', 'view:course:center', '访问课程中心视图权限', 'module_study', '1', now()),
('9102', 'perm_view_task_detail', '任务详情访问', 'view:task:detail', '访问任务详情视图权限', 'module_study', '1', now()),
('9103', 'perm_view_course_detail', '课程详情访问', 'view:course:detail', '访问课程详情视图权限', 'module_study', '1', now()),
('9104', 'perm_view_course_study', '课程学习访问', 'view:course:study', '访问课程学习视图权限', 'module_study', '1', now()),

-- 9200-9299: 用户中心相关
('9200', 'perm_view_learning_records', '学习记录访问', 'view:learning:records', '访问学习记录视图权限', 'module_usercenter', '1', now()),
('9201', 'perm_view_my_favorites', '我的收藏访问', 'view:my:favorites', '访问我的收藏视图权限', 'module_usercenter', '1', now()),
('9202', 'perm_view_my_achievements', '我的成就访问', 'view:my:achievements', '访问我的成就视图权限', 'module_usercenter', '1', now()),
('9203', 'perm_view_personal_info', '个人信息访问', 'view:personal:info', '访问个人信息视图权限', 'module_usercenter', '1', now()),
('9204', 'perm_view_account_settings', '账号设置访问', 'view:account:settings', '访问账号设置视图权限', 'module_usercenter', '1', now()),

-- 9300-9399: 文章和消息相关
('9300', 'perm_view_article_add', '文章添加访问', 'view:article:add', '访问文章添加视图权限', 'module_news', '1', now()),
('9301', 'perm_view_message_center', '消息中心访问', 'view:message:center', '访问消息中心视图权限', 'module_message', '1', now()),
('9302', 'perm_view_message_detail', '消息详情访问', 'view:message:detail', '访问消息详情视图权限', 'module_message', '1', now()),

-- ========== 超级管理员专属权限 (100-999) ==========
-- 100-199: 系统总览
('100', 'perm_admin_overview', '系统总览', 'admin:overview', '访问系统总览视图权限（超级管理员）', 'module_system', '1', now()),

-- 200-299: 用户管理
('200', 'perm_admin_user_manage', '用户管理', 'admin:user:manage', '访问用户管理视图权限（超级管理员）', 'module_system', '1', now()),

-- 300-399: 部门管理
('300', 'perm_admin_dept_manage', '部门管理', 'admin:dept:manage', '访问部门管理视图权限（超级管理员）', 'module_system', '1', now()),

-- 400-499: 角色管理
('400', 'perm_admin_role_manage', '角色管理', 'admin:role:manage', '访问角色管理视图权限（超级管理员）', 'module_system', '1', now()),

-- 500-599: 菜单管理
('500', 'perm_admin_menu_manage', '菜单管理', 'admin:menu:manage', '访问菜单管理视图权限（超级管理员）', 'module_system', '1', now()),

-- 600-699: 模块权限管理
('600', 'perm_admin_module_permission_manage', '模块权限管理', 'admin:module:permission:manage', '访问模块权限管理视图权限（超级管理员）', 'module_system', '1', now()),

-- 700-799: 系统日志

('700', 'perm_admin_system_logs', '系统日志', 'admin:logs:system', '访问系统日志视图权限（超级管理员）', 'module_system', '1', now()),
('701', 'perm_admin_login_logs', '登录日志', 'admin:logs:login', '访问登录日志视图权限（超级管理员）', 'module_system', '1', now()),

-- 800-899: 系统配置
('800', 'perm_admin_system_config', '系统配置', 'admin:system:config', '访问系统配置视图权限（超级管理员）', 'module_system', '1', now()),

-- ========== 普通管理员权限 (1000-8999) ==========
-- 1000-1099: 资源管理
('1000', 'perm_admin_resource_manage', '资源数据采集', 'admin:resource:manage', '访问资源数据采集视图权限', 'module_news', '1', now()),

-- 1100-1199: 文章管理
('1100', 'perm_admin_article_manage', '文章管理', 'admin:article:manage', '访问文章管理视图权限', 'module_news', '1', now()),
('1101', 'perm_admin_article_force_publish', '文章强制发布', 'admin:article:force-publish', '强制发布文章权限（跳过敏感词校验）', 'module_news', '1', now()),

-- 1200-1299: Banner管理
('1200', 'perm_admin_banner_manage', 'Banner管理', 'admin:banner:manage', '访问Banner管理视图权限', 'module_news', '1', now()),

-- 1300-1399: 标签管理
('1300', 'perm_admin_tag_manage', '标签管理', 'admin:tag:manage', '访问标签管理视图权限', 'module_news', '1', now()),

-- 1400-1499: 栏目管理
('1400', 'perm_admin_column_manage', '栏目管理', 'admin:column:manage', '访问栏目管理视图权限', 'module_news', '1', now()),

-- 1500-1599: 敏感词管理
('1500', 'perm_admin_sensitive_manage', '敏感词管理', 'admin:sensitive:manage', '访问敏感词管理视图权限', 'module_sensitive', '1', now()),

-- 2000-2099: 任务管理
('2000', 'perm_admin_task_manage', '任务管理', 'admin:task:manage', '访问任务管理视图权限', 'module_study', '1', now()),

-- 2100-2199: 学习记录管理
('2100', 'perm_admin_study_records', '学习记录管理', 'admin:study:records', '访问学习记录管理视图权限', 'module_study', '1', now()),

-- 2200-2299: 课程管理
('2200', 'perm_admin_course_manage', '课程管理', 'admin:course:manage', '访问课程管理视图权限', 'module_study', '1', now()),
('2201', 'perm_admin_course_force_publish', '课程强制发布', 'admin:course:force-publish', '强制发布课程权限（跳过敏感词校验）', 'module_study', '1', now()),

-- 2300-2399: 成就管理
('2300', 'perm_admin_achievement_manage', '成就管理', 'admin:achievement:manage', '访问成就管理视图权限', 'module_study', '1', now()),

-- 3000-3099: AI配置
('3000', 'perm_admin_ai_config', 'AI配置', 'admin:ai:config', '访问AI配置视图权限', 'module_ai', '1', now()),

-- 3100-3199: 知识库管理
('3100', 'perm_admin_knowledge_manage', '知识库管理', 'admin:knowledge:manage', '访问知识库管理视图权限', 'module_ai', '1', now()),

-- 5000-5099: 邮件配置
('5000', 'perm_admin_meta_email_default', '默认接收人配置', 'admin:meta:email:default', '访问默认接收人配置视图权限', 'module_crontab', '1', now()),

-- 5100-5199: 定时任务日志
('5100', 'perm_admin_crontab_log', '定时任务执行日志', 'admin:crontab:log', '访问定时任务执行日志视图权限', 'module_crontab', '1', now()),

-- 5200-5299: 新闻爬虫配置
('5200', 'perm_admin_news_crawler', '新闻爬虫配置', 'admin:news:crawler', '访问新闻爬虫配置视图权限', 'module_crontab', '1', now()),

-- 5300-5399: 系统定时任务
('5300', 'perm_admin_system_task', '系统定时任务配置', 'admin:system:task', '访问系统定时任务配置视图权限', 'module_crontab', '1', now()),

-- 6000-6099: 消息管理
('6000', 'perm_admin_message_manage', '消息管理', 'admin:message:manage', '访问消息管理视图权限', 'module_message', '1', now());

-- 插入角色-权限关联数据
-- ============================================
-- 超级管理员：拥有所有权限（前端用户 + 超级管理员 + 普通管理员）
-- ============================================
INSERT INTO `tb_sys_role_permission` (id, role_id, permission_id, creator, create_time) VALUES
-- 前端用户权限 (9000-9999)
('1', 'superadmin', 'perm_default', '1', now()),
('2', 'superadmin', 'perm_view_home', '1', now()),
('3', 'superadmin', 'perm_view_resource_hot', '1', now()),
('4', 'superadmin', 'perm_view_resource_center', '1', now()),
('5', 'superadmin', 'perm_view_search', '1', now()),
('6', 'superadmin', 'perm_view_article_show', '1', now()),
('7', 'superadmin', 'perm_view_study_tasks', '1', now()),
('8', 'superadmin', 'perm_view_course_center', '1', now()),
('9', 'superadmin', 'perm_view_task_detail', '1', now()),
('10', 'superadmin', 'perm_view_course_detail', '1', now()),
('11', 'superadmin', 'perm_view_course_study', '1', now()),
('12', 'superadmin', 'perm_view_learning_records', '1', now()),
('13', 'superadmin', 'perm_view_my_favorites', '1', now()),
('14', 'superadmin', 'perm_view_my_achievements', '1', now()),
('15', 'superadmin', 'perm_view_personal_info', '1', now()),
('16', 'superadmin', 'perm_view_account_settings', '1', now()),
('17', 'superadmin', 'perm_view_article_add', '1', now()),
('18', 'superadmin', 'perm_view_message_center', '1', now()),
('19', 'superadmin', 'perm_view_message_detail', '1', now()),

-- 超级管理员专属权限 (100-999)
('20', 'superadmin', 'perm_admin_overview', '1', now()),
('21', 'superadmin', 'perm_admin_user_manage', '1', now()),
('22', 'superadmin', 'perm_admin_dept_manage', '1', now()),
('23', 'superadmin', 'perm_admin_role_manage', '1', now()),
('24', 'superadmin', 'perm_admin_menu_manage', '1', now()),
('25', 'superadmin', 'perm_admin_module_permission_manage', '1', now()),
('26', 'superadmin', 'perm_admin_system_logs', '1', now()),
('27', 'superadmin', 'perm_admin_login_logs', '1', now()),
('28', 'superadmin', 'perm_admin_system_config', '1', now()),

-- 普通管理员权限 (1000-8999)
('29', 'superadmin', 'perm_admin_resource_manage', '1', now()),
('30', 'superadmin', 'perm_admin_article_manage', '1', now()),
('46', 'superadmin', 'perm_admin_article_force_publish', '1', now()),
('31', 'superadmin', 'perm_admin_banner_manage', '1', now()),
('32', 'superadmin', 'perm_admin_tag_manage', '1', now()),
('33', 'superadmin', 'perm_admin_column_manage', '1', now()),
('34', 'superadmin', 'perm_admin_sensitive_manage', '1', now()),
('35', 'superadmin', 'perm_admin_task_manage', '1', now()),
('36', 'superadmin', 'perm_admin_study_records', '1', now()),
('37', 'superadmin', 'perm_admin_course_manage', '1', now()),
('47', 'superadmin', 'perm_admin_course_force_publish', '1', now()),
('38', 'superadmin', 'perm_admin_achievement_manage', '1', now()),
('39', 'superadmin', 'perm_admin_ai_config', '1', now()),
('40', 'superadmin', 'perm_admin_knowledge_manage', '1', now()),
('41', 'superadmin', 'perm_admin_meta_email_default', '1', now()),
('42', 'superadmin', 'perm_admin_crontab_log', '1', now()),
('43', 'superadmin', 'perm_admin_news_crawler', '1', now()),
('44', 'superadmin', 'perm_admin_system_task', '1', now()),
('45', 'superadmin', 'perm_admin_message_manage', '1', now()),

-- ============================================
-- 管理员：拥有前端用户权限 + 普通管理员权限（没有超级管理员专属权限）
-- ============================================
-- 前端用户权限 (9000-9999)
('100', 'admin', 'perm_default', '1', now()),
('101', 'admin', 'perm_view_home', '1', now()),
('102', 'admin', 'perm_view_resource_hot', '1', now()),
('103', 'admin', 'perm_view_resource_center', '1', now()),
('104', 'admin', 'perm_view_search', '1', now()),
('105', 'admin', 'perm_view_article_show', '1', now()),
('106', 'admin', 'perm_view_study_tasks', '1', now()),
('107', 'admin', 'perm_view_course_center', '1', now()),
('108', 'admin', 'perm_view_task_detail', '1', now()),
('109', 'admin', 'perm_view_course_detail', '1', now()),
('110', 'admin', 'perm_view_course_study', '1', now()),
('111', 'admin', 'perm_view_learning_records', '1', now()),
('112', 'admin', 'perm_view_my_favorites', '1', now()),
('113', 'admin', 'perm_view_my_achievements', '1', now()),
('114', 'admin', 'perm_view_personal_info', '1', now()),
('115', 'admin', 'perm_view_account_settings', '1', now()),
('116', 'admin', 'perm_view_article_add', '1', now()),
('117', 'admin', 'perm_view_message_center', '1', now()),
('118', 'admin', 'perm_view_message_detail', '1', now()),

-- 超级管理员权限中普通管理员也需要的部分
('139', 'admin', 'perm_admin_overview', '1', now()),
('119', 'admin', 'perm_admin_user_manage', '1', now()),
('120', 'admin', 'perm_admin_dept_manage', '1', now()),
('121', 'admin', 'perm_admin_role_manage', '1', now()),

-- 普通管理员权限 (1000-8999)
('122', 'admin', 'perm_admin_resource_manage', '1', now()),
('123', 'admin', 'perm_admin_article_manage', '1', now()),
('140', 'admin', 'perm_admin_article_force_publish', '1', now()),
('124', 'admin', 'perm_admin_banner_manage', '1', now()),
('125', 'admin', 'perm_admin_tag_manage', '1', now()),
('126', 'admin', 'perm_admin_column_manage', '1', now()),
('127', 'admin', 'perm_admin_sensitive_manage', '1', now()),
('128', 'admin', 'perm_admin_task_manage', '1', now()),
('129', 'admin', 'perm_admin_study_records', '1', now()),
('130', 'admin', 'perm_admin_course_manage', '1', now()),
('141', 'admin', 'perm_admin_course_force_publish', '1', now()),
('131', 'admin', 'perm_admin_achievement_manage', '1', now()),
('132', 'admin', 'perm_admin_ai_config', '1', now()),
('133', 'admin', 'perm_admin_knowledge_manage', '1', now()),
('134', 'admin', 'perm_admin_meta_email_default', '1', now()),
('135', 'admin', 'perm_admin_crontab_log', '1', now()),
('136', 'admin', 'perm_admin_news_crawler', '1', now()),
('137', 'admin', 'perm_admin_system_task', '1', now()),
('138', 'admin', 'perm_admin_message_manage', '1', now()),

-- ============================================
-- 自由角色：仅拥有前端用户权限
-- ============================================
('200', 'freedom', 'perm_default', '1', now()),
('201', 'freedom', 'perm_view_home', '1', now()),
('202', 'freedom', 'perm_view_resource_hot', '1', now()),
('203', 'freedom', 'perm_view_resource_center', '1', now()),
('204', 'freedom', 'perm_view_search', '1', now()),
('205', 'freedom', 'perm_view_article_show', '1', now()),
('206', 'freedom', 'perm_view_study_tasks', '1', now()),
('207', 'freedom', 'perm_view_course_center', '1', now()),
('208', 'freedom', 'perm_view_task_detail', '1', now()),
('209', 'freedom', 'perm_view_course_detail', '1', now()),
('210', 'freedom', 'perm_view_course_study', '1', now()),
('211', 'freedom', 'perm_view_learning_records', '1', now()),
('212', 'freedom', 'perm_view_my_favorites', '1', now()),
('213', 'freedom', 'perm_view_my_achievements', '1', now()),
('214', 'freedom', 'perm_view_personal_info', '1', now()),
('215', 'freedom', 'perm_view_account_settings', '1', now()),
('216', 'freedom', 'perm_view_article_add', '1', now()),
('217', 'freedom', 'perm_view_message_center', '1', now()),
('218', 'freedom', 'perm_view_message_detail', '1', now());

-- 插入前端菜单数据
-- 用户前端菜单 (100-699)
INSERT INTO `tb_sys_menu` VALUES 
('100', 'menu_home', '首页', NULL, '/home', 'user/home/HomeView', NULL, 1, 1, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('101', 'menu_resource_hot', '热门资源', NULL, '/resource-hot', 'user/resource-center/HotResourceView', NULL, 2, 3, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('200', 'menu_resource_center', '资源中心', NULL, '/resource-center', 'user/resource-center/ResourceCenterView', NULL, 2, 1, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('300', 'menu_study_plan', '学习计划', NULL, '/study-plan', '', NULL, 3, 1, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('301', 'menu_study_tasks', '学习任务', 'menu_study_plan', '/study-plan/tasks', 'user/study-plan/StudyTasksView', NULL, 1, 1, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('302', 'menu_course_center', '课程中心', 'menu_study_plan', '/study-plan/course', 'user/study-plan/CourseCenterView', NULL, 2, 1, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('303', 'menu_task_detail', '任务详情', 'menu_study_plan', '/study-plan/task-detail', 'user/study-plan/LearningTaskDetailView', NULL, 3, 3, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('304', 'menu_course_detail', '课程详情', 'menu_study_plan', '/study-plan/course-detail', 'user/study-plan/CourseDetailView', NULL, 4, 3, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('305', 'menu_course_study', '课程学习', 'menu_study_plan', '/study-plan/course-study', 'user/study-plan/CourseStudyView', NULL, 5, 3, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('400', 'menu_user_dropdown', '用户下拉菜单', NULL, '', '', NULL, 4, 0, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('401', 'menu_user_center', '个人中心', 'menu_user_dropdown', '/user-center', 'user/user-center/UserCenterLayout', NULL, 4, 1, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('402', 'menu_learning_records', '学习记录', 'menu_user_center', '/user-center/learning-records', 'user/user-center/LearningRecordsView', NULL, 1, 0, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('403', 'menu_my_favorites', '我的收藏', 'menu_user_center', '/user-center/favorites', 'user/user-center/MyFavoritesView', NULL, 2, 0, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('404', 'menu_my_achievements', '我的成就', 'menu_user_center', '/user-center/achievements', 'user/user-center/MyAchievementsView', NULL, 3, 0, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('650', 'menu_user_message_center', '消息中心', 'menu_user_center', '/user-center/message', 'user/message/MyMessageListView', NULL, 4, 0, 'NavigationLayout', '1', NULL, '2025-11-13 10:00:00', '2025-11-13 10:00:00', NULL, 0),
('500', 'menu_profile', '账号中心', 'menu_user_dropdown', '/profile', 'user/user-center/UserCenterLayout', NULL, 5, 1, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('501', 'menu_personal_info', '个人信息', 'menu_profile', '/profile/personal-info', 'user/user-center/profile/PersonalInfoView', NULL, 1, 0, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('502', 'menu_account_settings', '账号设置', 'menu_profile', '/profile/account-settings', 'user/user-center/profile/AccountSettingsView', NULL, 2, 0, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('503', 'menu_search', '搜索', NULL, '/search', 'user/resource-center/SearchView', NULL, 3, 0, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
-- 管理后台菜单 (1000-8999)
('1000', 'menu_admin_overview', '系统总览', NULL, '/admin/overview', 'admin/overview/SystemOverviewView', 'admin/overview.svg', 1, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:52:32', NULL, 0),
('2000', 'menu_sys_manage', '系统管理', NULL, '', '', 'admin/settings.svg', 2, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:52:35', NULL, 0),
('2001', 'menu_admin_user', '用户管理', 'menu_sys_manage', '/admin/manage/system/user', 'admin/manage/system/UserManageView', NULL, 1, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:52:38', NULL, 0),
('2002', 'menu_admin_dept', '部门管理', 'menu_sys_manage', '/admin/manage/system/dept', 'admin/manage/system/DeptManageView', NULL, 2, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('2003', 'menu_admin_role', '角色管理', 'menu_sys_manage', '/admin/manage/system/role', 'admin/manage/system/RoleManageView', NULL, 3, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('2005', 'menu_admin_menu', '菜单管理', 'menu_sys_manage', '/admin/manage/system/menu', 'admin/manage/system/MenuManageView', NULL, 4, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('2006', 'menu_admin_module', '模块权限管理', 'menu_sys_manage', '/admin/manage/system/module-permission', 'admin/manage/system/ModulePermissionManageView', NULL, 5, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('3000', 'menu_admin_resource_manage', '资源管理', NULL, '', '', 'admin/resource.svg', 3, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:52:40', NULL, 0),
('3001', 'menu_admin_resource', '数据采集', 'menu_admin_resource_manage', '/admin/manage/resource/resource', 'admin/manage/resource/ResourceManagementView', NULL, 1, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('3002', 'menu_admin_article', '文章管理', 'menu_admin_resource_manage', '/admin/manage/resource/article', 'admin/manage/resource/ArticleManagementView', NULL, 2, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('3010', 'menu_article_add', '文章添加', NULL, '/article/add', 'public/article/ArticleAddView', NULL, 1, 3, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('3011', 'menu_article_show', '文章展示', NULL, '/article/show', 'public/article/ArticleShowView', NULL, 2, 3, 'NavigationLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('4000', 'menu_admin_content_manage', '运营管理', NULL, '', '', 'admin/maintain.svg', 4, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:52:42', NULL, 0),
('4001', 'menu_admin_banner', 'Banner管理', 'menu_admin_content_manage', '/admin/manage/content/banner', 'admin/manage/content/BannerManagementView', NULL, 1, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('4002', 'menu_admin_tag', '标签管理', 'menu_admin_content_manage', '/admin/manage/content/tag', 'admin/manage/content/TagManagementView', NULL, 2, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('4003', 'menu_admin_column', '栏目管理', 'menu_admin_content_manage', '/admin/manage/content/column', 'admin/manage/content/ColumnManagementView', NULL, 3, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:49:56', NULL, 0),
('4004', 'menu_admin_sensitive', '敏感词管理', 'menu_admin_content_manage', '/admin/manage/content/sensitive', 'admin/manage/content/SensitiveManagementView', NULL, 4, 0, 'SidebarLayout', '1', NULL, '2025-11-22 11:30:00', '2025-11-22 11:30:00', NULL, 0),
('5000', 'menu_admin_study_manage', '学习管理', NULL, '', '', 'admin/study.svg', 5, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:52:46', NULL, 0),
('5002', 'menu_admin_task_manage', '任务管理', 'menu_admin_study_manage', '/admin/manage/study/task-manage', 'admin/manage/study/TaskManageView', NULL, 2, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('5003', 'menu_admin_study_records', '学习记录', 'menu_admin_study_manage', '/admin/manage/study/study-records', 'admin/manage/study/StudyRecordsView', NULL, 3, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('5004', 'menu_admin_course_manage', '课程管理', 'menu_admin_study_manage', '/admin/manage/study/course', 'admin/manage/study/CourseManagementView', NULL, 4, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:52:48', NULL, 0),
('5005', 'menu_admin_achievement_manage', '成就管理', 'menu_admin_study_manage', '/admin/manage/study/achievement', 'admin/manage/achievement/AchievementManagementView', NULL, 5, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('6000', 'menu_admin_ai_manage', '智能体管理', NULL, '', '', 'admin/agent.svg', 6, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:52:50', NULL, 0),
('6002', 'menu_admin_ai_config', 'AI配置', 'menu_admin_ai_manage', '/admin/manage/ai/config', 'admin/manage/ai/AIConfigView', NULL, 2, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('6003', 'menu_admin_knowledge', '知识库管理', 'menu_admin_ai_manage', '/admin/manage/ai/knowledge', 'admin/manage/ai/KnowledgeManagementView', NULL, 3, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('7000', 'menu_admin_logs_manage', '系统日志', 'menu_sys_manage', '', '', NULL, 6, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:52:53', NULL, 0),
('7001', 'menu_admin_system_logs', '系统日志', 'menu_admin_logs_manage', '/admin/manage/logs/system', 'admin/manage/logs/SystemLogsView', NULL, 1, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('7002', 'menu_admin_login_logs', '登录日志', 'menu_admin_logs_manage', '/admin/manage/logs/login', 'admin/manage/logs/LoginLogsView', NULL, 2, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('7003', 'menu_admin_system_config', '系统配置', 'menu_sys_manage', '/admin/manage/system/config', 'admin/manage/system/SystemConfigView', NULL, 7, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('8000', 'menu_admin_crontab_manage', '定时任务管理', NULL, '', '', 'admin/crontab.svg', 8, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('8001', 'menu_admin_meta_email_default', '默认接收人配置', 'menu_admin_crontab_manage', '/admin/manage/crontab/meta-email-default', 'admin/manage/crontab/MetaEmailDefaultView', NULL, 1, 0, 'SidebarLayout', '1', NULL, '2025-11-18 18:00:00', '2025-11-18 18:00:00', NULL, 0),
('8002', 'menu_admin_crontab_log', '执行日志', 'menu_admin_crontab_manage', '/admin/manage/crontab/log', 'admin/manage/crontab/LogManagementView', NULL, 2, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('8003', 'menu_admin_news_crawler', '新闻爬虫配置', 'menu_admin_crontab_manage', '/admin/manage/crontab/news-crawler', 'admin/manage/crontab/NewsCrawlerView', NULL, 3, 0, 'SidebarLayout', '1', NULL, '2025-10-27 17:26:06', '2025-10-29 11:48:39', NULL, 0),
('8004', 'menu_admin_system_task', '系统定时任务配置', 'menu_admin_crontab_manage', '/admin/manage/crontab/system-task', 'admin/manage/crontab/SystemTaskView', NULL, 4, 0, 'SidebarLayout', '1', NULL, '2025-11-25 13:45:00', '2025-11-25 13:45:00', NULL, 0),
-- 消息通知模块菜单 (9000-9999)
('9001', 'menu_admin_message_manage', '消息管理', NULL, '/admin/manage/message', 'admin/manage/message/MessageManageView', 'admin/notice.svg', 9, 0, 'SidebarLayout', '1', NULL, '2025-11-13 10:00:00', '2025-11-13 10:00:00', NULL, 0),
-- 用户端消息详情菜单 (651)
('651', 'menu_user_message_detail', '消息详情', 'menu_user_message_center', '/user-center/message/detail/:messageID', 'user/message/MyMessageDetailView', NULL, 1, 3, 'NavigationLayout', '1', NULL, '2025-11-13 10:00:00', '2025-11-13 10:00:00', NULL, 0);

-- 插入菜单权限关联数据
-- ============================================
-- 说明：每个有View的菜单对应一个权限
-- 无View的菜单（如导航菜单）关联默认权限
-- ============================================
INSERT INTO `tb_sys_menu_permission` (id, permission_id, menu_id, creator, create_time) VALUES

-- ========== 前端用户菜单权限关联 (9000-9999) ==========
-- 基础视图
('9001', 'perm_view_home', 'menu_home', '1', now()),
('9002', 'perm_view_resource_hot', 'menu_resource_hot', '1', now()),
('9003', 'perm_view_resource_center', 'menu_resource_center', '1', now()),
('9004', 'perm_view_search', 'menu_search', '1', now()),
('9005', 'perm_view_article_show', 'menu_article_show', '1', now()),

-- 学习计划相关
('9006', 'perm_default', 'menu_study_plan', '1', now()),  -- 无View的导航菜单
('9100', 'perm_view_study_tasks', 'menu_study_tasks', '1', now()),
('9101', 'perm_view_course_center', 'menu_course_center', '1', now()),
('9102', 'perm_view_task_detail', 'menu_task_detail', '1', now()),
('9103', 'perm_view_course_detail', 'menu_course_detail', '1', now()),
('9104', 'perm_view_course_study', 'menu_course_study', '1', now()),

-- 用户中心相关
('9007', 'perm_default', 'menu_user_dropdown', '1', now()),  -- 无View的导航菜单
('9008', 'perm_default', 'menu_user_center', '1', now()),  -- Layout菜单
('9200', 'perm_view_learning_records', 'menu_learning_records', '1', now()),
('9201', 'perm_view_my_favorites', 'menu_my_favorites', '1', now()),
('9202', 'perm_view_my_achievements', 'menu_my_achievements', '1', now()),

-- 个人信息相关
('9009', 'perm_default', 'menu_profile', '1', now()),  -- Layout菜单
('9203', 'perm_view_personal_info', 'menu_personal_info', '1', now()),
('9204', 'perm_view_account_settings', 'menu_account_settings', '1', now()),

-- 文章和消息
('9300', 'perm_view_article_add', 'menu_article_add', '1', now()),
('9301', 'perm_view_message_center', 'menu_user_message_center', '1', now()),
('9302', 'perm_view_message_detail', 'menu_user_message_detail', '1', now()),

-- ========== 超级管理员菜单权限关联 (100-999) ==========
-- 系统总览
('100', 'perm_admin_overview', 'menu_admin_overview', '1', now()),

-- 系统管理
('101', 'perm_default', 'menu_sys_manage', '1', now()),  -- 无View的导航菜单
('200', 'perm_admin_user_manage', 'menu_admin_user', '1', now()),
('300', 'perm_admin_dept_manage', 'menu_admin_dept', '1', now()),
('400', 'perm_admin_role_manage', 'menu_admin_role', '1', now()),
('500', 'perm_admin_menu_manage', 'menu_admin_menu', '1', now()),
('600', 'perm_admin_module_permission_manage', 'menu_admin_module', '1', now()),

-- 系统日志
('102', 'perm_admin_system_logs', 'menu_admin_logs_manage', '1', now()),  -- 无View的导航菜单
('700', 'perm_admin_system_logs', 'menu_admin_system_logs', '1', now()),
('701', 'perm_admin_login_logs', 'menu_admin_login_logs', '1', now()),

-- 系统配置
('800', 'perm_admin_system_config', 'menu_admin_system_config', '1', now()),

-- ========== 普通管理员菜单权限关联 (1000-8999) ==========
-- 资源管理
('103', 'perm_default', 'menu_admin_resource_manage', '1', now()),  -- 无View的导航菜单
('1000', 'perm_admin_resource_manage', 'menu_admin_resource', '1', now()),
('1100', 'perm_admin_article_manage', 'menu_admin_article', '1', now()),

-- 运营管理
('104', 'perm_default', 'menu_admin_content_manage', '1', now()),  -- 无View的导航菜单
('1200', 'perm_admin_banner_manage', 'menu_admin_banner', '1', now()),
('1300', 'perm_admin_tag_manage', 'menu_admin_tag', '1', now()),
('1400', 'perm_admin_column_manage', 'menu_admin_column', '1', now()),
('1500', 'perm_admin_sensitive_manage', 'menu_admin_sensitive', '1', now()),

-- 学习管理
('105', 'perm_default', 'menu_admin_study_manage', '1', now()),  -- 无View的导航菜单
('2000', 'perm_admin_task_manage', 'menu_admin_task_manage', '1', now()),
('2100', 'perm_admin_study_records', 'menu_admin_study_records', '1', now()),
('2200', 'perm_admin_course_manage', 'menu_admin_course_manage', '1', now()),
('2300', 'perm_admin_achievement_manage', 'menu_admin_achievement_manage', '1', now()),

-- AI管理
('106', 'perm_default', 'menu_admin_ai_manage', '1', now()),  -- 无View的导航菜单
('3000', 'perm_admin_ai_config', 'menu_admin_ai_config', '1', now()),
('3100', 'perm_admin_knowledge_manage', 'menu_admin_knowledge', '1', now()),

-- 定时任务管理
('107', 'perm_default', 'menu_admin_crontab_manage', '1', now()),  -- 无View的导航菜单
('5000', 'perm_admin_meta_email_default', 'menu_admin_meta_email_default', '1', now()),
('5100', 'perm_admin_crontab_log', 'menu_admin_crontab_log', '1', now()),
('5200', 'perm_admin_news_crawler', 'menu_admin_news_crawler', '1', now()),
('5300', 'perm_admin_system_task', 'menu_admin_system_task', '1', now()),

-- 消息管理
('6000', 'perm_admin_message_manage', 'menu_admin_message_manage', '1', now());

