xiangpei
2025-05-22 a66f503d098a6b1b56e42e6e455bd00f88bcc32c
framework/src/main/resources/mapper/lmk/VideoMapper.xml
@@ -6,6 +6,7 @@
    <resultMap id="BaseResultMap" type="cn.lili.modules.lmk.domain.vo.VideoVO">
        <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" />
@@ -20,12 +21,22 @@
        <result column="comment_num" property="commentNum" />
        <result column="weight" property="weight" />
        <result column="audit_pass_time" property="auditPassTime" />
        <result column="update_time" property="updateTime" />
    </resultMap>
    <!-- 微信推荐视频 -->
    <resultMap id="WxResultMap" type="cn.lili.modules.lmk.domain.vo.WxVideoVO">
        <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="coverUrl" />
        <result column="video_file_key" property="videoFileKey" />
        <result column="video_fit" property="videoFit" />
        <result column="title" property="title" />
        <result column="collect_num" property="collectNum" />
        <result column="comment_num" property="commentNum" />
    </resultMap>
    <select id="getById" resultMap="BaseResultMap">
@@ -45,9 +56,12 @@
            LV.comment_num,
            LV.weight,
            LV.audit_pass_time,
            LV.id
            LV.update_time,
            LV.id,
            LM.nick_name as authorName
        FROM
            lmk_video LV
                LEFT JOIN li_member LM ON LV.author_id = LM.id
        WHERE
            LV.id = #{id} AND LV.delete_flag = 0
    </select>
@@ -66,15 +80,86 @@
            LV.recommend,
            LV.status,
            LV.play_num,
            LV.collect_num,
            LV.comment_num,
            LV.weight,
            LV.audit_pass_time,
            LV.id
            LV.update_time,
            LV.id,
            LM.nick_name as authorName,
            (SELECT COUNT(*) FROM lmk_my_collect WHERE ref_id = LV.id AND collect_type = 'video' AND delete_flag = 0) as collect_num
        FROM
            lmk_video LV
                LEFT JOIN li_member LM ON LV.author_id = LM.id
        WHERE
            LV.delete_flag = 0
    </select>
    <select id="managerPage" resultMap="BaseResultMap">
        SELECT
            LV.author_id,
            LV.cover_url,
            LV.video_fit,
            LV.video_file_key,
            LV.title,
            LV.goods_id,
            LV.goods_view_num,
            LV.goods_order_num,
            LV.recommend,
            LV.status,
            LV.play_num,
            LV.comment_num,
            LV.weight,
            LV.audit_pass_time,
            LV.update_time,
            LV.id,
            LM.nick_name as authorName,
            (SELECT COUNT(*) FROM lmk_my_collect WHERE ref_id = LV.id AND collect_type = 'video' AND delete_flag = 0) as collect_num
        FROM
            lmk_video LV
                LEFT JOIN li_member LM ON LV.author_id = LM.id
            <if test="query.tagList != null and query.tagList.size > 0">
                INNER JOIN (
                SELECT DISTINCT video_id
                FROM lmk_video_tag_ref
                WHERE video_tag_id IN
                <foreach collection="query.tagList" open="(" item="tagId" close=")" separator=",">#{tagId}</foreach>
                ) AS LVT ON LV.id = LVT.video_id
            </if>
        WHERE
            LV.delete_flag = 0
            <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>
    </select>
    <select id="recommendVideo" resultMap="WxResultMap">
        SELECT
            LV.author_id,
            LV.cover_url,
            LV.video_fit,
            LV.video_file_key,
            LV.title,
            LV.goods_id,
            LV.goods_view_num,
            LV.goods_order_num,
            LV.recommend,
            LV.status,
            LV.play_num,
            LV.comment_num,
            LV.weight,
            LV.audit_pass_time,
            LV.update_time,
            LV.id,
            LM.nick_name as authorName,
            LM.face as authorAvatar,
            (SELECT COUNT(*) FROM lmk_my_collect WHERE ref_id = LV.id AND collect_type = 'video' AND delete_flag = 0) as collect_num
        FROM
            lmk_video LV
            LEFT JOIN li_member LM ON LV.author_id = LM.id
        WHERE
            LV.delete_flag = 0 AND LV.status = '1'
    </select>
</mapper>