From f40914a35678266624c6dbf382b31b2db9ac6720 Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期六, 11 十月 2025 09:17:09 +0800
Subject: [PATCH] 定制商品模板
---
framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml | 98 ++++++++++++++++++++++++++++++++++++++++--------
1 files changed, 81 insertions(+), 17 deletions(-)
diff --git a/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml b/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml
index 2e64ebc..eb8528b 100644
--- a/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml
+++ b/framework/src/main/resources/mapper/lmk/VideoCommentMapper.xml
@@ -10,13 +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>
@@ -34,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
@@ -45,6 +49,38 @@
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
@@ -55,8 +91,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
@@ -74,20 +111,24 @@
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.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}
@@ -96,7 +137,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>
@@ -108,16 +149,23 @@
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.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}
@@ -129,14 +177,30 @@
<select id="countNumGroupByVideo" resultType="cn.lili.modules.lmk.domain.vo.CollectTypeNumVO">
SELECT
- video_id as id,
- COUNT(*) as countNum
+ LV.id as id,
+ COUNT(LVC.video_id) as countNum
FROM
- lmk_video_comment
+ 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
- delete_flag = 0 AND status = 'normal'
+ LV.comment_num_job = 1 AND LV.delete_flag = 0 AND LV.status = '1'
GROUP BY
- video_id
+ 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