USE study;

-- 检查题库中的多选题答案
SELECT 
    i.id,
    b.bank_name,
    i.question_type,
    LEFT(i.question_content, 30) AS content,
    i.options,
    i.correct_answer,
    CASE 
        WHEN i.correct_answer IS NULL OR i.correct_answer = '' THEN '❌ 空答案'
        WHEN i.question_type = 'multiple' AND i.correct_answer LIKE '%,%' THEN '✓ 字母标签'
        WHEN i.question_type = 'multiple' THEN '⚠️ 可能是选项文本'
        ELSE '✓ OK'
    END AS status
FROM question_bank_item i
LEFT JOIN question_bank b ON i.bank_id = b.id
WHERE i.question_type = 'multiple'
ORDER BY i.id
LIMIT 10;

-- 查看最近导入的考试题目
SELECT 
    q.id,
    q.exam_id,
    e.exam_name,
    q.source_type,
    q.bank_id,
    q.bank_item_id,
    q.question_type,
    LEFT(q.question_content, 30) AS content,
    q.correct_answer
FROM question q
LEFT JOIN exam e ON q.exam_id = e.id
WHERE q.source_type = 'bank'
  AND q.question_type = 'multiple'
ORDER BY q.id DESC
LIMIT 10;
