-- 检查check_in_record表结构
-- 2026-01-25

-- 1. 检查表是否存在
SHOW TABLES LIKE 'check_in_record';

-- 2. 查看表结构
DESC check_in_record;

-- 3. 查看记录总数
SELECT COUNT(*) as total FROM check_in_record;

-- 4. 查看最近的打卡记录
SELECT * FROM check_in_record ORDER BY create_time DESC LIMIT 5;

-- 5. 检查关联数据
SELECT 
    c.id,
    c.order_id,
    c.teacher_id,
    c.check_type,
    c.check_time,
    c.address,
    o.order_no,
    t.teacher_name,
    t.phone as teacher_phone
FROM check_in_record c
LEFT JOIN `order` o ON c.order_id = o.id
LEFT JOIN teacher t ON c.teacher_id = t.id
ORDER BY c.create_time DESC
LIMIT 5;
