117 lines
8.6 KiB
SQL
117 lines
8.6 KiB
SQL
use school_news;
|
||
|
||
-- 插入AI智能体配置数据
|
||
INSERT INTO `tb_ai_agent_config` (id, name, system_prompt, model_name, temperature, max_tokens, status, creator, create_time) VALUES
|
||
('1', '思政小帮手', '你是一个专业的思政学习助手,致力于帮助用户学习思想政治理论知识。请基于提供的知识库内容,为用户提供准确、简洁的回答。', 'gpt-3.5-turbo', 0.7, 2000, 1, '1', now());
|
||
|
||
-- 插入标签数据 (文章分类标签 tag_type=1)
|
||
INSERT INTO `tb_tag` (id, tag_id, name, color, description, tag_type, creator, create_time) VALUES
|
||
('tag001', 'tag_article_001', '党史学习', '#ff6b6b', '党史学习相关文章', 1, '1', now()),
|
||
('tag002', 'tag_article_002', '领导讲话', '#4ecdc4', '领导讲话相关文章', 1, '1', now()),
|
||
('tag003', 'tag_article_003', '政策解读', '#45b7d1', '政策解读相关文章', 1, '1', now()),
|
||
('tag004', 'tag_article_004', '红色经典', '#f7b731', '红色经典相关文章', 1, '1', now()),
|
||
('tag005', 'tag_article_005', '专题报告', '#45c7c1', '专题报告相关文章', 1, '1', now()),
|
||
('tag006', 'tag_article_006', '思政案例', '#5f27cd', '思政案例相关文章', 1, '1', now());
|
||
|
||
-- 插入标签数据 (课程分类标签 tag_type=2)
|
||
INSERT INTO `tb_tag` (id, tag_id, name, color, description, tag_type, creator, create_time) VALUES
|
||
('tag101', 'tag_course_001', '基础课程', '#26de81', '基础思政课程', 2, '1', now()),
|
||
('tag102', 'tag_course_002', '专题课程', '#fc5c65', '专题思政课程', 2, '1', now()),
|
||
('tag103', 'tag_course_003', '实践课程', '#fd9644', '实践类思政课程', 2, '1', now()),
|
||
('tag104', 'tag_course_004', '在线课程', '#a55eea', '在线学习课程', 2, '1', now()),
|
||
('tag105', 'tag_course_005', '热门课程', '#eb3b5a', '热门推荐课程', 2, '1', now());
|
||
|
||
-- 插入标签数据 (学习任务分类标签 tag_type=3)
|
||
INSERT INTO `tb_tag` (id, tag_id, name, color, description, tag_type, creator, create_time) VALUES
|
||
('tag201', 'tag_task_001', '每日学习', '#20bf6b', '每日学习任务', 3, '1', now()),
|
||
('tag202', 'tag_task_002', '专题学习', '#fa8231', '专题学习任务', 3, '1', now()),
|
||
('tag203', 'tag_task_003', '考核任务', '#0fb9b1', '考核类学习任务', 3, '1', now()),
|
||
('tag204', 'tag_task_004', '实践任务', '#f7b731', '实践类学习任务', 3, '1', now()),
|
||
('tag205', 'tag_task_005', '阶段任务', '#2d98da', '阶段性学习任务', 3, '1', now());
|
||
|
||
-- 插入系统配置数据
|
||
INSERT INTO `tb_sys_config` (id, config_key, config_value, config_type, config_group, description, is_system, creator, create_time) VALUES
|
||
('1', 'system.platform.name', '思政学习平台', 'string', 'platform', '平台名称', 1, '1', now()),
|
||
('2', 'system.platform.logo', '/assets/logo.png', 'string', 'platform', '平台Logo', 1, '1', now()),
|
||
('3', 'system.platform.school_badge', '/assets/school_badge.png', 'string', 'platform', '学校校徽', 1, '1', now()),
|
||
('4', 'system.menu.home', '首页', 'string', 'menu', '首页菜单名称', 0, '1', now()),
|
||
('5', 'system.menu.resource', '资源中心', 'string', 'menu', '资源中心菜单名称', 0, '1', now()),
|
||
('6', 'system.menu.learning', '学习计划', 'string', 'menu', '学习计划菜单名称', 0, '1', now()),
|
||
('7', 'system.menu.activity', '专题活动', 'string', 'menu', '专题活动菜单名称', 0, '1', now()),
|
||
('8', 'system.menu.culture', '红色常信', 'string', 'menu', '红色常信菜单名称', 0, '1', now()),
|
||
('9', 'system.banner.auto_play', 'true', 'boolean', 'banner', 'Banner自动播放', 0, '1', now()),
|
||
('10', 'system.banner.interval', '5000', 'number', 'banner', 'Banner切换间隔(毫秒)', 0, '1', now()),
|
||
('11', 'system.resource.auto_publish', 'false', 'boolean', 'resource', '资源自动发布', 0, '1', now()),
|
||
('12', 'system.resource.auto_publish_time', '08:00', 'string', 'resource', '自动发布时间', 0, '1', now()),
|
||
('13', 'system.ai.enabled', 'true', 'boolean', 'ai', '是否启用智能体', 0, '1', now());
|
||
|
||
-- 注意:默认superadmin用户已在 initMenuData.sql 中创建,此处无需重复创建
|
||
|
||
-- =====================================================
|
||
-- 初始化资源权限数据
|
||
-- =====================================================
|
||
|
||
|
||
INSERT INTO `tb_achievement` (`id`, `achievement_id`, `name`,`icon`, `description`, `type`, `level`, `condition_type`, `condition_value`, `points`, `order_num`, `deleted`) VALUES
|
||
('ACH001', 'learning_time_l1', '初学者', 'v1-icon.svg', '累计学习时长达到10小时', 1, 1, 1, 10*60*60, 10, 1, 0),
|
||
('ACH002', 'learning_time_l2', '勤学者', 'v2-icon.svg', '累计学习时长达到50小时', 1, 2, 1, 50*60*60, 50, 2, 0),
|
||
('ACH003', 'learning_time_l3', '学习达人', 'v3-icon.svg', '累计学习时长达到100小时', 1, 3, 1, 100*60*60, 100, 3, 0),
|
||
('ACH004', 'learning_time_l4', '学习狂人', 'v4-icon.svg', '累计学习时长达到500小时', 1, 4, 1, 500*60*60, 500, 4, 0),
|
||
('ACH005', 'learning_time_l5', '学习大师', 'v5-icon.svg', '累计学习时长达到1000小时', 1, 5, 1, 1000*60*60, 1000, 5, 0),
|
||
('ACH006', 'learning_time_l6', '学习宗师', 'v6-icon.svg', '累计学习时长达到2000小时', 1, 6, 1, 2000*60*60, 2000, 6, 0);
|
||
|
||
INSERT INTO `tb_resource_permission` (id, resource_type, resource_id, dept_id, role_id, can_read, can_write, can_execute, creator, create_time) VALUES
|
||
('perm_achievement_001', 6, 'learning_time_l1', NULL, NULL, 1, 0, 0, '1', now()),
|
||
('perm_achievement_002', 6, 'learning_time_l2', NULL, NULL, 1, 0, 0, '1', now()),
|
||
('perm_achievement_003', 6, 'learning_time_l3', NULL, NULL, 1, 0, 0, '1', now()),
|
||
('perm_achievement_004', 6, 'learning_time_l4', NULL, NULL, 1, 0, 0, '1', now()),
|
||
('perm_achievement_005', 6, 'learning_time_l5', NULL, NULL, 1, 0, 0, '1', now()),
|
||
('perm_achievement_006', 6, 'learning_time_l6', NULL, NULL, 1, 0, 0, '1', now());
|
||
|
||
-- 为默认标签创建超级管理员权限(文章标签)
|
||
INSERT INTO `tb_resource_permission` (id, resource_type, resource_id, dept_id, role_id, can_read, can_write, can_execute, creator, create_time) VALUES
|
||
-- 文章标签权限(resource_type=9,TAG)
|
||
('perm_tag_001', 9, 'tag_article_001', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_002', 9, 'tag_article_002', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_003', 9, 'tag_article_003', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_004', 9, 'tag_article_004', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_005', 9, 'tag_article_005', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_006', 9, 'tag_article_006', NULL, NULL, 1, 1, 1, '1', now()),
|
||
|
||
-- 课程标签权限(resource_type=9,TAG)
|
||
('perm_tag_101', 9, 'tag_course_001', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_102', 9, 'tag_course_002', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_103', 9, 'tag_course_003', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_104', 9, 'tag_course_004', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_105', 9, 'tag_course_005', NULL, NULL, 1, 1, 1, '1', now()),
|
||
|
||
-- 学习任务标签权限(resource_type=9,TAG)
|
||
('perm_tag_201', 9, 'tag_task_001', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_202', 9, 'tag_task_002', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_203', 9, 'tag_task_003', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_204', 9, 'tag_task_004', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_tag_205', 9, 'tag_task_005', NULL, NULL, 1, 1, 1, '1', now());
|
||
|
||
-- 为默认部门创建权限(resource_type=4,DEPT)
|
||
INSERT INTO `tb_resource_permission` (id, resource_type, resource_id, dept_id, role_id, can_read, can_write, can_execute, creator, create_time) VALUES
|
||
('perm_dept_001', 4, 'root_department', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_dept_002', 4, 'default_department', NULL, NULL, 1, 1, 1, '1', now());
|
||
|
||
-- 为默认角色创建权限(resource_type=5,ROLE)
|
||
INSERT INTO `tb_resource_permission` (id, resource_type, resource_id, dept_id, role_id, can_read, can_write, can_execute, creator, create_time) VALUES
|
||
('perm_role_001', 5, 'superadmin', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_role_002', 5, 'admin', NULL, NULL, 1, 1, 1, '1', now()),
|
||
('perm_role_003', 5, 'freedom', NULL, NULL, 1, 1, 1, '1', now());
|
||
|
||
|
||
-- 说明:
|
||
-- 1. 这些初始权限都是超级管理员权限(dept_id和role_id都为NULL)
|
||
-- 2. 所有权限都是全权限(can_read=1, can_write=1, can_execute=1)
|
||
-- 3. 后续创建的资源会自动根据创建者的部门和角色创建相应的权限
|
||
-- 4. resource_type说明:
|
||
-- 1-NEWS, 2-COURSE, 3-TASK, 4-DEPT, 5-ROLE, 6-ACHIEVEMENT, 7-CRONTAB_TASK, 8-BANNER, 9-TAG
|
||
-- 5. 权限创建规则:
|
||
-- - root_department的superadmin创建资源:为所有部门和角色创建权限
|
||
-- - 普通用户创建资源:为父部门管理员+子部门角色创建权限
|
||
-- - 所有资源都会为root_department的superadmin创建全权限
|