From 09c1e21cad0b474babb1d2f67f481b582adf0b0f Mon Sep 17 00:00:00 2001
From: zxl <763096477@qq.com>
Date: 星期二, 29 七月 2025 14:43:42 +0800
Subject: [PATCH] Merge remote-tracking branch 'origin/dev' into dev

---
 framework/src/main/resources/mapper/lmk/VideoMapper.xml |  436 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 435 insertions(+), 1 deletions(-)

diff --git a/framework/src/main/resources/mapper/lmk/VideoMapper.xml b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
index d4ce727..1da37db 100644
--- a/framework/src/main/resources/mapper/lmk/VideoMapper.xml
+++ b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
@@ -17,6 +17,7 @@
         <result column="play_num" property="playNum" />
         <result column="collect_num" property="collectNum" />
         <result column="comment_num" property="commentNum" />
+        <result column="thumbs_up_num" property="thumbsUpNum" />
         <result column="weight" property="weight" />
         <result column="audit_pass_time" property="auditPassTime" />
         <result column="update_time" property="updateTime" />
@@ -26,8 +27,10 @@
         <collection property="goodsList" column="id" select="getVideoGoods" ofType="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO"/>
     </resultMap>
 
+
     <resultMap id="VideoGoodsMap" type="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO">
         <result column="goods_id" property="goodsId"/>
+        <result column="goods_sku_id" property="id"/>
         <result column="goods_num" property="goodsNum"/>
         <result column="goods_name" property="goodsName"/>
         <result column="thumbnail" property="thumbnail"/>
@@ -37,6 +40,7 @@
     <select id="getVideoGoods" parameterType="string" resultMap="VideoGoodsMap">
         SELECT
                LVG.goods_id,
+               LVG.goods_sku_id,
                LVG.goods_num,
                LVG.order_num,
                LG.goods_name,
@@ -44,7 +48,7 @@
                LG.price
         FROM
              lmk_video_goods LVG
-             INNER JOIN li_goods LG ON LVG.goods_id = LG.id AND LG.market_enable = 'UPPER' AND LG.delete_flag = 0
+             INNER JOIN li_goods_sku LG ON LVG.goods_sku_id = LG.id AND LG.market_enable = 'UPPER' AND LG.delete_flag = 0
         WHERE
              LVG.video_id = #{id} AND LVG.delete_flag = 0
         ORDER BY
@@ -68,6 +72,7 @@
         <result column="play_num" property="playNum" />
         <result column="collect_num" property="collectNum" />
         <result column="comment_num" property="commentNum" />
+        <result column="thumbs_up_num" property="thumbsUpNum" />
         <result column="weight" property="weight" />
         <result column="audit_pass_time" property="auditPassTime" />
         <result column="update_time" property="updateTime" />
@@ -89,6 +94,7 @@
         <result column="title" property="title" />
         <result column="collect_num" property="collectNum" />
         <result column="comment_num" property="commentNum" />
+        <result column="thumbs_up_num" property="thumbsUpNum" />
         <result column="status" property="status" />
         <result column="video_content_type" property="videoContentType" />
         <result column="video_type" property="videoType" />
@@ -96,6 +102,29 @@
         <collection property="goodsList" column="id" select="getVideoGoods" ofType="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO"/>
     </resultMap>
 
