Helius
2021-12-16 d22f5bdfdaa8502a5f2496248da932b3c50c1fd0
src/main/resources/mapper/video/VideoMasterInfoMapper.xml
@@ -3,6 +3,48 @@
<mapper namespace="cc.mrbird.febs.video.mapper.VideoMasterInfoMapper">
    <select id="selectInPage" resultType="cc.mrbird.febs.video.entity.VideoMasterInfoEntity">
        select
            a.*,
            count(b.id) itemCnt,
            c.play_cnt,
            c.collect_cnt,
            c.star_cnt
        from video_master_info a, video_master_items b, video_master_data c
        where a.id=b.master_id and a.id=c.master_id
        <if test="record.title != null and record.title != ''">
            and a.title like concat('%', #{record.title}, '%')
        </if>
        group by a.id
    </select>
    <resultMap id="videoMasterInfoMap" type="cc.mrbird.febs.video.entity.VideoMasterInfoEntity">
        <id property="id" column="id" />
        <result property="cateIds" column="cate_ids" />
        <result property="code" column="code" />
        <result property="title" column="title" />
        <result property="isFree" column="is_free" />
        <result property="isUp" column="is_up" />
        <result property="intro" column="intro" />
        <result property="thumb" column="thumb" />
        <collection property="items" ofType="cc.mrbird.febs.video.entity.VideoMasterItemsEntity" >
            <id property="id" column="item_id" />
            <result property="name" column="name" />
            <result property="thumb" column="item_thumb" />
            <result property="sourceId" column="source_id" />
            <result property="sourceName" column="sourceName" />
        </collection>
    </resultMap>
    <select id="selectEntityById" resultMap="videoMasterInfoMap">
        select
            a.*,
            b.id item_id,
            b.name,
            b.thumb item_thumb,
            b.source_id,
            c.name sourceName
        from video_master_info a, video_master_items b, video_master_source c
        where a.id=b.master_id and a.id=#{id} and b.source_id=c.id
    </select>
</mapper>