<?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.spider.quartz.mapper.ExcelDownloadLogMapper">
    
    <resultMap type="ExcelDownloadLog" id="ExcelDownloadLogResult">
        <result property="id"    column="id"    />
        <result property="type"    column="type"    />
        <result property="downloadTime"    column="downloadTime"    />
        <result property="excelPath"    column="excelPath"    />
        <result property="status"    column="status"    />
        <result property="createUser"    column="create_user"    />
        <result property="createDept"    column="create_dept"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateUser"    column="update_user"    />
        <result property="isDeleted"    column="is_deleted"    />
    </resultMap>

    <sql id="selectExcelDownloadLogVo">
        select id, type, downloadTime, excelPath, status, create_user, create_dept, create_time, update_time, update_user, is_deleted from excel_download_log
    </sql>

    <select id="selectExcelDownloadLogList" parameterType="ExcelDownloadLog" resultMap="ExcelDownloadLogResult">
        <include refid="selectExcelDownloadLogVo"/>
        <where>  
            <if test="type != null  and type != ''"> and type = #{type}</if>
            <if test="downloadTime != null "> and downloadTime = #{downloadTime}</if>
            <if test="excelPath != null  and excelPath != ''"> and excelPath = #{excelPath}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="createUser != null  and createUser != ''"> and create_user = #{createUser}</if>
            <if test="createDept != null  and createDept != ''"> and create_dept = #{createDept}</if>
            <if test="updateUser != null  and updateUser != ''"> and update_user = #{updateUser}</if>
            <if test="isDeleted != null "> and is_deleted = #{isDeleted}</if>
        </where>
    </select>
    
    <select id="selectExcelDownloadLogById" parameterType="Long" resultMap="ExcelDownloadLogResult">
        <include refid="selectExcelDownloadLogVo"/>
        where id = #{id}
    </select>

    <insert id="insertExcelDownloadLog" parameterType="ExcelDownloadLog" useGeneratedKeys="true" keyProperty="id">
        insert into excel_download_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="type != null">type,</if>
            <if test="downloadTime != null">downloadTime,</if>
            <if test="excelPath != null">excelPath,</if>
            <if test="status != null">status,</if>
            <if test="createUser != null">create_user,</if>
            <if test="createDept != null">create_dept,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateUser != null">update_user,</if>
            <if test="isDeleted != null">is_deleted,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="type != null">#{type},</if>
            <if test="downloadTime != null">#{downloadTime},</if>
            <if test="excelPath != null">#{excelPath},</if>
            <if test="status != null">#{status},</if>
            <if test="createUser != null">#{createUser},</if>
            <if test="createDept != null">#{createDept},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateUser != null">#{updateUser},</if>
            <if test="isDeleted != null">#{isDeleted},</if>
         </trim>
    </insert>

    <update id="updateExcelDownloadLog" parameterType="ExcelDownloadLog">
        update excel_download_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="type != null">type = #{type},</if>
            <if test="downloadTime != null">downloadTime = #{downloadTime},</if>
            <if test="excelPath != null">excelPath = #{excelPath},</if>
            <if test="status != null">status = #{status},</if>
            <if test="createUser != null">create_user = #{createUser},</if>
            <if test="createDept != null">create_dept = #{createDept},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateUser != null">update_user = #{updateUser},</if>
            <if test="isDeleted != null">is_deleted = #{isDeleted},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteExcelDownloadLogById" parameterType="Long">
        delete from excel_download_log where id = #{id}
    </delete>

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