<?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.ruoyi.tuya.mapper.BusSupplierReleasePlayMapper">

    <resultMap type="BusSupplierReleasePlay" id="BusSupplierReleasePlayResult">
        <result property="id"    column="id"    />
        <result property="uuid"    column="uuid"    />
        <result property="typeVal"    column="type_val"    />
        <result property="content"    column="content"    />
        <result property="imgUrl"    column="img_url"    />
        <result property="videoUrl"    column="video_url"    />
        <result property="name"    column="name"    />
        <result property="dayNum"    column="day_num"    />
        <result property="updateContent"    column="update_content"    />
    </resultMap>

    <sql id="selectBusSupplierReleasePlayVo">
        select a.id, a.uuid, a.type_val, a.content, a.img_url, a.video_url, a.name, a.day_num, a.update_content
        from bus_supplier_release_play a inner join bus_supplier_release b on a.uuid = b.uuid
    </sql>

    <select id="selectBusSupplierReleasePlayList" parameterType="BusSupplierReleasePlay" resultMap="BusSupplierReleasePlayResult">
        <include refid="selectBusSupplierReleasePlayVo"/>
        <where>
            <if test="uuid != null  and uuid != ''"> and a.uuid = #{uuid}</if>
            <if test="typeVal != null  and typeVal != ''"> and a.type_val = #{typeVal}</if>
            <if test="content != null  and content != ''"> and a.content like concat('%', #{content}, '%')</if>
            <if test="imgUrl != null  and imgUrl != ''"> and a.img_url = #{imgUrl}</if>
            <if test="videoUrl != null  and videoUrl != ''"> and a.video_url = #{videoUrl}</if>
            <if test="name != null  and name != ''"> and a.name like concat('%', #{name}, '%')</if>
            <if test="dayNum != null  and dayNum != ''"> and a.day_num = #{dayNum}</if>
            <if test="updateContent != null  and updateContent != ''"> and a.update_content like concat('%', #{updateContent}, '%')</if>
        </where>
    </select>

    <select id="selectBusSupplierReleasePlayById" parameterType="Long" resultMap="BusSupplierReleasePlayResult">
        <include refid="selectBusSupplierReleasePlayVo"/>
        where a.id = #{id}
    </select>

    <insert id="insertBusSupplierReleasePlay" parameterType="BusSupplierReleasePlay">
        insert into bus_supplier_release_play
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="uuid != null">uuid,</if>
            <if test="typeVal != null">type_val,</if>
            <if test="content != null">content,</if>
            <if test="imgUrl != null">img_url,</if>
            <if test="videoUrl != null">video_url,</if>
            <if test="name != null">name,</if>
            <if test="dayNum != null">day_num,</if>
            <if test="updateContent != null">update_content,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="uuid != null">#{uuid},</if>
            <if test="typeVal != null">#{typeVal},</if>
            <if test="content != null">#{content},</if>
            <if test="imgUrl != null">#{imgUrl},</if>
            <if test="videoUrl != null">#{videoUrl},</if>
            <if test="name != null">#{name},</if>
            <if test="dayNum != null">#{dayNum},</if>
            <if test="updateContent != null">#{updateContent},</if>
         </trim>
    </insert>

    <update id="updateBusSupplierReleasePlay" parameterType="BusSupplierReleasePlay">
        update bus_supplier_release_play
        <trim prefix="SET" suffixOverrides=",">
            <if test="uuid != null">uuid = #{uuid},</if>
            <if test="typeVal != null">type_val = #{typeVal},</if>
            <if test="content != null">content = #{content},</if>
            <if test="imgUrl != null">img_url = #{imgUrl},</if>
            <if test="videoUrl != null">video_url = #{videoUrl},</if>
            <if test="name != null">name = #{name},</if>
            <if test="dayNum != null">day_num = #{dayNum},</if>
            <if test="updateContent != null">update_content = #{updateContent},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBusSupplierReleasePlayById" parameterType="Long">
        delete from bus_supplier_release_play where id = #{id}
    </delete>

    <delete id="deleteBusSupplierReleasePlayByIds" parameterType="String">
        delete from bus_supplier_release_play where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