+    <!-- 鎾斁鍘嗗彶 -->
+    <resultMap id="HistoryMap" type="cn.lili.modules.lmk.domain.vo.VideoHistoryVO">
+        <id column="id" property="id"/>
+        <result column="author_id" property="authorId" />
+        <result column="authorName" property="authorName" />
+        <result column="authorAvatar" property="authorAvatar" />
+        <result column="cover_url" property="coverFileKey" />
+        <result column="video_file_key" property="videoFileKey" />
+        <result column="video_fit" property="videoFit" />
+        <result column="video_duration" property="videoDuration" />
+        <result column="title" property="title" />
+        <result column="collect_num" property="collectNum" />
+        <result column="comment_num" property="commentNum" />
+        <result column="thumbs_up_num" property="thumbsUpNum" />
+        <result column="status" property="status" />
+        <result column="video_content_type" property="videoContentType" />
+        <result column="video_type" property="videoType" />
+        <result column="video_imgs" property="videoImgs" />
+        <result column="historyId" property="historyId" />
+        <result column="play_at" property="playAt" />
+        <result column="playTime" property="playTime" />
+        <collection property="goodsList" column="id" select="getVideoGoods" ofType="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO"/>
+    </resultMap>
 
     <select id="getById" resultMap="BaseResultMap">
         SELECT
@@ -112,6 +141,7 @@
             LV.play_num,
             LV.collect_num,
             LV.comment_num,
+            LV.thumbs_up_num,
             LV.weight,
             LV.audit_pass_time,
             LV.update_time,
@@ -143,6 +173,7 @@
             LV.play_num,
             LV.collect_num,
             LV.comment_num,
+            LV.thumbs_up_num,
             LV.weight,
             LV.audit_pass_time,
             LV.update_time,
@@ -174,6 +205,7 @@
             LV.play_num,
             LV.collect_num,
             LV.comment_num,
+            LV.thumbs_up_num,
             LV.weight,
             LV.audit_pass_time,
             LV.update_time,
@@ -216,9 +248,11 @@
             LV.play_num,
             LV.comment_num,
             LV.collect_num,
+            LV.thumbs_up_num,
             LV.weight,
             LV.audit_pass_time,
             LV.update_time,
+            LV.create_time,
             LV.video_content_type,
             LV.video_type,
             LV.video_imgs,
@@ -230,7 +264,169 @@
             LEFT JOIN li_member LM ON LV.author_id = LM.id
         WHERE
             LV.delete_flag = 0 AND LV.status = '1' AND LV.video_type = #{query.videoType}
+        ORDER BY
+            LV.create_time DESC
     </select>
