Files
012-kaopeilian/知识库/清空资料知识点.sql
111 998211c483 feat: 初始化考培练系统项目
- 从服务器拉取完整代码
- 按框架规范整理项目结构
- 配置 Drone CI 测试环境部署
- 包含后端(FastAPI)、前端(Vue3)、管理端

技术栈: Vue3 + TypeScript + FastAPI + MySQL
2026-01-24 19:33:28 +08:00

56 lines
2.3 KiB
SQL
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
-- ========================================
-- 清空指定资料的所有知识点(物理删除)
-- 用途为Dify工作流准备清空旧知识点以便重新生成
-- ========================================
-- 使用方法:
-- 1. 直接执行:将下面的 34 替换为实际的 material_id
-- 2. 在Dify中使用将整个SQL复制到Dify的SQL节点中
-- ========================================
-- 方式1删除单个资料的知识点
-- ========================================
DELETE FROM knowledge_points WHERE material_id = 34;
-- 验证删除结果
SELECT '删除完成' as status, ROW_COUNT() as deleted_count;
-- ========================================
-- 方式2使用变量更灵活
-- ========================================
-- SET @material_id = 34;
-- DELETE FROM knowledge_points WHERE material_id = @material_id;
-- SELECT CONCAT('已删除资料 ', @material_id, ' 的所有知识点') as result, ROW_COUNT() as count;
-- ========================================
-- 方式3批量删除多个资料的知识点
-- ========================================
-- DELETE FROM knowledge_points WHERE material_id IN (34, 35, 36);
-- SELECT ROW_COUNT() as total_deleted;
-- ========================================
-- 方式4删除并验证完整版
-- ========================================
-- -- 查看删除前的数量
-- SELECT '删除前' as timing, COUNT(*) as count FROM knowledge_points WHERE material_id = 34;
--
-- -- 执行删除
-- DELETE FROM knowledge_points WHERE material_id = 34;
--
-- -- 查看删除后的数量应该为0
-- SELECT '删除后' as timing, COUNT(*) as count FROM knowledge_points WHERE material_id = 34;
-- ========================================
-- 注意事项
-- ========================================
-- 1. 这是物理删除,数据无法恢复
-- 2. 如果有错题记录引用这些知识点,会自动将 exam_mistakes.knowledge_point_id 设置为 NULL
-- 3. 删除后可以通过Dify工作流重新生成新的知识点
-- 4. 默认会自动提交事务autocommit=1
-- ========================================
-- 快速使用Dify工作流SQL节点
-- ========================================
-- 复制以下单行命令到Dify的SQL执行节点
-- DELETE FROM knowledge_points WHERE material_id = {{material_id}};