use school_news;

-- 插入部门数据
INSERT INTO `tb_sys_dept` (id,dept_id,name, description) VALUES ('1','root_department', '超级部门', '系统超级部门');
INSERT INTO `tb_sys_dept` (id,dept_id,name, parent_id, description) VALUES ('2','default_department', '默认部门', 'root_department', '系统默认创建的部门');

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

-- 插入部门-角色关联数据
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());

-- 插入用户-角色关联数据
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());

-- 插入权限数据
INSERT INTO `tb_sys_permission` (id,permission_id, name, code, description, module_id, creator, create_time) VALUES 
('0','perm_default', '默认权限', 'default', '默认权限', 'module_system', '1', now()),
('1','perm_system_manage', '系统管理', 'system:manage', '系统管理权限', 'module_system', '1', now()),
('2','perm_system_dept_manage', '系统部门查看', 'system:dept:manage', '系统部门查看权限', 'module_system', '1', now()),
('3','perm_system_menu_manage', '系统菜单查看', 'system:menu:manage', '系统菜单查看权限', 'module_system', '1', now()),
('4','perm_system_permission_manage', '系统权限查看', 'system:permission:manage', '系统权限查看权限', 'module_system', '1', now()),
('5','perm_system_role_manage', '系统角色查看', 'system:role:manage', '系统角色查看权限', 'module_system', '1', now()),
('6','perm_system_user_manage', '系统用户查看', 'system:user:manage', '系统用户查看权限', 'module_system', '1', now()),
('7','perm_system_module_manage', '系统模块查看', 'system:module:manage', '系统模块查看权限', 'module_system', '1', now()),
('8','perm_news_manage', '新闻管理', 'news:manage', '新闻管理权限', 'module_news', '1', now()),
('9','perm_news_article_add', '文章添加', 'news:manage', '文章添加权限', 'module_news', '1', now()),
('10','perm_study_manage', '学习管理', 'study:manage', '学习管理权限', 'module_study', '1', now()),
('11','perm_ai_manage', 'AI管理', 'ai:manage', 'AI管理权限', 'module_ai', '1', now()),
('12','perm_usercenter_manage', '用户中心管理', 'usercenter:manage', '用户中心管理权限', 'module_usercenter', '1', now()),
('13','perm_file_manage', '文件管理', 'file:manage', '文件管理权限', 'module_file', '1', now());

-- 插入角色-权限关联数据
INSERT INTO `tb_sys_role_permission` (id, role_id, permission_id, creator, create_time) VALUES
('0', 'superadmin', 'perm_default', '1', now()),
('1', 'superadmin', 'perm_system_manage', '1', now()),
('2', 'superadmin', 'perm_system_dept_manage', '1', now()),
('3', 'superadmin', 'perm_system_menu_manage', '1', now()),
('4', 'superadmin', 'perm_system_permission_manage', '1', now()),
('5', 'superadmin', 'perm_system_role_manage', '1', now()),
('6', 'superadmin', 'perm_system_user_manage', '1', now()),
('7', 'superadmin', 'perm_system_module_manage', '1', now()),
('8', 'superadmin', 'perm_news_manage', '1', now()),
('9', 'superadmin', 'perm_news_article_add', '1', now()),
('10', 'superadmin', 'perm_study_manage', '1', now()),
('11', 'superadmin', 'perm_ai_manage', '1', now()),
('12', 'superadmin', 'perm_usercenter_manage', '1', now()),
('13', 'superadmin', 'perm_file_manage', '1', now()),
('14', 'freedom', 'perm_default', '1', now());

