<?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.dgtly.system.mapper.TransferLogMapper">
    
    <resultMap type="TransferLog" id="TransferLogResult">
        <result property="logId"    column="log_id"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="deliveryNumber"    column="delivery_number"    />
        <result property="authFile"    column="auth_file"    />
        <result property="codeing"    column="codeing"    />
        <result property="remarks"    column="remarks"    />
    </resultMap>

    <sql id="selectTransferLogVo">
        select log_id, create_by,remarks, create_time, update_by, update_time, del_flag, delivery_number, auth_file, codeing from transfer_log
    </sql>

    <select id="selectTransferLogList" parameterType="TransferLog" resultMap="TransferLogResult">
        <include refid="selectTransferLogVo"/>
        <where>  
            <if test="deliveryNumber != null  and deliveryNumber != ''"> and delivery_number = #{deliveryNumber}</if>
            <if test="authFile != null  and authFile != ''"> and auth_file = #{authFile}</if>
            <if test="codeing != null  and codeing != ''"> and codeing = #{codeing}</if>
        </where>
    </select>
    
    <select id="selectTransferLogById" parameterType="Long" resultMap="TransferLogResult">
        <include refid="selectTransferLogVo"/>
        where log_id = #{logId}
    </select>
        
    <insert id="insertTransferLog" parameterType="TransferLog">
        insert into transfer_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="logId != null ">log_id,</if>
            <if test="createBy != null  and createBy != ''">create_by,</if>
            <if test="createTime != null ">create_time,</if>
            <if test="updateBy != null  and updateBy != ''">update_by,</if>
            <if test="updateTime != null ">update_time,</if>
            <if test="delFlag != null  and delFlag != ''">del_flag,</if>
            <if test="deliveryNumber != null  and deliveryNumber != ''">delivery_number,</if>
            <if test="authFile != null  and authFile != ''">auth_file,</if>
            <if test="codeing != null  and codeing != ''">codeing,</if>
            <if test="remarks != null  and remarks != ''">remarks,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="logId != null ">#{logId},</if>
            <if test="createBy != null  and createBy != ''">#{createBy},</if>
            <if test="createTime != null ">#{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">#{updateBy},</if>
            <if test="updateTime != null ">#{updateTime},</if>
            <if test="delFlag != null  and delFlag != ''">#{delFlag},</if>
            <if test="deliveryNumber != null  and deliveryNumber != ''">#{deliveryNumber},</if>
            <if test="authFile != null  and authFile != ''">#{authFile},</if>
            <if test="codeing != null  and codeing != ''">#{codeing},</if>
            <if test="remarks != null  and remarks != ''">#{remarks},</if>
         </trim>
    </insert>

    <update id="updateTransferLog" parameterType="TransferLog">
        update transfer_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="createBy != null  and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
            <if test="updateBy != null  and updateBy != ''">update_by = #{updateBy},</if>
            <if test="updateTime != null ">update_time = #{updateTime},</if>
            <if test="delFlag != null  and delFlag != ''">del_flag = #{delFlag},</if>
            <if test="deliveryNumber != null  and deliveryNumber != ''">delivery_number = #{deliveryNumber},</if>
            <if test="authFile != null  and authFile != ''">auth_file = #{authFile},</if>
            <if test="codeing != null  and codeing != ''">codeing = #{codeing},</if>
            <if test="remarks != null  and remarks != ''">remarks = #{remarks},</if>
        </trim>
        where log_id = #{logId}
    </update>

    <delete id="deleteTransferLogById" parameterType="Long">
        delete from transfer_log where log_id = #{logId}
    </delete>

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