<?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.BusSupplierReleaseDayMapper">

    <resultMap type="BusSupplierReleaseDay" id="BusSupplierReleaseDayResult">
        <result property="id"    column="id"    />
        <result property="uuid"    column="uuid"    />
        <result property="planDate"    column="plan_date"    />
        <result property="content"    column="content"    />
        <result property="dateTime"    column="date_time"    />
        <result property="dayNum"    column="day_num"    />
        <result property="offerName"    column="offer_name"    />
    </resultMap>

    <sql id="selectBusSupplierReleaseDayVo">
        select a.id, a.uuid, a.plan_date, a.content, a.date_time, a.day_num, b.offer_name
        from bus_supplier_release_day a inner join bus_supplier_release b on a.uuid = b.uuid
    </sql>

    <select id="selectBusSupplierReleaseDayList" parameterType="BusSupplierReleaseDay" resultMap="BusSupplierReleaseDayResult">
        <include refid="selectBusSupplierReleaseDayVo"/>
        <where>
            <if test="uuid != null  and uuid != ''"> and a.uuid = #{uuid}</if>
            <if test="planDate != null  and planDate != ''"> and plan_date = #{planDate}</if>
            <if test="content != null  and content != ''"> and content = #{content}</if>
            <if test="dateTime != null  and dateTime != ''"> and date_time = #{dateTime}</if>
            <if test="dayNum != null  and dayNum != ''"> and day_num = #{dayNum}</if>
        </where>
    </select>

    <select id="selectBusSupplierReleaseDayById" parameterType="Long" resultMap="BusSupplierReleaseDayResult">
        <include refid="selectBusSupplierReleaseDayVo"/>
        where a.id = #{id}
    </select>

    <insert id="insertBusSupplierReleaseDay" parameterType="BusSupplierReleaseDay">
        insert into bus_supplier_release_day
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="uuid != null">uuid,</if>
            <if test="planDate != null">plan_date,</if>
            <if test="content != null">content,</if>
            <if test="dateTime != null">date_time,</if>
            <if test="dayNum != null">day_num,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="uuid != null">#{uuid},</if>
            <if test="planDate != null">#{planDate},</if>
            <if test="content != null">#{content},</if>
            <if test="dateTime != null">#{dateTime},</if>
            <if test="dayNum != null">#{dayNum},</if>
         </trim>
    </insert>

    <update id="updateBusSupplierReleaseDay" parameterType="BusSupplierReleaseDay">
        update bus_supplier_release_day
        <trim prefix="SET" suffixOverrides=",">
            <if test="uuid != null">uuid = #{uuid},</if>
            <if test="planDate != null">plan_date = #{planDate},</if>
            <if test="content != null">content = #{content},</if>
            <if test="dateTime != null">date_time = #{dateTime},</if>
            <if test="dayNum != null">day_num = #{dayNum},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBusSupplierReleaseDayById" parameterType="Long">
        delete from bus_supplier_release_day where id = #{id}
    </delete>

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