48 lines
1.8 KiB
MySQL
48 lines
1.8 KiB
MySQL
|
|
-- =====================================================
|
||
|
|
-- 验证用户121的所有数据
|
||
|
|
-- =====================================================
|
||
|
|
|
||
|
|
-- 1. 关注记录
|
||
|
|
SELECT '=== 关注记录 ===' as 信息;
|
||
|
|
SELECT fr.id, fr.followed_id as followedId, fr.followed_nickname as followedNickname,
|
||
|
|
fr.follow_status as followStatus, fr.create_time as createTime
|
||
|
|
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;
|
||
|
|
|
||
|
|
-- 2. 点赞记录 - 直播间
|
||
|
|
SELECT '=== 直播间点赞 ===' as 信息;
|
||
|
|
SELECT 'room' as targetType, CAST(rl.room_id AS CHAR) as targetId,
|
||
|
|
lr.title as targetTitle, rl.create_time as createTime
|
||
|
|
FROM eb_live_room_like rl
|
||
|
|
LEFT JOIN eb_live_room lr ON rl.room_id = lr.id
|
||
|
|
WHERE rl.user_id = 121;
|
||
|
|
|
||
|
|
-- 3. 点赞记录 - 作品
|
||
|
|
SELECT '=== 作品点赞 ===' as 信息;
|
||
|
|
SELECT 'work' as targetType, CAST(wr.works_id AS CHAR) as targetId,
|
||
|
|
w.title as targetTitle, wr.create_time as createTime
|
||
|
|
FROM eb_works_relation wr
|
||
|
|
LEFT JOIN eb_works w ON wr.works_id = w.id
|
||
|
|
WHERE wr.uid = 121 AND wr.type = 1;
|
||
|
|
|
||
|
|
-- 4. 收藏记录
|
||
|
|
SELECT '=== 收藏记录 ===' as 信息;
|
||
|
|
SELECT wr.works_id as workId, w.title, w.user_id as authorId,
|
||
|
|
u.nickname as authorName, w.like_count as likeCount,
|
||
|
|
w.collect_count as collectCount, wr.create_time as collectTime
|
||
|
|
FROM eb_works_relation wr
|
||
|
|
LEFT JOIN eb_works w ON wr.works_id = w.id
|
||
|
|
LEFT JOIN eb_user u ON w.user_id = u.uid
|
||
|
|
WHERE wr.uid = 121 AND wr.type = 2;
|
||
|
|
|
||
|
|
-- 5. 观看历史
|
||
|
|
SELECT '=== 观看历史 ===' as 信息;
|
||
|
|
SELECT target_type as targetType, target_id as targetId,
|
||
|
|
target_title as targetTitle, view_duration as viewDuration,
|
||
|
|
create_time as createTime
|
||
|
|
FROM eb_view_history
|
||
|
|
WHERE user_id = 121
|
||
|
|
ORDER BY update_time DESC;
|