-- 插入前端菜单数据
INSERT INTO `tb_sys_menu` (id, menu_id, name, parent_id, url, component, icon, order_num, type, layout, creator, create_time) VALUES
('100', 'menu_home', '首页', NULL, '/home', 'home/HomeView', 'el-icon-house', 1, 1, 'NavigationLayout', '1', now()),
-- 资源中心
('200', 'menu_resource_center', '资源中心', NULL, '/resource-center', 'resource-center/ResourceCenterView', 'el-icon-folder-opened', 2, 1, 'NavigationLayout', '1', now()),
-- 学习计划
('300', 'menu_study_plan', '学习计划', NULL, '/study-plan', 'study-plan/StudyPlanView', 'el-icon-reading', 3, 1, 'NavigationLayout', '1', now()),
('301', 'menu_study_tasks', '学习任务', 'menu_study_plan', '/study-plan/tasks', 'study-plan/StudyTasksView', 'el-icon-s-order', 1, 1, 'NavigationLayout', '1', now()),
('302', 'menu_course_center', '课程中心', 'menu_study_plan', '/study-plan/course', 'study-plan/CourseCenterView', 'el-icon-video-play', 2, 1, 'NavigationLayout', '1', now()),
('303', 'menu_task_detail', '任务详情', 'menu_study_plan', '/study-plan/task-detail', 'study-plan/LearningTaskDetailView', 'el-icon-document', 3, 3, 'NavigationLayout', '1', now()),
('304', 'menu_course_detail', '课程详情', 'menu_study_plan', '/study-plan/course-detail', 'study-plan/CourseDetailView', 'el-icon-video-play', 4, 3, 'NavigationLayout', '1', now()),
('305', 'menu_course_study', '课程学习', 'menu_study_plan', '/study-plan/course-study', 'study-plan/CourseStudyView', 'el-icon-video-play', 5, 3, 'NavigationLayout', '1', now()),
('400', 'menu_user_dropdown', '用户下拉菜单', NULL, '', '', 'el-icon-user', 4, 0, 'NavigationLayout', '1', now()),
-- 个人中心
('401', 'menu_user_center', '个人中心', 'menu_user_dropdown', '/user-center', 'user-center/UserCenterView', 'el-icon-user', 4, 1, 'NavigationLayout', '1', now()),
('402', 'menu_learning_records', '学习记录', 'menu_user_center', '/user-center/learning-records', 'user-center/LearningRecordsView', 'el-icon-document', 1, 0, 'NavigationLayout', '1', now()),
('403', 'menu_my_favorites', '我的收藏', 'menu_user_center', '/user-center/favorites', 'user-center/MyFavoritesView', 'el-icon-star-on', 2, 0, 'NavigationLayout', '1', now()),
('404', 'menu_my_achievements', '我的成就', 'menu_user_center', '/user-center/achievements', 'user-center/MyAchievementsView', 'el-icon-trophy', 3, 0, 'NavigationLayout', '1', now()),

-- 账号中心
('500', 'menu_profile', '账号中心', 'menu_user_dropdown', '/profile', 'profile/ProfileView', 'el-icon-user-solid', 5, 1, 'NavigationLayout', '1', now()),
('501', 'menu_personal_info', '个人信息', 'menu_profile', '/profile/personal-info', 'profile/PersonalInfoView', 'el-icon-user', 1, 0, 'NavigationLayout', '1', now()),
('502', 'menu_account_settings', '账号设置', 'menu_profile', '/profile/account-settings', 'profile/AccountSettingsView', 'el-icon-setting', 2, 0, 'NavigationLayout', '1', now()),

-- 智能体模块
('600', 'menu_ai_assistant', '智能体模块', NULL, '/ai-assistant', 'ai-assistant/AIAssistantView', 'el-icon-cpu', 6, 1, 'NavigationLayout', '1', now());

-- 插入后端管理菜单数据
INSERT INTO `tb_sys_menu` (id, menu_id, name, parent_id, url, component, icon, order_num, type, layout, creator, create_time) VALUES
-- 系统总览
('1000', 'menu_admin_overview', '系统总览', NULL, '/admin/overview', 'admin/overview/SystemOverviewView', 'el-icon-data-analysis', 1, 1, 'NavigationLayout', '1', now()),

-- 用户管理
('2000', 'menu_sys_manage', '系统管理', NULL, '', '', 'el-icon-user', 2, 1, '', '1', now()),
('2001', 'menu_admin_user', '用户管理', 'menu_sys_manage', '/admin/manage/system/user', 'admin/manage/system/UserManageView', 'el-icon-user', 1, 1, 'NavigationLayout', '1', now()),
('2002', 'menu_admin_dept', '部门管理', 'menu_sys_manage', '/admin/manage/system/dept', 'admin/manage/system/DeptManageView', 'el-icon-office-building', 2, 1, 'NavigationLayout', '1', now()),
('2003', 'menu_admin_role', '角色管理', 'menu_sys_manage', '/admin/manage/system/role', 'admin/manage/system/RoleManageView', 'el-icon-user-solid', 3, 1, 'NavigationLayout', '1', now()),
('2004', 'menu_admin_permission', '权限管理', 'menu_sys_manage', '/admin/manage/system/permission', 'admin/manage/system/PermissionManageView', 'el-icon-key', 4, 1, 'NavigationLayout', '1', now()),
('2005', 'menu_admin_menu', '菜单管理', 'menu_sys_manage', '/admin/manage/system/menu', 'admin/manage/system/MenuManageView', 'el-icon-menu', 5, 1, 'NavigationLayout', '1', now()),
('2006', 'menu_admin_module', '模块管理', 'menu_sys_manage', '/admin/manage/system/module', 'admin/manage/system/ModuleManageView', 'el-icon-s-grid', 6, 1, 'NavigationLayout', '1', now()),

