From b305b6ce82fbb975acf42af3ad450aa4c7699d5e Mon Sep 17 00:00:00 2001 From: zxl <763096477@qq.com> Date: 星期四, 26 六月 2025 14:35:46 +0800 Subject: [PATCH] 客户分析,和浏览视频记录 --- framework/src/main/resources/mapper/lmk/VideoMapper.xml | 106 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 files changed, 106 insertions(+), 0 deletions(-) diff --git a/framework/src/main/resources/mapper/lmk/VideoMapper.xml b/framework/src/main/resources/mapper/lmk/VideoMapper.xml index 248411a..26809d9 100644 --- a/framework/src/main/resources/mapper/lmk/VideoMapper.xml +++ b/framework/src/main/resources/mapper/lmk/VideoMapper.xml @@ -26,6 +26,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"/> @@ -545,4 +546,109 @@ <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> + </mapper> -- Gitblit v1.8.0