<?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.jianshui.system.mapper.InvoiceAllApiLogMapper">
    
    <resultMap type="InvoiceAllApiLog" id="InvoiceAllApiLogResult">
        <result property="id"    column="id"    />
        <result property="url"    column="url"    />
        <result property="sendMsg"    column="send_msg"    />
        <result property="resultMsg"    column="result_msg"    />
        <result property="company"    column="company"    />
        <result property="identityId"    column="identity_id"    />
        <result property="createTime"    column="create_time"    />
        <result property="requestId"    column="request_id"    />
        <result property="companyName"    column="company_name"    />
    </resultMap>

    <sql id="selectInvoiceAllApiLogVo">
        select id, url, send_msg, result_msg, company, identity_id, create_time, request_id,company_name from invoice_all_api_log
    </sql>

    <select id="selectInvoiceAllApiLogList" parameterType="InvoiceAllApiLog" resultMap="InvoiceAllApiLogResult">
        <include refid="selectInvoiceAllApiLogVo"/>
        <where>  
            <if test="url != null  and url != ''"> and url = #{url}</if>
            <if test="sendMsg != null  and sendMsg != ''"> and send_msg = #{sendMsg}</if>
            <if test="resultMsg != null  and resultMsg != ''"> and result_msg = #{resultMsg}</if>
            <if test="company != null  and company != ''"> and company = #{company}</if>
            <if test="identityId != null  and identityId != ''"> and identity_id = #{identityId}</if>
            <if test="requestId != null  and requestId != ''"> and request_id = #{requestId}</if>
            <if test="companyName != null  and companyName != ''"> and company_name = #{companyName}</if>
        </where>
    </select>
    
    <select id="selectInvoiceAllApiLogById" parameterType="Long" resultMap="InvoiceAllApiLogResult">
        <include refid="selectInvoiceAllApiLogVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertInvoiceAllApiLog" parameterType="InvoiceAllApiLog" useGeneratedKeys="true" keyProperty="id">
        insert into invoice_all_api_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="url != null">url,</if>
            <if test="sendMsg != null">send_msg,</if>
            <if test="resultMsg != null">result_msg,</if>
            <if test="company != null">company,</if>
            <if test="identityId != null">identity_id,</if>
            <if test="createTime != null">create_time,</if>
            <if test="requestId != null">request_id,</if>
            <if test="companyName != null">company_name,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="url != null">#{url},</if>
            <if test="sendMsg != null">#{sendMsg},</if>
            <if test="resultMsg != null">#{resultMsg},</if>
            <if test="company != null">#{company},</if>
            <if test="identityId != null">#{identityId},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="requestId != null">#{requestId},</if>
            <if test="companyName != null">#{companyName},</if>
         </trim>
    </insert>

    <update id="updateInvoiceAllApiLog" parameterType="InvoiceAllApiLog">
        update invoice_all_api_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="url != null">url = #{url},</if>
            <if test="sendMsg != null">send_msg = #{sendMsg},</if>
            <if test="resultMsg != null">result_msg = #{resultMsg},</if>
            <if test="company != null">company = #{company},</if>
            <if test="identityId != null">identity_id = #{identityId},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="requestId != null">request_id = #{requestId},</if>
            <if test="companyName != null">company_name = #{companyName},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteInvoiceAllApiLogById" parameterType="Long">
        delete from invoice_all_api_log where id = #{id}
    </delete>

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