-- 资源管理
('3000', 'menu_admin_resource_manage', '资源管理', NULL, '', '', 'el-icon-folder', 3, 1, '', '1', now()),
('3001', 'menu_admin_resource', '资源管理', 'menu_admin_resource_manage', '/admin/manage/resource/resource', 'admin/manage/resource/ResourceManagementView', 'el-icon-folder', 1, 1, 'NavigationLayout', '1', now()),
('3002', 'menu_admin_article', '文章管理', 'menu_admin_resource_manage', '/admin/manage/resource/article', 'admin/manage/resource/ArticleManagementView', 'el-icon-document', 2, 1, 'NavigationLayout', '1', now()),
('3003', 'menu_admin_data_records', '数据记录', 'menu_admin_resource_manage', '/admin/manage/resource/data-records', 'admin/manage/resource/DataRecordsView', 'el-icon-data-line', 3, 1, 'NavigationLayout', '1', now()),


-- 文章相关
('3010', 'menu_article_add', '文章添加', 'menu_admin_article', '/article/add', 'article/ArticleAddView', 'el-icon-plus', 1, 3, 'NavigationLayout', '1', now()),
('3011', 'menu_article_show', '文章展示', 'menu_admin_article', '/article/show', 'article/ArticleShowView', 'el-icon-document', 2, 3, 'NavigationLayout', '1', now()),
-- 运营管理
('4000', 'menu_admin_content_manage', '运营管理', NULL, '', '', 'el-icon-s-operation', 4, 1, '', '1', now()),
('4001', 'menu_admin_banner', 'Banner管理', 'menu_admin_content_manage', '/admin/manage/content/banner', 'admin/manage/content/BannerManagementView', 'el-icon-picture', 1, 1, 'NavigationLayout', '1', now()),
('4002', 'menu_admin_tag', '标签管理', 'menu_admin_content_manage', '/admin/manage/content/tag', 'admin/manage/content/TagManagementView', 'el-icon-price-tag', 2, 1, 'NavigationLayout', '1', now()),
('4003', 'menu_admin_column', '栏目管理', 'menu_admin_content_manage', '/admin/manage/content/column', 'admin/manage/content/ColumnManagementView', 'el-icon-menu', 3, 1, 'NavigationLayout', '1', now()),
('4004', 'menu_admin_content', '内容管理', 'menu_admin_content_manage', '/admin/manage/content/content', 'admin/manage/content/ContentManagementView', 'el-icon-document', 4, 1, 'NavigationLayout', '1', now()),

-- 学习管理
('5000', 'menu_admin_study_manage', '学习管理', NULL, '', '', 'el-icon-reading', 5, 1, '', '1', now()),
('5002', 'menu_admin_task_manage', '任务管理', 'menu_admin_study_manage', '/admin/manage/study/task-manage', 'admin/manage/study/TaskManageView', 'el-icon-s-order', 2, 1, 'NavigationLayout', '1', now()),
('5003', 'menu_admin_study_records', '学习记录', 'menu_admin_study_manage', '/admin/manage/study/study-records', 'admin/manage/study/StudyRecordsView', 'el-icon-document', 3, 1, 'NavigationLayout', '1', now()),
('5004', 'menu_admin_course_manage', '课程管理', 'menu_admin_study_manage', '/admin/manage/study/course', 'admin/manage/study/CourseManagementView', 'el-icon-video-play', 4, 1, 'NavigationLayout', '1', now()),
-- 智能体管理
('6000', 'menu_admin_ai_manage', '智能体管理', NULL, '', '', 'el-icon-cpu', 6, 1, '', '1', now()),
('6001', 'menu_admin_ai', 'AI管理', 'menu_admin_ai_manage', '/admin/manage/ai/ai', 'admin/manage/ai/AIManagementView', 'el-icon-cpu', 1, 1, 'NavigationLayout', '1', now()),
('6002', 'menu_admin_ai_config', 'AI配置', 'menu_admin_ai_manage', '/admin/manage/ai/config', 'admin/manage/ai/AIConfigView', 'el-icon-setting', 2, 1, 'NavigationLayout', '1', now()),
('6003', 'menu_admin_knowledge', '知识库管理', 'menu_admin_ai_manage', '/admin/manage/ai/knowledge', 'admin/manage/ai/KnowledgeManagementView', 'el-icon-collection', 3, 1, 'NavigationLayout', '1', now()),

