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 | 448 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 435 insertions(+), 13 deletions(-)
diff --git a/framework/src/main/resources/mapper/lmk/VideoMapper.xml b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
index ad42fbd..6014df8 100644
--- a/framework/src/main/resources/mapper/lmk/VideoMapper.xml
+++ b/framework/src/main/resources/mapper/lmk/VideoMapper.xml
@@ -27,6 +27,7 @@
<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"/>
@@ -101,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
@@ -206,10 +230,152 @@
<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,
+ 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,
@@ -286,6 +452,53 @@
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">
@@ -421,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'
@@ -431,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,
@@ -442,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,
@@ -454,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">
@@ -653,6 +960,109 @@
<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" />
@@ -731,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