From 32affb9328997ab51b2c88f7f034c16a1e7ed6d0 Mon Sep 17 00:00:00 2001 From: xiangpei <xiangpei@timesnew.cn> Date: 星期五, 30 五月 2025 17:15:20 +0800 Subject: [PATCH] 评论点赞 --- framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml | 37 +++++++++++++++++++++++++------------ 1 files changed, 25 insertions(+), 12 deletions(-) diff --git a/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml b/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml index bfe9329..759dfc5 100644 --- a/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml +++ b/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml @@ -13,11 +13,13 @@ <result column="reply_user_avatar" property="replyUserAvatar" /> <result column="master_comment_id" property="masterCommentId" /> <result column="status" property="status" /> - <result column="create_by" property="userId" /> + <result column="thumbs_up_num" property="thumbsUpNum" /> + <result column="userId" property="userId" /> <result column="user_nickname" property="userNickname" /> <result column="user_avatar" property="userAvatar" /> <result column="create_time" property="createTime" /> <result column="replyTotalCount" property="replyTotalCount" /> + <result column="has_thumbs_up" property="hasThumbsUp" /> </resultMap> @@ -35,8 +37,9 @@ LVC.reply_user_nickname, LVC.master_comment_id, LVC.status, + LVC.thumbs_up_num, LVC.id, - LVC.create_by, + LVC.user_id, LVC.user_nickname, LVC.user_avatar, LVC.create_time @@ -56,8 +59,9 @@ LVC.reply_user_nickname, LVC.master_comment_id, LVC.status, + LVC.thumbs_up_num, LVC.id, - LVC.create_by, + LVC.user_id, LVC.user_nickname, LVC.user_avatar, LVC.create_time @@ -78,18 +82,21 @@ LVC.reply_user_avatar, LVC.master_comment_id, LVC.status, + LVC.thumbs_up_num, LVC.id, - LVC.create_by, + LVC.user_id, LVC.user_nickname, LVC.user_avatar, LVC.create_time, - COUNT(replies.id) as replyTotalCount + COUNT(replies.id) as replyTotalCount, + CASE + WHEN TUC.id IS NOT NULL THEN 1 + ELSE 0 + END AS has_thumbs_up FROM lmk_video_comment LVC - LEFT JOIN - lmk_video_comment replies ON replies.master_comment_id = LVC.id - AND replies.status = 'normal' - AND replies.delete_flag = 0 + LEFT JOIN lmk_video_comment replies ON replies.master_comment_id = LVC.id AND replies.status = 'normal' AND replies.delete_flag = 0 + LEFT JOIN lmk_thumbs_up_record TUC ON LVC.id = TUC.ref_id AND TUC.thumbs_up_type = 'video_comment' AND TUC.user_id = #{query.userId} AND TUC.delete_flag = 0 WHERE LVC.master_comment_id IS NULL AND LVC.video_id = #{query.videoId} @@ -98,7 +105,7 @@ GROUP BY LVC.id, LVC.video_id, LVC.comment_content, LVC.reply_id, LVC.reply_user_id, LVC.reply_user_nickname, LVC.master_comment_id, - LVC.status, LVC.create_by, LVC.user_nickname, LVC.user_avatar, LVC.create_time + LVC.status, LVC.user_id, LVC.user_nickname, LVC.user_avatar, LVC.create_time ORDER BY LVC.create_time DESC </select> @@ -113,14 +120,20 @@ LVC.reply_user_avatar, LVC.master_comment_id, LVC.status, + LVC.thumbs_up_num, LVC.id, - LVC.create_by, + LVC.user_id, LVC.user_nickname, LVC.user_avatar, LVC.create_time, - 0 as replyTotalCount + 0 as replyTotalCount, + CASE + WHEN TUC.id IS NOT NULL THEN 1 + ELSE 0 + END AS has_thumbs_up FROM lmk_video_comment LVC + LEFT JOIN lmk_thumbs_up_record TUC ON LVC.id = TUC.ref_id AND TUC.thumbs_up_type = 'video_comment' AND TUC.user_id = #{query.userId} AND TUC.delete_flag = 0 WHERE LVC.video_id = #{query.videoId} AND LVC.master_comment_id = #{query.masterCommentId} -- Gitblit v1.8.0