Blame view

LiveDictMapper.xml 2.64 KB
涂亚平 committed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.subsidy.mapper.LiveDictMapper">

    <!-- 通用查询映射结果 -->
    <resultMap id="BaseResultMap" type="com.subsidy.model.LiveDictDO">
        <id column="id" property="id" />
        <result column="create_date" property="createDate" />
        <result column="update_date" property="updateDate" />
        <result column="delete_date" property="deleteDate" />
        <result column="channel" property="channel" />
        <result column="live_name" property="liveName" />
        <result column="start_time" property="startTime" />
        <result column="playback_status" property="playbackStatus" />
        <result column="live_status" property="liveStatus" />
    </resultMap>

    <!-- 通用查询结果列 -->
    <sql id="Base_Column_List">
        create_date,
        update_date,
        delete_date,
        id, channel, live_name, start_time, playback_status, live_status
    </sql>

    <select id="allLives" resultType="com.subsidy.vo.live.AllLivesVO">
        SELECT
            distinct t.id,
            t.channel,
            t.live_name,
            t.start_time,
            t.live_status
        FROM
            live_dict t
            LEFT JOIN live_classes t2 ON t.id = t2.live_id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            <if test="liveName != null and liveName != ''">
                and t.live_name like concat('%',#{liveName} ,'%')
            </if>
            <if test="liveStatus != null and liveStatus != ''">
                and t.live_status = #{liveStatus}
            </if>
            order by t.create_date desc
    </select>

    <select id="liveClasses" parameterType="long" resultType="com.subsidy.vo.live.LiveClassesVO">
        SELECT
            distinct t2.id,
            t2.class_name
        FROM
            live_classes t
            LEFT JOIN class_dict t2 ON t.class_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
            and t.live_id = #{liveId}
    </select>

    <select id="liveClassesIds" parameterType="long" resultType="long">
        SELECT
            t2.id
        FROM
            live_classes t
            LEFT JOIN class_dict t2 ON t.class_id = t2.id
        WHERE
            t.delete_date IS NULL
            AND t2.delete_date IS NULL
涂亚平 committed
70
            and t.live_id = #{liveId}
涂亚平 committed
71 72 73 74 75 76
    </select>

    <update id="updateStatus" parameterType="long">
        update live_dict set live_status = '已开始' where id = #{id}
    </update>
</mapper>