+    <select id="recommendVideoByVideoId" resultMap="WxResultMap">
+        SELECT
+            LV.author_id,
+            LV.cover_url,
+            LV.video_fit,
+            LV.video_duration,
+            LV.video_file_key,
+            LV.title,
+            LV.goods_view_num,
+            LV.goods_order_num,
+            LV.recommend,
+            LV.status,
+            LV.play_num,
+            LV.comment_num,
+            LV.collect_num,
+            LV.thumbs_up_num,
+            LV.weight,
+            LV.audit_pass_time,
+            LV.update_time,
+            LV.create_time,
+            LV.video_content_type,
+            LV.video_type,
+            LV.video_imgs,
+            LV.id,
+            LM.nick_name as authorName,
+            LM.face as authorAvatar
+        FROM
+            lmk_video LV
+                LEFT JOIN li_member LM ON LV.author_id = LM.id
+        WHERE
+            LV.delete_flag = 0 AND LV.status = '1' AND LV.id = #{query.videoId}
+        ORDER BY
+            LV.create_time DESC
+    </select>
+    <select id="recommendVideoList" resultMap="WxResultMap">
+        SELECT
+            LV.author_id,
+            LV.cover_url,
+            LV.video_fit,
+            LV.video_duration,
+            LV.video_file_key,
+            LV.title,
+            LV.goods_view_num,
+            LV.goods_order_num,
+            LV.recommend,
+            LV.status,
+            LV.play_num,
+            LV.comment_num,
+            LV.collect_num,
+            LV.thumbs_up_num,
+            LV.weight,
+            LV.audit_pass_time,
+            LV.update_time,
+            LV.create_time,
+            LV.video_content_type,
+            LV.video_type,
+            LV.video_imgs,
+            LV.id,
+            LM.nick_name as authorName,
+            LM.face as authorAvatar
+        FROM
+            lmk_video LV
+            LEFT JOIN li_member LM ON LV.author_id = LM.id
+        WHERE
+            LV.delete_flag = 0 AND LV.status = '1' AND LV.video_type = #{query.videoType}
+        ORDER BY
+            LV.create_time DESC
+    </select>
+
+    <select id="goodsSimilarlyPage" resultMap="WxResultMap">
+        SELECT
+            LV.author_id,
+            LV.cover_url,
+            LV.video_fit,
+            LV.video_duration,
+            LV.video_file_key,
+            LV.title,
+            LV.goods_view_num,
+            LV.goods_order_num,
+            LV.recommend,
+            LV.status,
+            LV.play_num,
+            LV.comment_num,
+            LV.collect_num,
+            LV.thumbs_up_num,
+            LV.weight,
+            LV.audit_pass_time,
+            LV.update_time,
+            LV.create_time,
+            LV.video_content_type,
+            LV.video_type,
+            LV.video_imgs,
+            LV.id,
+            CASE
+                WHEN LM.nick_name IS NOT NULL THEN LM.nick_name
+                WHEN LM.nick_name IS NULL THEN (SELECT nick_name FROM li_admin_user WHERE id = LV.author_id)
+                ELSE ''
+            END as authorName,
+            CASE
+                WHEN LM.face IS NOT NULL THEN LM.face
+                WHEN LM.face IS NULL THEN (SELECT avatar FROM li_admin_user WHERE id = LV.author_id)
+                ELSE ''
+            END as authorAvatar
+        FROM
+            lmk_video LV
+                INNER JOIN lmk_video_goods LVG ON LVG.video_id = LV.id AND LVG.goods_id in <foreach collection="query.goodsIds" open="(" item="goodsId" close=")" separator=",">#{goodsId}</foreach>
+                LEFT JOIN li_member LM ON LV.author_id = LM.id
+        WHERE
+            LV.delete_flag = 0 AND LV.status = '1' AND LV.id != #{query.currentVideoId}
+        ORDER BY
+            LV.create_time DESC
+    </select>
+
+    <select id="getHistoryPage" resultMap="HistoryMap">
+        SELECT
+            LV.author_id,
+            LV.cover_url,
+            LV.video_fit,
+            LV.video_duration,
+            LV.video_file_key,
+            LV.title,
+            LV.goods_view_num,
+            LV.goods_order_num,
+            LV.recommend,
+            LV.status,
+            LV.play_num,
+            LV.comment_num,
+            LV.collect_num,
+            LV.thumbs_up_num,
+            LV.weight,
+            LV.audit_pass_time,
+            LV.update_time,
+            LV.create_time,
+            LV.video_content_type,
+            LV.video_type,
+            LV.video_imgs,
+            LV.id,
+            CASE
+                WHEN LM.nick_name IS NOT NULL THEN LM.nick_name
+                WHEN LM.nick_name IS NULL THEN (SELECT nick_name FROM li_admin_user WHERE id = LV.author_id)
+                ELSE ''
+            END as authorName,
+            CASE
+                WHEN LM.face IS NOT NULL THEN LM.face
+                WHEN LM.face IS NULL THEN (SELECT avatar FROM li_admin_user WHERE id = LV.author_id)
+                ELSE ''
+            END as authorAvatar,
+            LFP.id as historyId,
+            LFP.play_at,
+            LFP.update_time as playTime
+        FROM
+            li_foot_print LFP
+                INNER JOIN lmk_video LV ON LFP.ref_id = LV.id AND LFP.view_type = 'video' AND LFP.delete_flag = 0 AND LFP.member_id = #{query.userId}
+                LEFT JOIN li_member LM ON LV.author_id = LM.id
+        WHERE
+            LV.delete_flag = 0 AND LV.status = '1'
+        ORDER BY
+            LFP.update_time DESC
+    </select>
+
     <select id="recommendHealthVideo" resultMap="WxResultMap">
         SELECT
             LV.author_id,
@@ -246,6 +442,7 @@
             LV.play_num,
             LV.comment_num,
             LV.collect_num,
