<?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.project.ticket.mapper.TDelayPermitOtherMapper">

    <resultMap type="TDelayPermitOther" id="TDelayPermitOtherResult">
        <result property="id" column="id"/>
        <result property="valiStartTime" column="start_time"/>
        <result property="valiEndTime" column="end_time"/>
        <result property="aGSign" column="a_g_sign"/>
        <result property="aGDate" column="a_g_date"/>
        <result property="aHSign" column="a_h_sign"/>
        <result property="aHDate" column="a_h_date"/>
        <result property="aI1aSign" column="a_i1a_sign"/>
        <result property="aI1aDate" column="a_i1a_date"/>
        <result property="aA4Sign" column="a_a4_sign"/>
        <result property="aA4Date" column="a_a4_date"/>
        <result property="aI1bSign" column="a_i1b_sign"/>
        <result property="aI1bDate" column="a_i1b_date"/>
        <result property="aKSign" column="a_k_sign"/>
        <result property="aKDate" column="a_k_date"/>
        <result property="aE3Sign" column="a_e3_sign"/>
        <result property="aE3Date" column="a_e3_date"/>
        <result property="hE3Sign" column="h_e3_sign"/>
        <result property="hE3Date" column="h_e3_date"/>
        <result property="h51Sign" column="h_51_sign"/>
        <result property="h51Date" column="h_51_date"/>
        <result property="h52Sign" column="h_52_sign"/>
        <result property="h52Date" column="h_52_date"/>
        <result property="cI2Sign1" column="c_i2_sign1"/>
        <result property="cI2Date1" column="c_i2_date1"/>
        <result property="cI2Sign2" column="c_i2_sign2"/>
        <result property="cI2Date2" column="c_i2_date2"/>
        <result property="aE3StartTime" column="A_E3_START_TIME"/>
        <result property="aE3EndTime" column="A_E3_END_TIME"/>
        <result property="hE3StartTime" column="H_E3_START_TIME"/>
        <result property="hE3EndTime" column="H_E3_END_TIME"/>
        <result property="cI2StartTime1" column="C_I2_START_TIME1"/>
        <result property="cI2EndTime1" column="C_I2_END_TIME1"/>
        <result property="cI2StartTime2" column="C_I2_START_TIME2"/>
        <result property="cI2EndTime2" column="C_I2_END_TIME2"/>
    </resultMap>

    <sql id="selectTDelayPermitOtherVo">
        select d.id,
               d.start_time,
               d.end_time,
               d.a_g_sign,
               d.a_g_date,
               d.a_h_sign,
               d.a_h_date,
               d.a_i1a_sign,
               d.a_i1a_date,
               d.a_a4_sign,
               d.a_a4_date,
               d.a_i1b_sign,
               d.a_i1b_date,
               d.a_k_sign,
               d.a_k_date,
               d.a_e3_sign,
               d.a_e3_date,
               d.h_e3_sign,
               d.h_e3_date,
               d.h_51_sign,
               d.h_51_date,
               d.h_52_sign,
               d.h_52_date,
               d.c_i2_sign1,
               d.c_i2_date1,
               d.c_i2_sign2,
               d.c_i2_date2,
               A_E3_START_TIME,
               A_E3_END_TIME,
               H_E3_START_TIME,
               H_E3_END_TIME,
               C_I2_START_TIME1,
               C_I2_END_TIME1,
               C_I2_START_TIME2,
               C_I2_END_TIME2
        from t_delay_permit_other d
    </sql>

    <select id="selectTDelayPermitOtherList" parameterType="TDelayPermitOther" resultMap="TDelayPermitOtherResult">
        <include refid="selectTDelayPermitOtherVo"/>
        <where>
            <if test="valiStartTime != null ">and start_time = #{valiStartTime}</if>
            <if test="valiEndTime != null ">and end_time = #{valiEndTime}</if>
            <if test="aGSign != null  and aGSign != ''">and a_g_sign = #{aGSign}</if>
            <if test="aGDate != null ">and a_g_date = #{aGDate}</if>
            <if test="aHSign != null  and aHSign != ''">and a_h_sign = #{aHSign}</if>
            <if test="aHDate != null ">and a_h_date = #{aHDate}</if>
            <if test="aI1aSign != null  and aI1aSign != ''">and a_i1a_sign = #{aI1aSign}</if>
            <if test="aI1aDate != null ">and a_i1a_date = #{aI1aDate}</if>
            <if test="aA4Sign != null  and aA4Sign != ''">and a_a4_sign = #{aA4Sign}</if>
            <if test="aA4Date != null ">and a_a4_date = #{aA4Date}</if>
            <if test="aI1bSign != null  and aI1bSign != ''">and a_i1b_sign = #{aI1bSign}</if>
            <if test="aI1bDate != null ">and a_i1b_date = #{aI1bDate}</if>
            <if test="aKSign != null  and aKSign != ''">and a_k_sign = #{aKSign}</if>
            <if test="aKDate != null ">and a_k_date = #{aKDate}</if>
            <if test="aE3Sign != null  and aE3Sign != ''">and a_e3_sign = #{aE3Sign}</if>
            <if test="aE3Date != null ">and a_e3_date = #{aE3Date}</if>
            <if test="hE3Sign != null  and hE3Sign != ''">and h_e3_sign = #{hE3Sign}</if>
            <if test="hE3Date != null ">and h_e3_date = #{hE3Date}</if>
            <if test="h51Sign != null  and h51Sign != ''">and h_51_sign = #{h51Sign}</if>
            <if test="h51Date != null ">and h_51_date = #{h51Date}</if>
            <if test="h52Sign != null  and h52Sign != ''">and h_52_sign = #{h52Sign}</if>
            <if test="h52Date != null ">and h_52_date = #{h52Date}</if>
            <if test="cI2Sign1 != null  and cI2Sign1 != ''">and c_i2_sign1 = #{cI2Sign1}</if>
            <if test="cI2Date1 != null ">and c_i2_date1 = #{cI2Date1}</if>
            <if test="cI2Sign2 != null  and cI2Sign2 != ''">and c_i2_sign2 = #{cI2Sign2}</if>
            <if test="cI2Date2 != null ">and c_i2_date2 = #{cI2Date2}</if>
        </where>
    </select>

    <select id="selectTDelayPermitOtherById" parameterType="Long" resultMap="TDelayPermitOtherResult">
        <include refid="selectTDelayPermitOtherVo"/>
        where id = #{id}
    </select>

    <select id="selectTDelayPermitOtherByIds" parameterType="Long" resultMap="TDelayPermitOtherResult">
        <include refid="selectTDelayPermitOtherVo"/>
        where id IN (SELECT OTHER_ID from T_DELAY_PERMIT WHERE V_ID = #{vId})
        order by id
    </select>

    <insert id="insertTDelayPermitOther" parameterType="TDelayPermitOther">
        <selectKey keyProperty="id" resultType="long" order="BEFORE">
            SELECT seq_t_delay_permit_other.NEXTVAL as id FROM DUAL
        </selectKey>
        insert into t_delay_permit_other
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="valiStartTime != null">start_time,</if>
            <if test="valiEndTime != null">end_time,</if>
            <if test="aGSign != null">a_g_sign,</if>
            <if test="aGDate != null">a_g_date,</if>
            <if test="aHSign != null">a_h_sign,</if>
            <if test="aHDate != null">a_h_date,</if>
            <if test="aI1aSign != null">a_i1a_sign,</if>
            <if test="aI1aDate != null">a_i1a_date,</if>
            <if test="aA4Sign != null">a_a4_sign,</if>
            <if test="aA4Date != null">a_a4_date,</if>
            <if test="aI1bSign != null">a_i1b_sign,</if>
            <if test="aI1bDate != null">a_i1b_date,</if>
            <if test="aKSign != null">a_k_sign,</if>
            <if test="aKDate != null">a_k_date,</if>
            <if test="aE3Sign != null">a_e3_sign,</if>
            <if test="aE3Date != null">a_e3_date,</if>
            <if test="hE3Sign != null">h_e3_sign,</if>
            <if test="hE3Date != null">h_e3_date,</if>
            <if test="h51Sign != null">h_51_sign,</if>
            <if test="h51Date != null">h_51_date,</if>
            <if test="h52Sign != null">h_52_sign,</if>
            <if test="h52Date != null">h_52_date,</if>
            <if test="cI2Sign1 != null">c_i2_sign1,</if>
            <if test="cI2Date1 != null">c_i2_date1,</if>
            <if test="cI2Sign2 != null">c_i2_sign2,</if>
            <if test="cI2Date2 != null">c_i2_date2,</if>
            <if test="aE3StartTime != null">A_E3_START_TIME,</if>
            <if test="aE3EndTime != null">A_E3_END_TIME,</if>
            <if test="hE3StartTime != null">H_E3_START_TIME,</if>
            <if test="hE3EndTime != null">H_E3_END_TIME,</if>
            <if test="cI2StartTime1 != null">C_I2_START_TIME1,</if>
            <if test="cI2EndTime1 != null">C_I2_END_TIME1,</if>
            <if test="cI2StartTime2 != null">C_I2_START_TIME2,</if>
            <if test="cI2EndTime2 != null">C_I2_END_TIME2,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="valiStartTime != null">#{valiStartTime},</if>
            <if test="valiEndTime != null">#{valiEndTime},</if>
            <if test="aGSign != null">#{aGSign},</if>
            <if test="aGDate != null">#{aGDate},</if>
            <if test="aHSign != null">#{aHSign},</if>
            <if test="aHDate != null">#{aHDate},</if>
            <if test="aI1aSign != null">#{aI1aSign},</if>
            <if test="aI1aDate != null">#{aI1aDate},</if>
            <if test="aA4Sign != null">#{aA4Sign},</if>
            <if test="aA4Date != null">#{aA4Date},</if>
            <if test="aI1bSign != null">#{aI1bSign},</if>
            <if test="aI1bDate != null">#{aI1bDate},</if>
            <if test="aKSign != null">#{aKSign},</if>
            <if test="aKDate != null">#{aKDate},</if>
            <if test="aE3Sign != null">#{aE3Sign},</if>
            <if test="aE3Date != null">#{aE3Date},</if>
            <if test="hE3Sign != null">#{hE3Sign},</if>
            <if test="hE3Date != null">#{hE3Date},</if>
            <if test="h51Sign != null">#{h51Sign},</if>
            <if test="h51Date != null">#{h51Date},</if>
            <if test="h52Sign != null">#{h52Sign},</if>
            <if test="h52Date != null">#{h52Date},</if>
            <if test="cI2Sign1 != null">#{cI2Sign1},</if>
            <if test="cI2Date1 != null">#{cI2Date1},</if>
            <if test="cI2Sign2 != null">#{cI2Sign2},</if>
            <if test="cI2Date2 != null">#{cI2Date2},</if>
            <if test="aE3StartTime != null">#{aE3StartTime},</if>
            <if test="aE3EndTime != null">#{aE3EndTime},</if>
            <if test="hE3StartTime != null">#{hE3StartTime},</if>
            <if test="hE3EndTime != null">#{hE3EndTime},</if>
            <if test="cI2StartTime1 != null">#{cI2StartTime1},</if>
            <if test="cI2EndTime1 != null">#{cI2EndTime1},</if>
            <if test="cI2StartTime2 != null">#{cI2StartTime2},</if>
            <if test="cI2EndTime2 != null">#{cI2EndTime2},</if>
        </trim>
    </insert>

    <update id="updateTDelayPermitOther" parameterType="TDelayPermitOther">
        update t_delay_permit_other
        <trim prefix="SET" suffixOverrides=",">
            <if test="valiStartTime != null">start_time = #{valiStartTime},</if>
            <if test="valiEndTime != null">end_time = #{valiEndTime},</if>
            <if test="aGSign != null">a_g_sign = #{aGSign},</if>
            <if test="aGDate != null">a_g_date = #{aGDate},</if>
            <if test="aHSign != null">a_h_sign = #{aHSign},</if>
            <if test="aHDate != null">a_h_date = #{aHDate},</if>
            <if test="aI1aSign != null">a_i1a_sign = #{aI1aSign},</if>
            <if test="aI1aDate != null">a_i1a_date = #{aI1aDate},</if>
            <if test="aA4Sign != null">a_a4_sign = #{aA4Sign},</if>
            <if test="aA4Date != null">a_a4_date = #{aA4Date},</if>
            <if test="aI1bSign != null">a_i1b_sign = #{aI1bSign},</if>
            <if test="aI1bDate != null">a_i1b_date = #{aI1bDate},</if>
            <if test="aKSign != null">a_k_sign = #{aKSign},</if>
            <if test="aKDate != null">a_k_date = #{aKDate},</if>
            <if test="aE3Sign != null">a_e3_sign = #{aE3Sign},</if>
            <if test="aE3Date != null">a_e3_date = #{aE3Date},</if>
            <if test="hE3Sign != null">h_e3_sign = #{hE3Sign},</if>
            <if test="hE3Date != null">h_e3_date = #{hE3Date},</if>
            <if test="h51Sign != null">h_51_sign = #{h51Sign},</if>
            <if test="h51Date != null">h_51_date = #{h51Date},</if>
            <if test="h52Sign != null">h_52_sign = #{h52Sign},</if>
            <if test="h52Date != null">h_52_date = #{h52Date},</if>
            <if test="cI2Sign1 != null">c_i2_sign = #{cI2Sign1},</if>
            <if test="cI2Date1 != null">c_i2_date = #{cI2Date1},</if>
            <if test="cI2Sign2 != null">c_i2_sign2 = #{cI2Sign2},</if>
            <if test="cI2Date2 != null">c_i2_date2 = #{cI2Date2},</if>
        </trim>
        where id = #{id}
    </update>

    <update id="deleteTDelayPermitOtherById" parameterType="Long">
        update t_delay_permit_other
        set del_flag = 2
        where id = #{id}
    </update>

    <update id="deleteTDelayPermitOtherByIds" parameterType="String">
        update t_delay_permit_other set del_flag = 2 where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </update>

</mapper>
