From 2a7b0a64b14b22ec45f8a0f6e4764bc3cd16919c Mon Sep 17 00:00:00 2001
From: peng <peng.com>
Date: 星期一, 27 十月 2025 17:08:24 +0800
Subject: [PATCH] 调整
---
framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml | 129 ++++++++++++++++++++++++++++++++++++++----
1 files changed, 115 insertions(+), 14 deletions(-)
diff --git a/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml b/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml
index 365fe5b..eb8528b 100644
--- a/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml
+++ b/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml
@@ -10,11 +10,16 @@
<result column="reply_id" property="replyId" />
<result column="reply_user_id" property="replyUserId" />
<result column="reply_user_nickname" property="replyUserNickname" />
+ <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="user_id" 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>
@@ -28,24 +33,70 @@
LVC.video_id,
LVC.comment_content,
LVC.reply_id,
+ LVC.reply_user_id,
+ LVC.reply_user_nickname,
LVC.master_comment_id,
LVC.status,
- LVC.id
+ LVC.thumbs_up_num,
+ LVC.id,
+ LVC.user_id,
+ LVC.user_nickname,
+ LVC.user_avatar,
+ LVC.create_time
FROM
lmk_video_comment LVC
WHERE
LVC.id = #{id} AND LVC.delete_flag = 0
</select>
+ <select id="getManagerPage" resultMap="BaseResultMap">
+ SELECT
+ LVC.video_id,
+ LVC.comment_content,
+ LVC.reply_id,
+ LVC.reply_user_id,
+ LVC.reply_user_nickname,
+ LVC.master_comment_id,
+ LVC.status,
+ LVC.thumbs_up_num,
+ LVC.id,
+ LVC.user_id,
+ LVC.user_nickname,
+ LVC.user_avatar,
+ LVC.create_time
+ FROM
+ lmk_video_comment LVC
+ WHERE
+ LVC.video_id = #{query.videoId} AND LVC.delete_flag = 0
+ <if test="query.commentContent != null and query.commentContent !=''">
+ AND LVC.comment_content like concat('%',#{query.commentContent},'%')
+ </if>
+ <if test="query.nickName != null and query.nickName !=''">
+ AND LVC.user_nickname like concat('%',#{query.nickName},'%')
+ </if>
+ <if test="query.startTime != null">
+ AND LVC.create_time >= #{query.startTime}
+ </if>
+ <if test="query.endTime != null">
+ AND LVC.create_time <= #{query.endTime}
+ </if>
+ </select>
<select id="getPage" resultMap="BaseResultMap">
SELECT
LVC.video_id,
LVC.comment_content,
LVC.reply_id,
+ LVC.reply_user_id,
+ LVC.reply_user_nickname,
LVC.master_comment_id,
LVC.status,
- LVC.id
+ LVC.thumbs_up_num,
+ LVC.id,
+ LVC.user_id,
+ LVC.user_nickname,
+ LVC.user_avatar,
+ LVC.create_time
FROM
lmk_video_comment LVC
WHERE
@@ -60,19 +111,33 @@
LVC.reply_id,
LVC.reply_user_id,
LVC.reply_user_nickname,
+ 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.user_avatar,
+ LVC.create_time,
+ 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
+ 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_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.id = LVC.master_comment_id
- AND LVC.video_id = #{query.videoId}
- AND LVC.status = 'normal'
- AND LVC.delete_flag = 0
+ LVC.master_comment_id IS NULL
+ AND LVC.video_id = #{query.videoId}
+ AND LVC.status = 'normal'
+ AND LVC.delete_flag = 0
+ 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.user_id, LVC.user_nickname, LVC.user_avatar, LVC.create_time
ORDER BY
LVC.create_time DESC
</select>
@@ -84,17 +149,25 @@
LVC.reply_id,
LVC.reply_user_id,
LVC.reply_user_nickname,
+ 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.user_avatar,
+ LVC.create_time,
+ 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.id = LVC.master_comment_id
- AND LVC.video_id = #{query.videoId}
+ LVC.video_id = #{query.videoId}
AND LVC.master_comment_id = #{query.masterCommentId}
AND LVC.status = 'normal'
AND LVC.delete_flag = 0
@@ -102,4 +175,32 @@
LVC.create_time ASC
</select>
+ <select id="countNumGroupByVideo" resultType="cn.lili.modules.lmk.domain.vo.CollectTypeNumVO">
+ SELECT
+ LV.id as id,
+ COUNT(LVC.video_id) as countNum
+ FROM
+ lmk_video LV
+ LEFT JOIN lmk_video_comment LVC ON LVC.video_id = LV.id AND LVC.delete_flag = 0 AND LVC.status = 'normal'
+ WHERE
+ LV.comment_num_job = 1 AND LV.delete_flag = 0 AND LV.status = '1'
+ GROUP BY
+ LVC.video_id
+ </select>
+
+
+ <update id="updateCommentThumbsUpNumBatch">
+ UPDATE lmk_video_comment
+ SET thumbs_up_num = CASE id
+ <foreach collection="list" item="comment">
+ WHEN #{comment.id} THEN #{comment.countNum}
+ </foreach>
+ ELSE thumbs_up_num
+ END
+ WHERE id IN
+ <foreach collection="list" item="comment" open="(" separator="," close=")">
+ #{comment.id}
+ </foreach>
+ </update>
+
</mapper>
--
Gitblit v1.8.0