-- MySQL dump 10.13  Distrib 8.0.43, for Linux (aarch64)
--
-- Host: localhost    Database: kaopeilian
-- ------------------------------------------------------
-- Server version	8.0.43

/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!50503 SET NAMES utf8mb4 */;
/*!40103 SET @OLD_TIME_ZONE=@@TIME_ZONE */;
/*!40103 SET TIME_ZONE='+00:00' */;
/*!40014 SET @OLD_UNIQUE_CHECKS=@@UNIQUE_CHECKS, UNIQUE_CHECKS=0 */;
/*!40014 SET @OLD_FOREIGN_KEY_CHECKS=@@FOREIGN_KEY_CHECKS, FOREIGN_KEY_CHECKS=0 */;
/*!40101 SET @OLD_SQL_MODE=@@SQL_MODE, SQL_MODE='NO_AUTO_VALUE_ON_ZERO' */;
/*!40111 SET @OLD_SQL_NOTES=@@SQL_NOTES, SQL_NOTES=0 */;

--
-- Table structure for table `course_exam_settings`
--

DROP TABLE IF EXISTS `course_exam_settings`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `course_exam_settings` (
  `id` int NOT NULL AUTO_INCREMENT,
  `course_id` int NOT NULL COMMENT 'è¯¾ç¨‹ID',
  `single_choice_count` int NOT NULL DEFAULT '10' COMMENT 'å•é€‰é¢˜æ•°é‡',
  `multiple_choice_count` int NOT NULL DEFAULT '5' COMMENT 'å¤šé€‰é¢˜æ•°é‡',
  `true_false_count` int NOT NULL DEFAULT '5' COMMENT 'åˆ¤æ–­é¢˜æ•°é‡',
  `fill_blank_count` int NOT NULL DEFAULT '0' COMMENT 'å¡«ç©ºé¢˜æ•°é‡',
  `duration_minutes` int NOT NULL DEFAULT '60' COMMENT 'è€ƒè¯•æ—¶é•¿(åˆ†é’Ÿ)',
  `difficulty_level` int NOT NULL DEFAULT '3' COMMENT 'éš¾åº¦ç³»æ•°(1-5)',
  `passing_score` int NOT NULL DEFAULT '60' COMMENT 'åŠæ ¼åˆ†æ•°',
  `is_enabled` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'æ˜¯å¦å¯ç”¨',
  `show_answer_immediately` tinyint(1) NOT NULL DEFAULT '0' COMMENT 'æ˜¯å¦ç«‹å³æ˜¾ç¤ºç­”æ¡ˆ',
  `allow_retake` tinyint(1) NOT NULL DEFAULT '1' COMMENT 'æ˜¯å¦å…è®¸é‡è€ƒ',
  `max_retake_times` int DEFAULT NULL COMMENT 'æœ€å¤§é‡è€ƒæ¬¡æ•°',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_by` int DEFAULT NULL COMMENT 'åˆ›å»ºäººID',
  `updated_by` int DEFAULT NULL COMMENT 'æ›´æ–°äººID',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_at` datetime DEFAULT NULL,
  `deleted_by` int DEFAULT NULL COMMENT 'åˆ é™¤äººID',
  PRIMARY KEY (`id`),
  UNIQUE KEY `course_id` (`course_id`),
  KEY `ix_course_exam_settings_id` (`id`),
  CONSTRAINT `course_exam_settings_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='è¯¾ç¨‹è€ƒè¯•è®¾ç½®è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `course_exam_settings`
--

LOCK TABLES `course_exam_settings` WRITE;
/*!40000 ALTER TABLE `course_exam_settings` DISABLE KEYS */;
INSERT INTO `course_exam_settings` VALUES (1,1,11,0,0,0,10,3,60,1,0,1,3,'2025-09-22 17:37:11','2025-09-22 17:37:11',2,2,0,NULL,NULL);
/*!40000 ALTER TABLE `course_exam_settings` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `course_materials`
--

DROP TABLE IF EXISTS `course_materials`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `course_materials` (
  `id` int NOT NULL AUTO_INCREMENT,
  `course_id` int NOT NULL COMMENT 'è¯¾ç¨‹ID',
  `name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'èµ„æ–™åç§°',
  `description` text COLLATE utf8mb4_unicode_ci COMMENT 'èµ„æ–™æè¿°',
  `file_url` varchar(500) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'æ–‡ä»¶URL',
  `file_type` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'æ–‡ä»¶ç±»åž‹',
  `file_size` int NOT NULL COMMENT 'æ–‡ä»¶å¤§å°(å­—èŠ‚)',
  `sort_order` int DEFAULT '0' COMMENT 'æŽ’åºé¡ºåº',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦åˆ é™¤',
  `deleted_at` datetime DEFAULT NULL COMMENT 'åˆ é™¤æ—¶é—´',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_course_id` (`course_id`),
  KEY `idx_is_deleted` (`is_deleted`),
  CONSTRAINT `course_materials_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='è¯¾ç¨‹èµ„æ–™è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `course_materials`
--

LOCK TABLES `course_materials` WRITE;
/*!40000 ALTER TABLE `course_materials` DISABLE KEYS */;
INSERT INTO `course_materials` VALUES (1,1,'Python基础教程.pdf','Python编程基础教程文档','/uploads/python-basics.pdf','pdf',2048000,0,1,'2025-09-22 18:06:20','2025-09-22 17:18:23','2025-09-22 18:30:51'),(2,1,'课程视频1','第一章节视频教程','/uploads/video1.mp4','mp4',104857600,0,1,'2025-09-22 18:06:24','2025-09-22 17:18:23','2025-09-22 18:30:51'),(3,1,'美拉美测试-小.pdf','','/static/uploads/courses/1/20250923020629_18c59f4c.pdf','pdf',169193,0,0,NULL,'2025-09-22 18:06:29','2025-09-22 18:06:29');
/*!40000 ALTER TABLE `course_materials` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `courses`
--

DROP TABLE IF EXISTS `courses`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `courses` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'è¯¾ç¨‹åç§°',
  `description` text COLLATE utf8mb4_unicode_ci COMMENT 'è¯¾ç¨‹æè¿°',
  `category` enum('technology','management','business','general') COLLATE utf8mb4_unicode_ci DEFAULT 'general' COMMENT 'è¯¾ç¨‹åˆ†ç±»',
  `status` enum('draft','published','archived') COLLATE utf8mb4_unicode_ci DEFAULT 'draft' COMMENT 'è¯¾ç¨‹çŠ¶æ€',
  `cover_image` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å°é¢å›¾ç‰‡URL',
  `duration_hours` float DEFAULT NULL COMMENT 'è¯¾ç¨‹æ—¶é•¿(å°æ—¶)',
  `difficulty_level` int DEFAULT NULL COMMENT 'éš¾åº¦ç­‰çº§(1-5)',
  `tags` json DEFAULT NULL COMMENT 'æ ‡ç­¾åˆ—è¡¨',
  `published_at` datetime DEFAULT NULL COMMENT 'å‘å¸ƒæ—¶é—´',
  `publisher_id` int DEFAULT NULL COMMENT 'å‘å¸ƒäººID',
  `sort_order` int DEFAULT '0' COMMENT 'æŽ’åºé¡ºåº',
  `is_featured` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦æŽ¨è',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦åˆ é™¤',
  `deleted_at` datetime DEFAULT NULL COMMENT 'åˆ é™¤æ—¶é—´',
  `created_by` int DEFAULT NULL COMMENT 'åˆ›å»ºäººID',
  `updated_by` int DEFAULT NULL COMMENT 'æ›´æ–°äººID',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_status` (`status`),
  KEY `idx_category` (`category`),
  KEY `idx_is_featured` (`is_featured`),
  KEY `idx_is_deleted` (`is_deleted`),
  KEY `idx_sort_order` (`sort_order`)
) ENGINE=InnoDB AUTO_INCREMENT=12 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='è¯¾ç¨‹è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `courses`
--

LOCK TABLES `courses` WRITE;
/*!40000 ALTER TABLE `courses` DISABLE KEYS */;
INSERT INTO `courses` VALUES (1,'皮肤生理学基础','学习皮肤结构、功能和常见问题，为专业护理打下基础','technology','published',NULL,16,2,'[\"皮肤学\", \"基础理论\", \"必修课\"]','2025-09-22 17:18:23',NULL,100,1,0,NULL,NULL,2,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(2,'医美产品知识与应用','全面了解各类医美产品的成分、功效和适用人群','technology','published',NULL,20,3,'[\"产品知识\", \"医美\", \"专业技能\"]','2025-09-22 17:18:23',NULL,110,1,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(3,'美容仪器操作与维护','掌握各类美容仪器的操作方法、注意事项和日常维护','technology','published',NULL,24,3,'[\"仪器操作\", \"实操技能\", \"设备维护\"]','2025-09-22 17:18:23',NULL,120,0,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(4,'医美项目介绍与咨询','详细了解各类医美项目的原理、效果和适应症','technology','published',NULL,30,4,'[\"医美项目\", \"专业咨询\", \"风险告知\"]','2025-09-22 17:18:23',NULL,170,1,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(5,'轻医美销售技巧','学习专业的销售话术、客户需求分析和成交技巧','business','published',NULL,16,2,'[\"销售技巧\", \"客户沟通\", \"业绩提升\"]','2025-09-22 17:18:23',NULL,130,1,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(6,'客户服务与投诉处理','提升服务意识，掌握客户投诉处理的方法和技巧','business','published',NULL,12,2,'[\"客户服务\", \"危机处理\", \"沟通技巧\"]','2025-09-22 17:18:23',NULL,140,0,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(7,'社媒营销与私域运营','学习如何通过社交媒体进行品牌推广和客户维护','business','published',NULL,16,2,'[\"社媒营销\", \"私域流量\", \"客户维护\"]','2025-09-22 17:18:23',NULL,180,0,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(8,'门店运营管理','学习门店日常管理、团队建设和业绩管理','management','published',NULL,20,3,'[\"门店管理\", \"团队管理\", \"运营策略\"]','2025-09-22 17:18:23',NULL,160,0,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(9,'卫生消毒与感染控制','学习医美机构的卫生标准和消毒流程，确保服务安全','general','published',NULL,8,1,'[\"卫生安全\", \"消毒规范\", \"合规管理\"]','2025-09-22 17:18:23',NULL,150,1,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(10,'Python编程基础','Python语言入门课程，适合零基础学员','technology','published',NULL,40,2,'[\"Python\", \"编程基础\", \"入门\"]','2025-09-22 17:18:23',NULL,200,0,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(11,'数据分析基础','学习数据分析方法和工具，提升数据驱动决策能力','technology','published',NULL,32,3,'[\"数据分析\", \"Excel\", \"可视化\"]','2025-09-22 17:18:23',NULL,210,0,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36');
/*!40000 ALTER TABLE `courses` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `exam_results`
--

DROP TABLE IF EXISTS `exam_results`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `exam_results` (
  `id` int NOT NULL AUTO_INCREMENT,
  `exam_id` int NOT NULL COMMENT 'è€ƒè¯•ID',
  `question_id` int NOT NULL COMMENT 'é¢˜ç›®ID',
  `user_answer` text COLLATE utf8mb4_unicode_ci COMMENT 'ç”¨æˆ·ç­”æ¡ˆ',
  `is_correct` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦æ­£ç¡®',
  `score` float DEFAULT '0' COMMENT 'å¾—åˆ†',
  `answer_time` int DEFAULT NULL COMMENT 'ç­”é¢˜æ—¶é•¿ï¼ˆç§’ï¼‰',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_exam_id` (`exam_id`),
  KEY `idx_question_id` (`question_id`),
  CONSTRAINT `exam_results_ibfk_1` FOREIGN KEY (`exam_id`) REFERENCES `exams` (`id`) ON DELETE CASCADE,
  CONSTRAINT `exam_results_ibfk_2` FOREIGN KEY (`question_id`) REFERENCES `questions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='è€ƒè¯•ç»“æžœè¯¦æƒ…è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `exam_results`
--

LOCK TABLES `exam_results` WRITE;
/*!40000 ALTER TABLE `exam_results` DISABLE KEYS */;
/*!40000 ALTER TABLE `exam_results` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `exams`
--

DROP TABLE IF EXISTS `exams`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `exams` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT 'ç”¨æˆ·ID',
  `course_id` int NOT NULL COMMENT 'è¯¾ç¨‹ID',
  `exam_name` varchar(255) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'è€ƒè¯•åç§°',
  `question_count` int DEFAULT '10' COMMENT 'é¢˜ç›®æ•°é‡',
  `total_score` float DEFAULT '100' COMMENT 'æ€»åˆ†',
  `pass_score` float DEFAULT '60' COMMENT 'åŠæ ¼åˆ†',
  `start_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å¼€å§‹æ—¶é—´',
  `end_time` datetime DEFAULT NULL COMMENT 'ç»“æŸæ—¶é—´',
  `duration_minutes` int DEFAULT '60' COMMENT 'è€ƒè¯•æ—¶é•¿ï¼ˆåˆ†é’Ÿï¼‰',
  `score` float DEFAULT NULL COMMENT 'å¾—åˆ†',
  `is_passed` tinyint(1) DEFAULT NULL COMMENT 'æ˜¯å¦é€šè¿‡',
  `status` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'started' COMMENT 'çŠ¶æ€: started, submitted, timeout',
  `questions` json DEFAULT NULL COMMENT 'é¢˜ç›®æ•°æ®ï¼ˆJSONæ ¼å¼ï¼‰',
  `answers` json DEFAULT NULL COMMENT 'ç­”æ¡ˆæ•°æ®ï¼ˆJSONæ ¼å¼ï¼‰',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_course_id` (`course_id`),
  KEY `idx_status` (`status`),
  CONSTRAINT `exams_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `exams_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='è€ƒè¯•è®°å½•è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `exams`
--

LOCK TABLES `exams` WRITE;
/*!40000 ALTER TABLE `exams` DISABLE KEYS */;
/*!40000 ALTER TABLE `exams` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `growth_paths`
--

DROP TABLE IF EXISTS `growth_paths`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `growth_paths` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'è·¯å¾„åç§°',
  `description` text COLLATE utf8mb4_unicode_ci COMMENT 'è·¯å¾„æè¿°',
  `target_role` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ç›®æ ‡è§’è‰²',
  `courses` json DEFAULT NULL COMMENT 'è¯¾ç¨‹åˆ—è¡¨[{course_id, order, is_required}]',
  `estimated_duration_days` int DEFAULT NULL COMMENT 'é¢„è®¡å®Œæˆå¤©æ•°',
  `is_active` tinyint(1) DEFAULT '1' COMMENT 'æ˜¯å¦å¯ç”¨',
  `sort_order` int DEFAULT '0' COMMENT 'æŽ’åºé¡ºåº',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦åˆ é™¤',
  `deleted_at` datetime DEFAULT NULL COMMENT 'åˆ é™¤æ—¶é—´',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_is_active` (`is_active`),
  KEY `idx_is_deleted` (`is_deleted`),
  KEY `idx_sort_order` (`sort_order`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='æˆé•¿è·¯å¾„è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `growth_paths`
--

LOCK TABLES `growth_paths` WRITE;
/*!40000 ALTER TABLE `growth_paths` DISABLE KEYS */;
INSERT INTO `growth_paths` VALUES (1,'Python工程师成长路径','从入门到精通的Python学习路径','Python开发工程师','[{\"order\": 1, \"course_id\": 1, \"is_required\": true}, {\"order\": 2, \"course_id\": 4, \"is_required\": true}]',90,1,0,0,NULL,'2025-09-22 17:18:23','2025-09-22 18:30:51'),(2,'技术管理者路径','技术人员转型管理岗位','技术经理','[{\"order\": 1, \"course_id\": 2, \"is_required\": true}, {\"order\": 2, \"course_id\": 3, \"is_required\": false}]',60,1,0,0,NULL,'2025-09-22 17:18:23','2025-09-22 18:30:51');
/*!40000 ALTER TABLE `growth_paths` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `knowledge_points`
--

DROP TABLE IF EXISTS `knowledge_points`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `knowledge_points` (
  `id` int NOT NULL AUTO_INCREMENT,
  `course_id` int NOT NULL COMMENT 'è¯¾ç¨‹ID',
  `name` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'çŸ¥è¯†ç‚¹åç§°',
  `description` text COLLATE utf8mb4_unicode_ci COMMENT 'çŸ¥è¯†ç‚¹æè¿°',
  `parent_id` int DEFAULT NULL COMMENT 'çˆ¶çŸ¥è¯†ç‚¹ID',
  `level` int DEFAULT '1' COMMENT 'å±‚çº§æ·±åº¦',
  `path` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'è·¯å¾„(å¦‚: 1.2.3)',
  `sort_order` int DEFAULT '0' COMMENT 'æŽ’åºé¡ºåº',
  `weight` float DEFAULT '1' COMMENT 'æƒé‡',
  `is_required` tinyint(1) DEFAULT '1' COMMENT 'æ˜¯å¦å¿…ä¿®',
  `estimated_hours` float DEFAULT NULL COMMENT 'é¢„è®¡å­¦ä¹ æ—¶é—´(å°æ—¶)',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦åˆ é™¤',
  `deleted_at` datetime DEFAULT NULL COMMENT 'åˆ é™¤æ—¶é—´',
  `created_by` int DEFAULT NULL COMMENT 'åˆ›å»ºäººID',
  `updated_by` int DEFAULT NULL COMMENT 'æ›´æ–°äººID',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_course_id` (`course_id`),
  KEY `idx_parent_id` (`parent_id`),
  KEY `idx_is_deleted` (`is_deleted`),
  KEY `idx_sort_order` (`sort_order`),
  CONSTRAINT `knowledge_points_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE,
  CONSTRAINT `knowledge_points_ibfk_2` FOREIGN KEY (`parent_id`) REFERENCES `knowledge_points` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='çŸ¥è¯†ç‚¹è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `knowledge_points`
--

LOCK TABLES `knowledge_points` WRITE;
/*!40000 ALTER TABLE `knowledge_points` DISABLE KEYS */;
INSERT INTO `knowledge_points` VALUES (1,1,'Python环境搭建','学习如何安装和配置Python开发环境',NULL,1,NULL,0,1,1,2,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 18:23:19'),(2,1,'Python基础语法','学习Python的基本语法规则',NULL,1,NULL,0,2,1,8,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 18:23:19'),(3,1,'变量和数据类型','了解Python中的变量和基本数据类型',2,2,NULL,0,1.5,1,3,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 18:23:19'),(4,1,'控制流程','学习条件语句和循环结构',2,2,NULL,0,1.5,1,4,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 18:23:19'),(5,1,'立刻到家啦手机发的','拉克丝大姐夫；阿斯利康大姐夫\n',NULL,1,NULL,0,1,1,NULL,0,NULL,2,NULL,'2025-09-22 17:36:46','2025-09-22 17:36:46');
/*!40000 ALTER TABLE `knowledge_points` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `material_knowledge_points`
--

DROP TABLE IF EXISTS `material_knowledge_points`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `material_knowledge_points` (
  `id` int NOT NULL AUTO_INCREMENT,
  `material_id` int NOT NULL COMMENT 'èµ„æ–™ID',
  `knowledge_point_id` int NOT NULL COMMENT 'çŸ¥è¯†ç‚¹ID',
  `sort_order` int DEFAULT '0' COMMENT 'æŽ’åºé¡ºåº',
  `is_ai_generated` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦AIç”Ÿæˆ',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦åˆ é™¤',
  `deleted_at` datetime DEFAULT NULL COMMENT 'åˆ é™¤æ—¶é—´',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `idx_material_knowledge` (`material_id`,`knowledge_point_id`),
  KEY `idx_material_id` (`material_id`),
  KEY `idx_knowledge_point_id` (`knowledge_point_id`),
  CONSTRAINT `material_knowledge_points_ibfk_1` FOREIGN KEY (`material_id`) REFERENCES `course_materials` (`id`) ON DELETE CASCADE,
  CONSTRAINT `material_knowledge_points_ibfk_2` FOREIGN KEY (`knowledge_point_id`) REFERENCES `knowledge_points` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='èµ„æ–™çŸ¥è¯†ç‚¹å…³è”è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `material_knowledge_points`
--

LOCK TABLES `material_knowledge_points` WRITE;
/*!40000 ALTER TABLE `material_knowledge_points` DISABLE KEYS */;
INSERT INTO `material_knowledge_points` VALUES (1,1,5,1,0,0,NULL,'2025-09-22 17:36:46','2025-09-22 17:36:46');
/*!40000 ALTER TABLE `material_knowledge_points` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `position_courses`
--

DROP TABLE IF EXISTS `position_courses`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `position_courses` (
  `id` int NOT NULL AUTO_INCREMENT,
  `position_id` int NOT NULL COMMENT 'å²—ä½ID',
  `course_id` int NOT NULL COMMENT 'è¯¾ç¨‹ID',
  `course_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'required' COMMENT 'è¯¾ç¨‹ç±»åž‹',
  `priority` int DEFAULT '0' COMMENT 'ä¼˜å…ˆçº§/æŽ’åº',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_by` int DEFAULT NULL COMMENT 'åˆ›å»ºäººID',
  `updated_by` int DEFAULT NULL COMMENT 'æ›´æ–°äººID',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uix_position_course` (`position_id`,`course_id`,`is_deleted`),
  KEY `course_id` (`course_id`),
  KEY `ix_position_courses_id` (`id`),
  CONSTRAINT `position_courses_ibfk_1` FOREIGN KEY (`position_id`) REFERENCES `positions` (`id`),
  CONSTRAINT `position_courses_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=13 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='å²—ä½è¯¾ç¨‹å…³è”è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `position_courses`
--

LOCK TABLES `position_courses` WRITE;
/*!40000 ALTER TABLE `position_courses` DISABLE KEYS */;
INSERT INTO `position_courses` VALUES (1,2,8,'required',1,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(2,2,5,'required',2,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(3,2,6,'required',3,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(4,2,9,'required',4,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(5,3,1,'required',1,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(6,3,2,'required',2,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(7,3,5,'required',3,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(8,3,6,'required',4,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(9,3,7,'optional',5,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(10,4,1,'required',1,'2025-09-22 17:18:23','2025-09-22 17:37:05',NULL,NULL,1,NULL),(11,4,3,'required',2,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(12,4,9,'required',3,'2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL);
/*!40000 ALTER TABLE `position_courses` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `position_members`
--

DROP TABLE IF EXISTS `position_members`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `position_members` (
  `id` int NOT NULL AUTO_INCREMENT,
  `position_id` int NOT NULL COMMENT 'å²—ä½ID',
  `user_id` int NOT NULL COMMENT 'ç”¨æˆ·ID',
  `role` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'æˆå‘˜è§’è‰²ï¼ˆé¢„ç•™å­—æ®µï¼‰',
  `joined_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'åŠ å…¥æ—¶é—´',
  `created_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `created_by` int DEFAULT NULL COMMENT 'åˆ›å»ºäººID',
  `updated_by` int DEFAULT NULL COMMENT 'æ›´æ–°äººID',
  `is_deleted` tinyint(1) NOT NULL DEFAULT '0',
  `deleted_at` datetime DEFAULT NULL,
  PRIMARY KEY (`id`),
  UNIQUE KEY `uix_position_user` (`position_id`,`user_id`,`is_deleted`),
  KEY `user_id` (`user_id`),
  KEY `ix_position_members_id` (`id`),
  CONSTRAINT `position_members_ibfk_1` FOREIGN KEY (`position_id`) REFERENCES `positions` (`id`),
  CONSTRAINT `position_members_ibfk_2` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='å²—ä½æˆå‘˜å…³è”è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `position_members`
--

LOCK TABLES `position_members` WRITE;
/*!40000 ALTER TABLE `position_members` DISABLE KEYS */;
INSERT INTO `position_members` VALUES (1,2,2,NULL,'2025-09-22 17:18:23','2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(2,3,3,NULL,'2025-09-22 17:18:23','2025-09-22 17:18:23','2025-09-22 17:18:23',NULL,NULL,0,NULL),(3,3,1,NULL,'2025-09-22 17:46:13','2025-09-22 17:46:13','2025-09-22 17:46:13',NULL,NULL,0,NULL);
/*!40000 ALTER TABLE `position_members` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `positions`
--

DROP TABLE IF EXISTS `positions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `positions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'å²—ä½åç§°',
  `code` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'å²—ä½ç¼–ç ',
  `description` text COLLATE utf8mb4_unicode_ci COMMENT 'å²—ä½æè¿°',
  `parent_id` int DEFAULT NULL COMMENT 'ä¸Šçº§å²—ä½ID',
  `status` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL DEFAULT 'active' COMMENT 'çŠ¶æ€: active/inactive',
  `skills` json DEFAULT NULL COMMENT 'æ ¸å¿ƒæŠ€èƒ½',
  `level` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å²—ä½ç­‰çº§: junior/intermediate/senior/expert',
  `sort_order` int DEFAULT '0' COMMENT 'æŽ’åº',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦åˆ é™¤',
  `deleted_at` datetime DEFAULT NULL COMMENT 'åˆ é™¤æ—¶é—´',
  `created_by` int DEFAULT NULL COMMENT 'åˆ›å»ºäººID',
  `updated_by` int DEFAULT NULL COMMENT 'æ›´æ–°äººID',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `code` (`code`),
  KEY `parent_id` (`parent_id`),
  KEY `idx_positions_name` (`name`),
  CONSTRAINT `positions_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `positions` (`id`) ON DELETE SET NULL
) ENGINE=InnoDB AUTO_INCREMENT=9 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='å²—ä½è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `positions`
--

LOCK TABLES `positions` WRITE;
/*!40000 ALTER TABLE `positions` DISABLE KEYS */;
INSERT INTO `positions` VALUES (1,'区域经理','region_manager','负责多家门店的运营管理和业绩达成',NULL,'active','[\"团队管理\", \"业绩分析\", \"战略规划\", \"客户关系\"]','expert',10,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(2,'店长','store_manager','负责门店日常运营管理，团队建设和业绩达成',1,'active','[\"门店管理\", \"团队建设\", \"销售管理\", \"客户维护\"]','senior',20,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(3,'美容顾问','beauty_consultant','为客户提供专业的美容咨询和方案设计',2,'active','[\"产品知识\", \"销售技巧\", \"方案设计\", \"客户沟通\"]','intermediate',30,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(4,'医美咨询师','medical_beauty_consultant','提供医疗美容项目咨询和方案制定',2,'active','[\"医美知识\", \"风险评估\", \"方案设计\", \"合规意识\"]','senior',35,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(5,'美容技师','beauty_therapist','为客户提供专业的美容护理服务',2,'active','[\"护肤技术\", \"仪器操作\", \"手法技巧\", \"服务意识\"]','intermediate',40,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(6,'护士','nurse','协助医生进行医美项目操作，负责术后护理',2,'active','[\"护理技术\", \"无菌操作\", \"应急处理\", \"医疗知识\"]','intermediate',45,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(7,'前台接待','receptionist','负责客户接待、预约管理和前台事务',2,'active','[\"接待礼仪\", \"沟通能力\", \"信息管理\", \"服务意识\"]','junior',50,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36'),(8,'市场专员','marketing_specialist','负责门店营销活动策划和执行',2,'active','[\"活动策划\", \"社媒运营\", \"数据分析\", \"创意设计\"]','intermediate',60,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36');
/*!40000 ALTER TABLE `positions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `questions`
--

DROP TABLE IF EXISTS `questions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `questions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `course_id` int NOT NULL COMMENT 'è¯¾ç¨‹ID',
  `question_type` varchar(20) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'é¢˜ç›®ç±»åž‹: single_choice, multiple_choice, true_false, fill_blank, essay',
  `title` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'é¢˜ç›®æ ‡é¢˜',
  `content` text COLLATE utf8mb4_unicode_ci COMMENT 'é¢˜ç›®å†…å®¹',
  `options` json DEFAULT NULL COMMENT 'é€‰é¡¹ï¼ˆJSONæ ¼å¼ï¼‰',
  `correct_answer` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'æ­£ç¡®ç­”æ¡ˆ',
  `explanation` text COLLATE utf8mb4_unicode_ci COMMENT 'ç­”æ¡ˆè§£é‡Š',
  `score` float DEFAULT '10' COMMENT 'åˆ†å€¼',
  `difficulty` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT 'medium' COMMENT 'éš¾åº¦ç­‰çº§: easy, medium, hard',
  `tags` json DEFAULT NULL COMMENT 'æ ‡ç­¾ï¼ˆJSONæ ¼å¼ï¼‰',
  `usage_count` int DEFAULT '0' COMMENT 'ä½¿ç”¨æ¬¡æ•°',
  `correct_count` int DEFAULT '0' COMMENT 'ç­”å¯¹æ¬¡æ•°',
  `is_active` tinyint(1) DEFAULT '1' COMMENT 'æ˜¯å¦å¯ç”¨',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_course_id` (`course_id`),
  KEY `idx_question_type` (`question_type`),
  KEY `idx_difficulty` (`difficulty`),
  KEY `idx_is_active` (`is_active`),
  CONSTRAINT `questions_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `courses` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='é¢˜ç›®è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `questions`
--

LOCK TABLES `questions` WRITE;
/*!40000 ALTER TABLE `questions` DISABLE KEYS */;
INSERT INTO `questions` VALUES (1,1,'single_choice','Python中哪个关键字用于定义函数？',NULL,'{\"A\": \"def\", \"B\": \"function\", \"C\": \"fun\", \"D\": \"define\"}','A','Python使用def关键字来定义函数',10,'easy','[\"python\", \"åŸºç¡€\", \"å‡½æ•°\"]',0,0,1,'2025-09-22 17:18:23','2025-09-22 18:30:51'),(2,1,'single_choice','Python中列表和元组的主要区别是什么？',NULL,'{\"A\": \"åˆ—è¡¨æ˜¯æœ‰åºçš„ï¼Œå…ƒç»„æ˜¯æ— åºçš„\", \"B\": \"åˆ—è¡¨å¯å˜ï¼Œå…ƒç»„ä¸å¯å˜\", \"C\": \"åˆ—è¡¨åªèƒ½å­˜å‚¨æ•°å­—ï¼Œå…ƒç»„å¯ä»¥å­˜å‚¨ä»»ä½•ç±»åž‹\", \"D\": \"æ²¡æœ‰åŒºåˆ«\"}','B','列表是可变的（mutable），而元组是不可变的（immutable）',10,'medium','[\"python\", \"æ•°æ®ç»“æž„\"]',0,0,1,'2025-09-22 17:18:23','2025-09-22 18:30:51'),(3,1,'true_false','Python是一种编译型语言',NULL,NULL,'false','Python是一种解释型语言，不需要编译成机器码',10,'easy','[\"python\", \"åŸºç¡€\"]',0,0,1,'2025-09-22 17:18:23','2025-09-22 18:30:51'),(4,1,'fill_blank','Python中使用____关键字定义类',NULL,NULL,'class','使用class关键字定义类',10,'easy','[\"python\", \"é¢å‘å¯¹è±¡\"]',0,0,1,'2025-09-22 17:18:23','2025-09-22 18:30:51');
/*!40000 ALTER TABLE `questions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `teams`
--

DROP TABLE IF EXISTS `teams`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `teams` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'å›¢é˜Ÿåç§°',
  `code` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'å›¢é˜Ÿä»£ç ',
  `description` text COLLATE utf8mb4_unicode_ci COMMENT 'å›¢é˜Ÿæè¿°',
  `team_type` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT 'department' COMMENT 'å›¢é˜Ÿç±»åž‹: department, project, study_group',
  `is_active` tinyint(1) DEFAULT '1' COMMENT 'æ˜¯å¦æ¿€æ´»',
  `leader_id` int DEFAULT NULL COMMENT 'è´Ÿè´£äººID',
  `parent_id` int DEFAULT NULL COMMENT 'çˆ¶å›¢é˜ŸID',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦åˆ é™¤',
  `deleted_at` datetime DEFAULT NULL COMMENT 'åˆ é™¤æ—¶é—´',
  PRIMARY KEY (`id`),
  UNIQUE KEY `name` (`name`),
  UNIQUE KEY `code` (`code`),
  KEY `leader_id` (`leader_id`),
  KEY `parent_id` (`parent_id`),
  KEY `idx_team_type` (`team_type`),
  KEY `idx_is_active` (`is_active`),
  CONSTRAINT `teams_ibfk_1` FOREIGN KEY (`leader_id`) REFERENCES `users` (`id`) ON DELETE SET NULL,
  CONSTRAINT `teams_ibfk_2` FOREIGN KEY (`parent_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='å›¢é˜Ÿè¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `teams`
--

LOCK TABLES `teams` WRITE;
/*!40000 ALTER TABLE `teams` DISABLE KEYS */;
INSERT INTO `teams` VALUES (1,'技术部','TECH','负责技术研发和维护','department',1,2,NULL,'2025-09-22 17:18:23','2025-09-22 18:30:51',0,NULL),(2,'产品部','PROD','负责产品设计和规划','department',1,2,NULL,'2025-09-22 17:18:23','2025-09-22 18:30:51',0,NULL),(3,'Python学习小组','PY_GROUP','Python技术学习交流','study_group',1,2,NULL,'2025-09-22 17:18:23','2025-09-22 18:30:51',0,NULL);
/*!40000 ALTER TABLE `teams` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `training_messages`
--

DROP TABLE IF EXISTS `training_messages`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `training_messages` (
  `id` int NOT NULL AUTO_INCREMENT,
  `session_id` int NOT NULL COMMENT 'ä¼šè¯ID',
  `role` enum('USER','ASSISTANT','SYSTEM') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'æ¶ˆæ¯è§’è‰²',
  `type` enum('TEXT','VOICE','SYSTEM') COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'æ¶ˆæ¯ç±»åž‹',
  `content` text COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'æ¶ˆæ¯å†…å®¹',
  `voice_url` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'è¯­éŸ³æ–‡ä»¶URL',
  `voice_duration` float DEFAULT NULL COMMENT 'è¯­éŸ³æ—¶é•¿ï¼ˆç§’ï¼‰',
  `message_metadata` json DEFAULT NULL COMMENT 'æ¶ˆæ¯å…ƒæ•°æ®',
  `coze_message_id` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Cozeæ¶ˆæ¯ID',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_session_id` (`session_id`),
  KEY `idx_role` (`role`),
  CONSTRAINT `training_messages_ibfk_1` FOREIGN KEY (`session_id`) REFERENCES `training_sessions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='é™ªç»ƒæ¶ˆæ¯è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `training_messages`
--

LOCK TABLES `training_messages` WRITE;
/*!40000 ALTER TABLE `training_messages` DISABLE KEYS */;
/*!40000 ALTER TABLE `training_messages` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `training_reports`
--

DROP TABLE IF EXISTS `training_reports`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `training_reports` (
  `id` int NOT NULL AUTO_INCREMENT,
  `session_id` int NOT NULL COMMENT 'ä¼šè¯ID',
  `user_id` int NOT NULL COMMENT 'ç”¨æˆ·ID',
  `overall_score` float NOT NULL COMMENT 'æ€»ä½“å¾—åˆ†',
  `dimension_scores` json NOT NULL COMMENT 'å„ç»´åº¦å¾—åˆ†',
  `strengths` json NOT NULL COMMENT 'ä¼˜åŠ¿ç‚¹',
  `weaknesses` json NOT NULL COMMENT 'å¾…æ”¹è¿›ç‚¹',
  `suggestions` json NOT NULL COMMENT 'æ”¹è¿›å»ºè®®',
  `detailed_analysis` text COLLATE utf8mb4_unicode_ci COMMENT 'è¯¦ç»†åˆ†æž',
  `transcript` text COLLATE utf8mb4_unicode_ci COMMENT 'å¯¹è¯æ–‡æœ¬è®°å½•',
  `statistics` json DEFAULT NULL COMMENT 'ç»Ÿè®¡æ•°æ®',
  `created_by` bigint DEFAULT NULL COMMENT 'åˆ›å»ºäººID',
  `updated_by` bigint DEFAULT NULL COMMENT 'æ›´æ–°äººID',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  UNIQUE KEY `session_id` (`session_id`),
  KEY `idx_user_id` (`user_id`),
  CONSTRAINT `training_reports_ibfk_1` FOREIGN KEY (`session_id`) REFERENCES `training_sessions` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='é™ªç»ƒæŠ¥å‘Šè¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `training_reports`
--

LOCK TABLES `training_reports` WRITE;
/*!40000 ALTER TABLE `training_reports` DISABLE KEYS */;
/*!40000 ALTER TABLE `training_reports` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `training_scenes`
--

DROP TABLE IF EXISTS `training_scenes`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `training_scenes` (
  `id` int NOT NULL AUTO_INCREMENT,
  `name` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'åœºæ™¯åç§°',
  `description` text COLLATE utf8mb4_unicode_ci COMMENT 'åœºæ™¯æè¿°',
  `category` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'åœºæ™¯åˆ†ç±»',
  `ai_config` json DEFAULT NULL COMMENT 'AIé…ç½®ï¼ˆå¦‚Coze Bot IDç­‰ï¼‰',
  `prompt_template` text COLLATE utf8mb4_unicode_ci COMMENT 'æç¤ºè¯æ¨¡æ¿',
  `evaluation_criteria` json DEFAULT NULL COMMENT 'è¯„ä¼°æ ‡å‡†',
  `status` enum('DRAFT','ACTIVE','INACTIVE') COLLATE utf8mb4_unicode_ci DEFAULT 'DRAFT' COMMENT 'åœºæ™¯çŠ¶æ€',
  `is_public` tinyint(1) DEFAULT '1' COMMENT 'æ˜¯å¦å…¬å¼€',
  `required_level` int DEFAULT NULL COMMENT 'æ‰€éœ€ç”¨æˆ·ç­‰çº§',
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦åˆ é™¤',
  `deleted_at` datetime DEFAULT NULL COMMENT 'åˆ é™¤æ—¶é—´',
  `created_by` bigint DEFAULT NULL COMMENT 'åˆ›å»ºäººID',
  `updated_by` bigint DEFAULT NULL COMMENT 'æ›´æ–°äººID',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_status` (`status`),
  KEY `idx_category` (`category`),
  KEY `idx_is_public` (`is_public`),
  KEY `idx_is_deleted` (`is_deleted`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='é™ªç»ƒåœºæ™¯è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `training_scenes`
--

LOCK TABLES `training_scenes` WRITE;
/*!40000 ALTER TABLE `training_scenes` DISABLE KEYS */;
INSERT INTO `training_scenes` VALUES (1,'Python编程助手','帮助学员解决Python编程问题','技术辅导','{\"bot_id\": \"python_assistant_bot\"}',NULL,NULL,'ACTIVE',1,NULL,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 18:30:51'),(2,'面试模拟','模拟技术面试场景','职业发展','{\"bot_id\": \"interview_simulator_bot\"}',NULL,NULL,'ACTIVE',1,NULL,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 18:30:51'),(3,'项目讨论','项目方案讨论和优化','项目管理','{\"bot_id\": \"project_discussion_bot\"}',NULL,NULL,'DRAFT',1,NULL,0,NULL,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 18:30:51');
/*!40000 ALTER TABLE `training_scenes` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `training_sessions`
--

DROP TABLE IF EXISTS `training_sessions`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `training_sessions` (
  `id` int NOT NULL AUTO_INCREMENT,
  `user_id` int NOT NULL COMMENT 'ç”¨æˆ·ID',
  `scene_id` int NOT NULL COMMENT 'åœºæ™¯ID',
  `coze_conversation_id` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'Cozeä¼šè¯ID',
  `start_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'å¼€å§‹æ—¶é—´',
  `end_time` datetime DEFAULT NULL COMMENT 'ç»“æŸæ—¶é—´',
  `duration_seconds` int DEFAULT NULL COMMENT 'æŒç»­æ—¶é•¿ï¼ˆç§’ï¼‰',
  `status` enum('CREATED','IN_PROGRESS','COMPLETED','CANCELLED','ERROR') COLLATE utf8mb4_unicode_ci DEFAULT 'CREATED' COMMENT 'ä¼šè¯çŠ¶æ€',
  `session_config` json DEFAULT NULL COMMENT 'ä¼šè¯é…ç½®',
  `total_score` float DEFAULT NULL COMMENT 'æ€»åˆ†',
  `evaluation_result` json DEFAULT NULL COMMENT 'è¯„ä¼°ç»“æžœè¯¦æƒ…',
  `created_by` bigint DEFAULT NULL COMMENT 'åˆ›å»ºäººID',
  `updated_by` bigint DEFAULT NULL COMMENT 'æ›´æ–°äººID',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  PRIMARY KEY (`id`),
  KEY `idx_user_id` (`user_id`),
  KEY `idx_scene_id` (`scene_id`),
  KEY `idx_status` (`status`),
  CONSTRAINT `training_sessions_ibfk_1` FOREIGN KEY (`scene_id`) REFERENCES `training_scenes` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='é™ªç»ƒä¼šè¯è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `training_sessions`
--

LOCK TABLES `training_sessions` WRITE;
/*!40000 ALTER TABLE `training_sessions` DISABLE KEYS */;
/*!40000 ALTER TABLE `training_sessions` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `user_teams`
--

DROP TABLE IF EXISTS `user_teams`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `user_teams` (
  `user_id` int NOT NULL,
  `team_id` int NOT NULL,
  `role` varchar(50) COLLATE utf8mb4_unicode_ci DEFAULT 'member' COMMENT 'å›¢é˜Ÿè§’è‰²: member, leader',
  `joined_at` datetime DEFAULT CURRENT_TIMESTAMP COMMENT 'åŠ å…¥æ—¶é—´',
  PRIMARY KEY (`user_id`,`team_id`),
  KEY `team_id` (`team_id`),
  CONSTRAINT `user_teams_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `users` (`id`) ON DELETE CASCADE,
  CONSTRAINT `user_teams_ibfk_2` FOREIGN KEY (`team_id`) REFERENCES `teams` (`id`) ON DELETE CASCADE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='ç”¨æˆ·å›¢é˜Ÿå…³è”è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `user_teams`
--

LOCK TABLES `user_teams` WRITE;
/*!40000 ALTER TABLE `user_teams` DISABLE KEYS */;
INSERT INTO `user_teams` VALUES (2,1,'leader','2025-09-22 17:18:23'),(2,2,'leader','2025-09-22 17:18:23'),(3,1,'member','2025-09-22 17:18:23'),(3,3,'member','2025-09-22 17:18:23');
/*!40000 ALTER TABLE `user_teams` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Table structure for table `users`
--

DROP TABLE IF EXISTS `users`;
/*!40101 SET @saved_cs_client     = @@character_set_client */;
/*!50503 SET character_set_client = utf8mb4 */;
CREATE TABLE `users` (
  `id` int NOT NULL AUTO_INCREMENT,
  `username` varchar(50) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'ç”¨æˆ·å',
  `email` varchar(100) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'é‚®ç®±',
  `phone` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'æ‰‹æœºå·',
  `password_hash` varchar(200) COLLATE utf8mb4_unicode_ci NOT NULL COMMENT 'å¯†ç å“ˆå¸Œ',
  `full_name` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å§“å',
  `gender` varchar(10) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'æ€§åˆ«: male/female',
  `avatar_url` varchar(500) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å¤´åƒURL',
  `bio` text COLLATE utf8mb4_unicode_ci COMMENT 'ä¸ªäººç®€ä»‹',
  `school` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'å­¦æ ¡',
  `major` varchar(100) COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT 'ä¸“ä¸š',
  `role` varchar(20) COLLATE utf8mb4_unicode_ci DEFAULT 'trainee' COMMENT 'ç³»ç»Ÿè§’è‰²: admin, manager, trainee',
  `is_active` tinyint(1) DEFAULT '1' COMMENT 'æ˜¯å¦æ¿€æ´»',
  `is_verified` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦éªŒè¯',
  `last_login_at` datetime DEFAULT NULL COMMENT 'æœ€åŽç™»å½•æ—¶é—´',
  `password_changed_at` datetime DEFAULT NULL COMMENT 'å¯†ç ä¿®æ”¹æ—¶é—´',
  `created_at` datetime DEFAULT CURRENT_TIMESTAMP,
  `updated_at` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
  `is_deleted` tinyint(1) DEFAULT '0' COMMENT 'æ˜¯å¦åˆ é™¤',
  `deleted_at` datetime DEFAULT NULL COMMENT 'åˆ é™¤æ—¶é—´',
  PRIMARY KEY (`id`),
  UNIQUE KEY `username` (`username`),
  UNIQUE KEY `email` (`email`),
  UNIQUE KEY `phone` (`phone`),
  KEY `idx_role` (`role`),
  KEY `idx_is_active` (`is_active`)
) ENGINE=InnoDB AUTO_INCREMENT=4 DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='ç”¨æˆ·è¡¨';
/*!40101 SET character_set_client = @saved_cs_client */;

--
-- Dumping data for table `users`
--

LOCK TABLES `users` WRITE;
/*!40000 ALTER TABLE `users` DISABLE KEYS */;
INSERT INTO `users` VALUES (1,'superadmin','superadmin@kaopeilian.com','13800000001','$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/LewKyNiQdP/sQj6C6','超级管理员',NULL,NULL,NULL,NULL,NULL,'admin',1,1,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36',0,NULL),(2,'admin','admin@kaopeilian.com','13800000002','$2b$12$NEGFEN8951QMRQMauW53Qe2VLOajCRrTbpFZzyn9RjtlLDVvXawl.','系统管理员','male',NULL,NULL,'李会计','是的发','admin',1,1,'2025-09-22 17:43:37',NULL,'2025-09-22 17:18:23','2025-09-22 17:45:58',0,NULL),(3,'testuser','testuser@kaopeilian.com','13800000003','$2b$12$LQv3c1yqBWVHxkd0LHAkCOYz6TtxMQJqhN8/LewKyNiQdP/sQj6C6','测试学员',NULL,NULL,NULL,NULL,NULL,'trainee',1,1,NULL,NULL,'2025-09-22 17:18:23','2025-09-22 17:45:36',0,NULL);
/*!40000 ALTER TABLE `users` ENABLE KEYS */;
UNLOCK TABLES;

--
-- Temporary view structure for view `v_user_course_progress`
--

DROP TABLE IF EXISTS `v_user_course_progress`;
/*!50001 DROP VIEW IF EXISTS `v_user_course_progress`*/;
SET @saved_cs_client     = @@character_set_client;
/*!50503 SET character_set_client = utf8mb4 */;
/*!50001 CREATE VIEW `v_user_course_progress` AS SELECT 
 1 AS `user_id`,
 1 AS `username`,
 1 AS `course_id`,
 1 AS `course_name`,
 1 AS `exam_count`,
 1 AS `avg_score`,
 1 AS `best_score`*/;
SET character_set_client = @saved_cs_client;

--
-- Dumping routines for database 'kaopeilian'
--

--
-- Final view structure for view `v_user_course_progress`
--

/*!50001 DROP VIEW IF EXISTS `v_user_course_progress`*/;
/*!50001 SET @saved_cs_client          = @@character_set_client */;
/*!50001 SET @saved_cs_results         = @@character_set_results */;
/*!50001 SET @saved_col_connection     = @@collation_connection */;
/*!50001 SET character_set_client      = latin1 */;
/*!50001 SET character_set_results     = latin1 */;
/*!50001 SET collation_connection      = latin1_swedish_ci */;
/*!50001 CREATE ALGORITHM=UNDEFINED */
/*!50013 DEFINER=`root`@`localhost` SQL SECURITY DEFINER */
/*!50001 VIEW `v_user_course_progress` AS select `u`.`id` AS `user_id`,`u`.`username` AS `username`,`c`.`id` AS `course_id`,`c`.`name` AS `course_name`,count(distinct `e`.`id`) AS `exam_count`,avg(`e`.`score`) AS `avg_score`,max(`e`.`score`) AS `best_score` from ((`users` `u` join `courses` `c`) left join `exams` `e` on(((`e`.`user_id` = `u`.`id`) and (`e`.`course_id` = `c`.`id`) and (`e`.`status` = 'submitted')))) group by `u`.`id`,`c`.`id` */;
/*!50001 SET character_set_client      = @saved_cs_client */;
/*!50001 SET character_set_results     = @saved_cs_results */;
/*!50001 SET collation_connection      = @saved_col_connection */;
/*!40103 SET TIME_ZONE=@OLD_TIME_ZONE */;

/*!40101 SET SQL_MODE=@OLD_SQL_MODE */;
/*!40014 SET FOREIGN_KEY_CHECKS=@OLD_FOREIGN_KEY_CHECKS */;
/*!40014 SET UNIQUE_CHECKS=@OLD_UNIQUE_CHECKS */;
/*!40101 SET CHARACTER_SET_CLIENT=@OLD_CHARACTER_SET_CLIENT */;
/*!40101 SET CHARACTER_SET_RESULTS=@OLD_CHARACTER_SET_RESULTS */;
/*!40101 SET COLLATION_CONNECTION=@OLD_COLLATION_CONNECTION */;
/*!40111 SET SQL_NOTES=@OLD_SQL_NOTES */;

-- Dump completed on 2025-09-22 18:36:04
