<?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.zehong.system.mapper.TLpgThirdPartyDockingInterfaceRecordMapper">
    
    <resultMap type="TLpgThirdPartyDockingInterfaceRecord" id="TLpgThirdPartyDockingInterfaceRecordResult">
        <result property="recordId"    column="record_id"    />
        <result property="interfaceName"    column="interface_name"    />
        <result property="state"    column="state"    />
        <result property="receiveData"    column="receive_data"    />
        <result property="returnData"    column="return_data"    />
        <result property="failureReason"    column="failure_reason"    />
        <result property="receiveDate"    column="receive_date"    />
        <result property="qybm"    column="qybm"    />
    </resultMap>

    <sql id="selectTLpgThirdPartyDockingInterfaceRecordVo">
        select record_id, interface_name, state, receive_data, return_data, failure_reason, receive_date ,qybm from t_lpg_third_party_docking_interface_record
    </sql>

    <select id="selectTLpgThirdPartyDockingInterfaceRecordList" parameterType="TLpgThirdPartyDockingInterfaceRecord" resultMap="TLpgThirdPartyDockingInterfaceRecordResult">
        <include refid="selectTLpgThirdPartyDockingInterfaceRecordVo"/>
        <where>  
            <if test="interfaceName != null  and interfaceName != ''"> and interface_name like concat('%', #{interfaceName}, '%')</if>
            <if test="state != null  and state != ''"> and state = #{state}</if>
            <if test="receiveData != null  and receiveData != ''"> and receive_data = #{receiveData}</if>
            <if test="returnData != null  and returnData != ''"> and return_data = #{returnData}</if>
            <if test="failureReason != null  and failureReason != ''"> and failure_reason = #{failureReason}</if>
            <if test="receiveDate != null "> and receive_date = #{receiveDate}</if>
        </where>
    </select>
    
    <select id="selectTLpgThirdPartyDockingInterfaceRecordById" parameterType="Long" resultMap="TLpgThirdPartyDockingInterfaceRecordResult">
        <include refid="selectTLpgThirdPartyDockingInterfaceRecordVo"/>
        where record_id = #{recordId}
    </select>

    <insert id="insertBatch" parameterType="list">
        insert into t_lpg_third_party_docking_interface_record (interface_name, state,receive_data, return_data, failure_reason,
        receive_date,qybm)
        values
        <foreach collection="list" item="item" index="index" separator=",">
            (
            #{item.interfaceName,jdbcType=VARCHAR}, #{item.state,jdbcType=VARCHAR}, #{item.receiveData,jdbcType=VARCHAR},
            #{item.returnData,jdbcType=VARCHAR}, #{item.failureReason,jdbcType=VARCHAR},#{item.receiveDate},#{item.qybm}
            )
        </foreach>
    </insert>
    <insert id="insertTLpgThirdPartyDockingInterfaceRecord" parameterType="TLpgThirdPartyDockingInterfaceRecord" useGeneratedKeys="true" keyProperty="recordId">
        insert into t_lpg_third_party_docking_interface_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="interfaceName != null">interface_name,</if>
            <if test="state != null">state,</if>
            <if test="receiveData != null">receive_data,</if>
            <if test="returnData != null">return_data,</if>
            <if test="failureReason != null">failure_reason,</if>
            <if test="receiveDate != null">receive_date,</if>
            <if test="qybm != null">qybm,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="interfaceName != null">#{interfaceName},</if>
            <if test="state != null">#{state},</if>
            <if test="receiveData != null">#{receiveData},</if>
            <if test="returnData != null">#{returnData},</if>
            <if test="failureReason != null">#{failureReason},</if>
            <if test="receiveDate != null">#{receiveDate},</if>
            <if test="qybm != null">#{qybm},</if>
         </trim>
    </insert>

    <update id="updateTLpgThirdPartyDockingInterfaceRecord" parameterType="TLpgThirdPartyDockingInterfaceRecord">
        update t_lpg_third_party_docking_interface_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="interfaceName != null">interface_name = #{interfaceName},</if>
            <if test="state != null">state = #{state},</if>
            <if test="receiveData != null">receive_data = #{receiveData},</if>
            <if test="returnData != null">return_data = #{returnData},</if>
            <if test="failureReason != null">failure_reason = #{failureReason},</if>
            <if test="receiveDate != null">receive_date = #{receiveDate},</if>
        </trim>
        where record_id = #{recordId}
    </update>

    <delete id="deleteTLpgThirdPartyDockingInterfaceRecordById" parameterType="Long">
        delete from t_lpg_third_party_docking_interface_record where record_id = #{recordId}
    </delete>

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