<?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="cn.iocoder.yudao.module.jx.payment.mapper.DriveSchoolBookingMapper">

    <resultMap type="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolBooking" id="DriveSchoolBookingResult">
        <result property="id"    column="id"    />
        <result property="jlId"    column="jlId"    />
        <result property="jxId"    column="jxId"    />
        <result property="isMorning"    column="isMorning"    />
        <result property="bookingTime"    column="bookingTime"    />
    </resultMap>

    <sql id="selectDriveSchoolBookingVo">
        select id, jlId, jxId, isMorning, bookingTime from drive_school_booking
    </sql>

    <select id="selectDriveSchoolBookingList" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolBooking" resultMap="DriveSchoolBookingResult">
        <include refid="selectDriveSchoolBookingVo"/>
        <where>
            deleted = 0
            <if test="entity.jlId != null "> and jlId = #{entity.jlId}</if>
            <if test="entity.jxId != null "> and jxId = #{entity.jxId}</if>
            <if test="entity.isMorning != null "> and isMorning = #{entity.isMorning}</if>
            <if test="entity.bookingTime != null "> and bookingTime = #{entity.bookingTime}</if>
        </where>
    </select>

    <select id="selectDriveSchoolBookingById" parameterType="Long" resultMap="DriveSchoolBookingResult">
        <include refid="selectDriveSchoolBookingVo"/>
        where id = #{id}
    </select>

    <insert id="insertDriveSchoolBooking" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolBooking">
        insert into drive_school_booking
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="jlId != null">jlId,</if>
            <if test="jxId != null">jxId,</if>
            <if test="isMorning != null">isMorning,</if>
            <if test="bookingTime != null">bookingTime,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="jlId != null">#{jlId},</if>
            <if test="jxId != null">#{jxId},</if>
            <if test="isMorning != null">#{isMorning},</if>
            <if test="bookingTime != null">#{bookingTime},</if>
        </trim>
    </insert>

    <update id="updateDriveSchoolBooking" parameterType="cn.iocoder.yudao.module.jx.payment.entity.DriveSchoolBooking">
        update drive_school_booking
        <trim prefix="SET" suffixOverrides=",">
            <if test="jlId != null">jlId = #{jlId},</if>
            <if test="jxId != null">jxId = #{jxId},</if>
            <if test="isMorning != null">isMorning = #{isMorning},</if>
            <if test="bookingTime != null">bookingTime = #{bookingTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteDriveSchoolBookingById" parameterType="Long">
        delete from drive_school_booking where id = #{id}
    </delete>

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