<?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.adjust.mapper.AsynchExpLogMapper">
    
    <resultMap type="AsynchExpLog" id="AsynchExpLogResult">
        <result property="id"    column="id"    />
        <result property="dataType"    column="data_type"    />
        <result property="dataTypeName"    column="data_type_name"    />
        <result property="fileUrl"    column="file_url"    />
        <result property="filePath"    column="file_path"    />
        <result property="fileName"    column="file_name"    />
        <result property="expStatus"    column="exp_status"    />
        <result property="errReason"    column="err_reason"    />
        <result property="expDate"    column="exp_date"    />
        <result property="expUsedTime"    column="exp_used_time"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="tenantNo"    column="tenant_no"    />
        <result property="totalCnt"    column="total_cnt"    />
    </resultMap>

    <sql id="selectAsynchExpLogVo">
        select id, data_type, data_type_name, file_url,total_cnt,  file_path, file_name, exp_status, err_reason, exp_date, exp_used_time, create_time, create_by, update_time, update_by, tenant_no from asynch_exp_log
    </sql>

    <select id="selectAsynchExpLogList" parameterType="AsynchExpLog" resultMap="AsynchExpLogResult">
        <include refid="selectAsynchExpLogVo"/>
        <where>  
            <if test="dataType != null  and dataType != ''"> and data_type = #{dataType}</if>
            <if test="fileName != null  and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
            <if test="expStatus != null  and expStatus != ''"> and exp_status = #{expStatus}</if>
            <if test="expDate != null  and expDate != ''"> and exp_date = #{expDate}</if>
            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
        </where>
        order by id desc
    </select>
    
    <select id="selectAsynchExpLogById" parameterType="Long" resultMap="AsynchExpLogResult">
        <include refid="selectAsynchExpLogVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertAsynchExpLog" parameterType="AsynchExpLog" useGeneratedKeys="true" keyProperty="id">
        insert into asynch_exp_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="dataType != null">data_type,</if>
            <if test="dataTypeName != null">data_type_name,</if>
            <if test="fileUrl != null">file_url,</if>
            <if test="filePath != null">file_path,</if>
            <if test="fileName != null">file_name,</if>
            <if test="expStatus != null">exp_status,</if>
            <if test="errReason != null">err_reason,</if>
            <if test="expDate != null">exp_date,</if>
            <if test="expUsedTime != null">exp_used_time,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="tenantNo != null">tenant_no,</if>
            <if test="totalCnt != null">total_cnt,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="dataType != null">#{dataType},</if>
            <if test="dataTypeName != null">#{dataTypeName},</if>
            <if test="fileUrl != null">#{fileUrl},</if>
            <if test="filePath != null">#{filePath},</if>
            <if test="fileName != null">#{fileName},</if>
            <if test="expStatus != null">#{expStatus},</if>
            <if test="errReason != null">#{errReason},</if>
            <if test="expDate != null">#{expDate},</if>
            <if test="expUsedTime != null">#{expUsedTime},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="tenantNo != null">#{tenantNo},</if>
            <if test="totalCnt != null">#{totalCnt},</if>
         </trim>
    </insert>

    <update id="updateAsynchExpLog" parameterType="AsynchExpLog">
        update asynch_exp_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="dataType != null">data_type = #{dataType},</if>
            <if test="dataTypeName != null">data_type_name = #{dataTypeName},</if>
            <if test="fileUrl != null">file_url = #{fileUrl},</if>
            <if test="filePath != null">file_path = #{filePath},</if>
            <if test="fileName != null">file_name = #{fileName},</if>
            <if test="expStatus != null">exp_status = #{expStatus},</if>
            <if test="errReason != null">err_reason = #{errReason},</if>
            <if test="expDate != null">exp_date = #{expDate},</if>
            <if test="expUsedTime != null">exp_used_time = #{expUsedTime},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="tenantNo != null">tenant_no = #{tenantNo},</if>
             <if test="totalCnt != null">total_cnt = #{totalCnt},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteAsynchExpLogById" parameterType="Long">
        delete from asynch_exp_log where id = #{id}
    </delete>

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