+            LV.thumbs_up_num,
             LV.weight,
             LV.audit_pass_time,
             LV.update_time,
@@ -278,6 +475,7 @@
             LV.play_num,
             LV.comment_num,
             LV.collect_num,
+            LV.thumbs_up_num,
             LV.weight,
             LV.audit_pass_time,
             LV.update_time,
@@ -321,6 +519,20 @@
             WHEN #{video.id} THEN #{video.countNum}
         </foreach>
         ELSE comment_num
+        END
+        WHERE id IN
+        <foreach collection="list" item="video" open="(" separator="," close=")">
+            #{video.id}
+        </foreach>
+    </update>
+
+    <update id="updateThumbsUpNumBatch">
+        UPDATE lmk_video
+        SET thumbs_up_num = CASE id
+        <foreach collection="list" item="video">
+            WHEN #{video.id} THEN #{video.countNum}
+        </foreach>
+        ELSE thumbs_up_num
         END
         WHERE id IN
         <foreach collection="list" item="video" open="(" separator="," close=")">
@@ -373,6 +585,7 @@
             LV.play_num,
             LV.comment_num,
             LV.collect_num,
+            LV.thumbs_up_num,
             LV.weight,
             LV.audit_pass_time,
             LV.update_time,
@@ -411,6 +624,7 @@
             LV.play_num,
             LV.comment_num,
             LV.collect_num,
+            LV.thumbs_up_num,
             LV.weight,
             LV.audit_pass_time,
             LV.update_time,
@@ -426,6 +640,41 @@
                 LEFT JOIN li_member LM ON LV.author_id = LM.id
         WHERE
             LMC.delete_flag = 0 AND LMC.user_id = #{query.authorId} AND LMC.collect_type = 'video' AND LV.video_type = #{query.videoType}
+        ORDER BY
+            LMC.create_time DESC
+    </select>
+
+    <select id="getAuthorLikeVideoPage" resultMap="WxResultMap">
+        SELECT
+            LV.author_id,
+            LV.cover_url,
+            LV.video_fit,
+            LV.video_duration,
+            LV.video_file_key,
+            LV.title,
+            LV.goods_view_num,
+            LV.goods_order_num,
+            LV.recommend,
+            LV.status,
+            LV.play_num,
+            LV.comment_num,
+            LV.collect_num,
+            LV.thumbs_up_num,
+            LV.weight,
+            LV.audit_pass_time,
+            LV.update_time,
+            LV.video_content_type,
+            LV.video_type,
+            LV.video_imgs,
+            LV.id,
+            LM.nick_name as authorName,
+            LM.face as authorAvatar
+        FROM
+            lmk_thumbs_up_record LMC
+                INNER JOIN lmk_video LV ON LMC.ref_id = LV.id AND LV.delete_flag = 0 AND LV.status = '1'
+                LEFT JOIN li_member LM ON LV.author_id = LM.id
+        WHERE
+            LMC.delete_flag = 0 AND LMC.user_id = #{query.authorId} AND LMC.thumbs_up_type = 'video' AND LV.video_type = #{query.videoType}
         ORDER BY
             LMC.create_time DESC
     </select>
@@ -474,6 +723,7 @@
         LV.play_num,
         LV.collect_num,
         LV.comment_num,
+        LV.thumbs_up_num,
         LV.weight,
         LV.audit_pass_time,
         LV.update_time,
@@ -515,6 +765,7 @@
         LV.play_num,
         LV.collect_num,
         LV.comment_num,
+        LV.thumbs_up_num,
         LV.weight,
         LV.audit_pass_time,
         LV.update_time,
@@ -540,4 +791,187 @@
         <if test="query.authorId != null and query.authorId != ''">AND LV.author_id = #{query.authorId}</if>
         <if test="query.status != null and query.status != ''">AND LV.status = #{query.status}</if>
     </select>
