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/VideoMapper.xml |  244 +++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 229 insertions(+), 15 deletions(-)

diff --git a/framework/src/main/resources/mapper/lmk/VideoMapper.xml b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
index 77fe601..6014df8 100644
--- a/framework/src/main/resources/mapper/lmk/VideoMapper.xml
+++ b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
@@ -230,10 +230,118 @@
             <if test="query.title != null and query.title != ''">AND LV.title LIKE CONCAT('%', #{query.title}, '%')</if>
             <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>
+        order by LV.create_time DESC
     </select>
 
-
+<!-- todo 澶囦唤鍘熸湁鐨勫け鍘讳簡鏂囦欢-->
+<!--    <select id="recommendVideo" 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="recommendVideo" 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}
+          AND LM.id IS NOT NULL
+        UNION ALL
+        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.avatar AS authorAvatar
+        FROM
+            lmk_video LV
+                LEFT JOIN li_admin_user LM ON LV.author_id = LM.id
+        WHERE
+            LV.delete_flag = 0
+          AND LV.STATUS = '1'
+          AND LV.video_type = #{query.videoType}
+          AND LM.id IS NOT NULL
+        ORDER BY
+            recommend DESC,
+            weight DESC,
+            create_time DESC
+    </select>
+    <select id="recommendVideoByVideoId" resultMap="WxResultMap">
         SELECT
             LV.author_id,
             LV.cover_url,
@@ -261,9 +369,9 @@
             LM.face as authorAvatar
         FROM
             lmk_video LV
-            LEFT JOIN li_member LM ON LV.author_id = LM.id
+                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}
+            LV.delete_flag = 0 AND LV.status = '1' AND LV.id = #{query.videoId}
         ORDER BY
             LV.create_time DESC
     </select>
@@ -526,6 +634,25 @@
         WHERE
               LM.id = #{authorId} AND LM.delete_flag = 0
     </select>
+    <select id="getAuthorInfoAdmin" resultType="cn.lili.modules.lmk.domain.vo.VideoAccountVO">
+        SELECT
+               LM.id as userId,
+               LM.nick_name as nickName,
+               LM.avatar as avatar,
+               LVA.motto,
+               (SELECT COUNT(*) FROM lmk_my_subscribe WHERE subscribe_user_id = #{authorId} AND delete_flag = 0) as fansNum,
+               (SELECT COUNT(*) FROM lmk_my_subscribe WHERE user_id = #{authorId} AND delete_flag = 0) as subNum,
+               (SELECT CASE
+                           WHEN id IS NOT NULL THEN 1
+                           ELSE 0
+                           END
+               FROM lmk_my_subscribe WHERE user_id = #{currentUserId} AND subscribe_user_id = #{authorId} AND delete_flag = 0) as hasSub
+        FROM
+            li_admin_user LM
+                 LEFT JOIN lmk_video_account LVA ON LM.id = LVA.user_id
+        WHERE
+              LM.id = #{authorId} AND LM.delete_flag = 0
+    </select>
 
     <select id="getVideoIdsByAuthor" parameterType="string" resultType="string">
         SELECT id FROM lmk_video WHERE author_id = #{authorId} AND delete_flag = 0 AND status = '1'
@@ -536,8 +663,46 @@
             collection="videoIds" open="(" close=")" separator="," item="videoId">#{videoId}</foreach>
     </select>
 
+<!--    <select id="getAuthorVideoPage" 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_video LV-->
+<!--                LEFT JOIN li_member LM ON LV.author_id = LM.id-->
+<!--        WHERE-->
+<!--            LV.delete_flag = 0-->
+<!--            <if test="!query.authorSelf">-->
+<!--                AND LV.status = '1'-->
+<!--            </if>-->
+<!--            AND LV.author_id = #{query.authorId}-->
+<!--            AND LV.video_type = #{query.videoType}-->
+<!--        ORDER BY-->
+<!--            LV.collect_num DESC-->
+<!--    </select>-->
     <select id="getAuthorVideoPage" resultMap="WxResultMap">
-        SELECT
+      select  * from (SELECT
             LV.author_id,
             LV.cover_url,
             LV.video_fit,
@@ -547,7 +712,7 @@
             LV.goods_view_num,
             LV.goods_order_num,
             LV.recommend,
-            LV.status,
+            LV.STATUS,
             LV.play_num,
             LV.comment_num,
             LV.collect_num,
@@ -559,20 +724,57 @@
             LV.video_type,
             LV.video_imgs,
             LV.id,
-            LM.nick_name as authorName,
-            LM.face as authorAvatar
+            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
-            <if test="!query.authorSelf">
-                AND LV.status = '1'
-            </if>
-            AND LV.author_id = #{query.authorId}
-            AND LV.video_type = #{query.videoType}
+        LV.delete_flag = 0
+        <if test="!query.authorSelf">
+            AND LV.status = '1'
+        </if>
+        AND LV.author_id = #{query.authorId}
+        AND LV.video_type = #{query.videoType}
+        and lm.id IS NOT NULL
+        UNION ALL
+        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.avatar AS authorAvatar
+        FROM
+            lmk_video LV
+                LEFT JOIN li_admin_user LM ON LV.author_id = LM.id
+        WHERE
+        LV.delete_flag = 0
+        <if test="!query.authorSelf">
+            AND LV.status = '1'
+        </if>
+        AND LV.author_id = #{query.authorId}
+        AND LV.video_type = #{query.videoType}
+        and   lm.id IS NOT NULL) t
         ORDER BY
-            LV.collect_num DESC
+        t.collect_num DESC
     </select>
 
     <select id="getAuthorCollectVideoPage" resultMap="WxResultMap">
@@ -939,5 +1141,17 @@
             LV.delete_flag = 0
         LIMIT #{start}, #{pageSize}
     </select>
-
+    <resultMap id="videoUserBaseInfoMap" type="cn.lili.modules.lmk.domain.vo.VideoUserBaseInfo">
+    <result property="avatar" column="avatar"/>
+    <result property="nickName" column="nick_name"/>
+    </resultMap>
+    <select id="getVideoSysUserBaseInfo" resultMap="videoUserBaseInfoMap">
+        SELECT nick_name ,avatar FROM li_admin_user
+        WHERE id = #{id}
+    </select>
+    <select id="getVideoMemUserBaseInfo" resultMap="videoUserBaseInfoMap">
+        SELECT nick_name, face AS avatar
+        FROM li_member
+        WHERE id = #{id}
+    </select>
 </mapper>

--
Gitblit v1.8.0