-- 系统日志
('7000', 'menu_admin_logs_manage', '系统日志', NULL, '', '', 'el-icon-document', 7, 1, '', '1', now()),
('7001', 'menu_admin_system_logs', '系统日志', 'menu_admin_logs_manage', '/admin/manage/logs/system', 'admin/manage/logs/SystemLogsView', 'el-icon-document', 1, 1, 'NavigationLayout', '1', now()),
('7002', 'menu_admin_login_logs', '登录日志', 'menu_admin_logs_manage', '/admin/manage/logs/login', 'admin/manage/logs/LoginLogsView', 'el-icon-key', 2, 1, 'NavigationLayout', '1', now()),
('7003', 'menu_admin_operation_logs', '操作日志', 'menu_admin_logs_manage', '/admin/manage/logs/operation', 'admin/manage/logs/OperationLogsView', 'el-icon-s-operation', 3, 1, 'NavigationLayout', '1', now()),
('7004', 'menu_admin_system_config', '系统配置', 'menu_admin_logs_manage', '/admin/manage/logs/config', 'admin/manage/logs/SystemConfigView', 'el-icon-setting', 4, 1, 'NavigationLayout', '1', now());

-- 插入菜单权限关联数据
INSERT INTO `tb_sys_menu_permission` (id, permission_id, menu_id, creator, create_time) VALUES
-- 前端菜单权限关联
('100', 'perm_default', 'menu_home', '1', now()),
('101', 'perm_default', 'menu_resource_center', '1', now()),
('108', 'perm_default', 'menu_study_plan', '1', now()),
('109', 'perm_default', 'menu_study_tasks', '1', now()),
('110', 'perm_default', 'menu_course_center', '1', now()),
('111', 'perm_default', 'menu_user_center', '1', now()),
('112', 'perm_default', 'menu_learning_records', '1', now()),
('113', 'perm_default', 'menu_my_favorites', '1', now()),
('114', 'perm_default', 'menu_my_achievements', '1', now()),
('115', 'perm_default', 'menu_profile', '1', now()),
('116', 'perm_default', 'menu_personal_info', '1', now()),
('117', 'perm_default', 'menu_account_settings', '1', now()),
('118', 'perm_ai_manage', 'menu_ai_assistant', '1', now()),
('119', 'perm_default', 'menu_user_dropdown', '1', now()),
('120', 'perm_news_article_add', 'menu_article_add', '1', now()),
('121', 'perm_default', 'menu_task_detail', '1', now()),
('122', 'perm_default', 'menu_course_detail', '1', now()),
('123', 'perm_default', 'menu_course_study', '1', now()),
('124', 'perm_default', 'menu_article_show', '1', now()),


-- 后端管理菜单权限关联
('200', 'perm_system_manage', 'menu_admin_overview', '1', now()),
('201', 'perm_system_manage', 'menu_sys_manage', '1', now()),
('203', 'perm_system_user_manage', 'menu_admin_user', '1', now()),
('204', 'perm_system_dept_manage', 'menu_admin_dept', '1', now()),
('205', 'perm_system_role_manage', 'menu_admin_role', '1', now()),
('206', 'perm_system_permission_manage', 'menu_admin_permission', '1', now()),
('207', 'perm_system_menu_manage', 'menu_admin_menu', '1', now()),
('208', 'perm_system_module_manage', 'menu_admin_module', '1', now()),
('209', 'perm_news_manage', 'menu_admin_resource_manage', '1', now()),
('210', 'perm_news_manage', 'menu_admin_resource', '1', now()),
('211', 'perm_news_manage', 'menu_admin_article', '1', now()),
('212', 'perm_news_manage', 'menu_admin_data_records', '1', now()),
('213', 'perm_news_manage', 'menu_admin_content_manage', '1', now()),
('214', 'perm_news_manage', 'menu_admin_banner', '1', now()),
('215', 'perm_news_manage', 'menu_admin_tag', '1', now()),
('216', 'perm_news_manage', 'menu_admin_column', '1', now()),
('217', 'perm_news_manage', 'menu_admin_content', '1', now()),
('218', 'perm_study_manage', 'menu_admin_study_manage', '1', now()),
('220', 'perm_study_manage', 'menu_admin_task_manage', '1', now()),
('221', 'perm_study_manage', 'menu_admin_study_records', '1', now()),
('222', 'perm_study_manage', 'menu_admin_course_manage', '1', now()),
('223', 'perm_ai_manage', 'menu_admin_ai_manage', '1', now()),
('224', 'perm_ai_manage', 'menu_admin_ai', '1', now()),
('225', 'perm_ai_manage', 'menu_admin_ai_config', '1', now()),
('226', 'perm_ai_manage', 'menu_admin_knowledge', '1', now()),
('227', 'perm_system_manage', 'menu_admin_logs_manage', '1', now()),
('228', 'perm_system_manage', 'menu_admin_system_logs', '1', now()),
('229', 'perm_system_manage', 'menu_admin_login_logs', '1', now()),
('230', 'perm_system_manage', 'menu_admin_operation_logs', '1', now()),
('231', 'perm_system_manage', 'menu_admin_system_config', '1', now());
