zxl
4 小时以前 e2e015e02fb67ef7c348fbcb2152a34ccb34004d
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"/>
@@ -233,6 +234,40 @@
    <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="recommendVideoList" resultMap="WxResultMap">
        SELECT
            LV.author_id,
            LV.cover_url,
@@ -723,6 +758,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" />