+
+
+    <resultMap id="videoFootMap" type="cn.lili.modules.lmk.domain.vo.VideoFootVO">
+        <id column="id" property="id"/>
+        <result column="author_id" property="authorId" />
+        <result column="authorName" property="authorName" />
+        <result column="cover_url" property="coverUrl" />
+        <result column="video_file_key" property="videoFileKey" />
+        <result column="video_fit" property="videoFit" />
+        <result column="title" property="title" />
+        <result column="video_duration" property="videoDuration" />
+        <result column="recommend" property="recommend" />
+        <result column="status" property="status" />
+        <result column="play_num" property="playNum" />
+        <result column="collect_num" property="collectNum" />
+        <result column="comment_num" property="commentNum" />
+        <result column="weight" property="weight" />
+        <result column="audit_pass_time" property="auditPassTime" />
+        <result column="update_time" property="updateTime" />
+        <result column="video_content_type" property="videoContentType" />
+        <result column="video_type" property="videoType" />
+        <result column="video_imgs" property="videoImgs" />
+        <result column="view_duration" property="viewDuration"/>
+        <result column="play_at" property="playAt"/>
+
+        <collection property="goodsList" column="id" select="getVideoGoods" ofType="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO"/>
+        <collection property="tagList" column="id" select="getVideoTags" ofType="cn.lili.modules.lmk.domain.vo.SimpleVideoTagVO"/>
+
+    </resultMap>
+
+    <select id="videoFootPage" resultMap="videoFootMap">
+        SELECT
+            LFP.view_duration,
+            LFP.play_at,
+            LV.*
+        from
+            li_foot_print LFP
+                INNER JOIN lmk_video LV
+                          ON LFP.ref_id = lV.id AND LV.delete_flag = 0
+        where LFP.member_id = #{query.memberId}
+          AND LFP.ref_id IS NOT NULL
+          AND LFP.delete_flag = 0
+
+          AND LFP.view_type = 'video'
+    </select>
+    <select id="videoFoot" resultMap="videoFootMap">
+        SELECT
+            LFP.view_duration,
+            LFP.play_at,
+            LV.*
+        from
+            li_foot_print LFP
+                INNER JOIN lmk_video LV
+                           ON LFP.ref_id = lV.id AND LV.delete_flag = 0
+        where LFP.member_id = #{query.memberId}
+          AND LFP.ref_id IS NOT NULL
+          AND LFP.delete_flag = 0
+
+          AND LFP.view_type = 'video'
+    </select>
+
+    <resultMap id="videoFootInfo" type="cn.lili.modules.lmk.domain.vo.VideoFootInfoVo">
+        <result column="total_duration" property="totalDuration"/>
+        <result column="video_count" property="videoCount"/>
+        <result column="avg_completion_rate" property="avgCompletionRate"/>
+    </resultMap>
+
+    <resultMap id="videoTagMap" type="cn.lili.modules.lmk.domain.vo.SimpleVideoTagVO">
+        <id property="id" column="id"/>
+        <result property="tagName" column="tag_name"/>
+
+    </resultMap>
+
+<!--    <select id="getVideoTags" parameterType="String" resultMap="videoTagMap">-->
+<!--        SELECT LVT.id,-->
+<!--               LVT.tag_name-->
+<!--        from lmk_video_tag_ref LVTR-->
+<!--                 LEFT JOIN lmk_video_tag LVT ON LVT.id = LVTR.video_tag_id  and LVT.delete_flag = 0-->
+<!--        WHERE LVTR.video_id = #{id}-->
+
+<!--    </select>-->
+
+    <select id="getVideoFootInfo" resultMap="videoFootInfo">
+        SELECT
+            SUM(LFP.view_duration) AS total_duration,
+            ROUND(AVG(CASE
+                          WHEN LV.video_duration > 0 THEN LFP.play_at / LV.video_duration
+                          ELSE 0
+                END),2) AS avg_completion_rate,
+            COUNT(*) AS video_count
+        from
+            li_foot_print LFP
+                INNER JOIN lmk_video LV
+                          ON LFP.ref_id = lV.id AND LV.delete_flag = 0
+        where LFP.member_id = #{id}
+          AND LFP.ref_id IS NOT NULL
+          AND LFP.delete_flag = 0
+          AND LFP.view_type = 'video'
+          AND LV.id IS NOT NULL
+        GROUP BY
+            LFP.member_id
+    </select>
+
+
+    <resultMap id="EsResultMap" type="cn.lili.modules.lmk.domain.es.VideoIndex">
+        <id column="id" property="id"/>
+        <result column="author_id" property="authorId" />
+        <result column="authorName" property="authorName" />
+        <result column="authorAvatar" property="authorAvatar" />
+        <result column="cover_url" property="coverFileKey" />
+        <result column="video_file_key" property="videoFileKey" />
+        <result column="video_fit" property="videoFit" />
+        <result column="video_duration" property="videoDuration" />
+        <result column="title" property="title" />
+        <result column="status" property="status" />
+        <result column="recommend" property="recommend" />
+        <result column="audit_pass_time" property="publishTime" />
+        <result column="video_content_type" property="videoContentType" />
+        <result column="video_type" property="videoType" />
+        <result column="video_imgs" property="videoImgs" />
+        <result column="collect_num" property="collectNum" />
+        <result column="thumbs_up_num" property="thumbsUpNum" />
+        <result column="comment_num" property="commentNum" />
+        <collection property="goodsList" column="id" select="getVideoGoods" ofType="cn.lili.modules.lmk.domain.vo.VideoGoodsDetailVO"/>
+        <collection property="tagList" column="id" select="getVideoTags" ofType="cn.lili.modules.lmk.domain.vo.SimpleVideoTagVO"/>
+    </resultMap>
+
+    <select id="getVideoTags" resultType="cn.lili.modules.lmk.domain.vo.SimpleVideoTagVO">
+        SELECT
+               LVT.id,
+               LVT.tag_name as tagName
+        FROM
+             lmk_video_tag_ref LVTR
+                 INNER JOIN lmk_video_tag LVT ON LVTR.video_tag_id = LVT.id AND LVT.delete_flag = 0
+        WHERE
+             LVTR.video_id = #{id}
+    </select>
+
+    <select id="getEsPage" parameterType="int" resultMap="EsResultMap">
+        SELECT
+            LV.author_id,
+            LV.cover_url,
+            LV.video_fit,
+            LV.video_duration,
+            LV.video_file_key,
+            LV.title,
+            LV.goods_view_num,
+            LV.goods_order_num,
+            LV.recommend,
+            LV.status,
+            LV.play_num,
+            LV.comment_num,
+            LV.collect_num,
+            LV.thumbs_up_num,
+            LV.weight,
+            CASE
+                WHEN LV.audit_pass_time IS NOT NULL THEN LV.audit_pass_time
+                ELSE LV.create_time
+            END as audit_pass_time,
+            LV.update_time,
+            LV.create_time,
+            LV.video_content_type,
+            LV.video_type,
+            LV.video_imgs,
+            LV.id,
+            CASE
+                WHEN LM.nick_name IS NOT NULL THEN LM.nick_name
+                WHEN LM.nick_name IS NULL THEN (SELECT nick_name FROM li_admin_user WHERE id = LV.author_id)
+                ELSE ''
+            END as authorName,
+            CASE
+                WHEN LM.face IS NOT NULL THEN LM.face
+                WHEN LM.face IS NULL THEN (SELECT avatar FROM li_admin_user WHERE id = LV.author_id)
+                ELSE ''
+                END as authorAvatar
+        FROM
+            lmk_video LV
+                LEFT JOIN li_member LM ON LV.author_id = LM.id
+        WHERE
+            LV.delete_flag = 0
+        LIMIT #{start}, #{pageSize}
+    </select>
+
 </mapper>

--
Gitblit v1.8.0