-- 验证用户121的所有测试数据
-- ========================================

-- 1. 验证用户信息
SELECT '=== 用户信息 ===' as info;
SELECT uid, nickname, phone, avatar FROM eb_user WHERE uid = 121;

-- 2. 验证观看历史
SELECT '=== 观看历史 (eb_view_history) ===' as info;
SELECT COUNT(*) as total FROM eb_view_history WHERE user_id = 121;
SELECT id, user_id, target_type, target_id, target_title, view_duration, create_time 
FROM eb_view_history WHERE user_id = 121 ORDER BY create_time DESC LIMIT 5;

-- 3. 验证直播间点赞
SELECT '=== 直播间点赞 (eb_live_room_like) ===' as info;
SELECT COUNT(*) as total FROM eb_live_room_like WHERE user_id = 121;
SELECT rl.id, rl.user_id, rl.room_id, lr.title as room_title, rl.create_time
FROM eb_live_room_like rl
LEFT JOIN eb_live_room lr ON rl.room_id = lr.id
WHERE rl.user_id = 121 ORDER BY rl.create_time DESC LIMIT 5;

-- 4. 验证作品点赞 (type=1)
SELECT '=== 作品点赞 (eb_works_relation type=1) ===' as info;
SELECT COUNT(*) as total FROM eb_works_relation WHERE uid = 121 AND type = 1;
SELECT wr.id, wr.uid, wr.works_id, w.title as work_title, wr.type, wr.create_time
FROM eb_works_relation wr
LEFT JOIN eb_works w ON wr.works_id = w.id
WHERE wr.uid = 121 AND wr.type = 1 ORDER BY wr.create_time DESC LIMIT 5;

-- 5. 验证作品收藏 (type=2)
SELECT '=== 作品收藏 (eb_works_relation type=2) ===' as info;
SELECT COUNT(*) as total FROM eb_works_relation WHERE uid = 121 AND type = 2;
SELECT wr.id, wr.uid, wr.works_id, w.title as work_title, wr.type, wr.create_time
FROM eb_works_relation wr
LEFT JOIN eb_works w ON wr.works_id = w.id
WHERE wr.uid = 121 AND wr.type = 2 ORDER BY wr.create_time DESC LIMIT 5;

-- 6. 验证关注记录
SELECT '=== 关注记录 (eb_follow_record) ===' as info;
SELECT COUNT(*) as total FROM eb_follow_record WHERE follower_id = 121 AND (follow_status = 1 OR follow_status = '关注');
SELECT fr.id, fr.follower_id, fr.followed_id, fr.followed_nickname, fr.follow_status, fr.create_time
FROM eb_follow_record fr
WHERE fr.follower_id = 121 AND (fr.follow_status = 1 OR fr.follow_status = '关注')
ORDER BY fr.create_time DESC LIMIT 5;

-- 7. 验证搜索历史
SELECT '=== 搜索历史 (eb_search_history) ===' as info;
SELECT COUNT(*) as total FROM eb_search_history WHERE user_id = 121 AND is_deleted = 0;
SELECT id, user_id, keyword, search_type, create_time
FROM eb_search_history WHERE user_id = 121 AND is_deleted = 0 ORDER BY create_time DESC LIMIT 5;

-- 8. 验证直播间数据
SELECT '=== 直播间 (eb_live_room) ===' as info;
SELECT COUNT(*) as total FROM eb_live_room;
SELECT id, title, streamer_name, is_live, like_count, view_count FROM eb_live_room LIMIT 5;

-- 9. 验证作品数据
SELECT '=== 作品 (eb_works) ===' as info;
SELECT COUNT(*) as total FROM eb_works;
SELECT id, title, user_id, like_count, collect_count, view_count FROM eb_works LIMIT 5;

-- 10. 汇总统计
SELECT '=== 数据汇总 ===' as info;
SELECT 
    (SELECT COUNT(*) FROM eb_view_history WHERE user_id = 121) as view_history_count,
    (SELECT COUNT(*) FROM eb_live_room_like WHERE user_id = 121) as room_like_count,
    (SELECT COUNT(*) FROM eb_works_relation WHERE uid = 121 AND type = 1) as work_like_count,
    (SELECT COUNT(*) FROM eb_works_relation WHERE uid = 121 AND type = 2) as work_collect_count,
    (SELECT COUNT(*) FROM eb_follow_record WHERE follower_id = 121 AND (follow_status = 1 OR follow_status = '关注')) as follow_count,
    (SELECT COUNT(*) FROM eb_search_history WHERE user_id = 121 AND is_deleted = 0) as search_count;
