<?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.income.mapper.IncomeInvoiceAuthQueryResultMapper">
    
    <resultMap type="IncomeInvoiceAuthQueryResult" id="IncomeInvoiceAuthQueryResultResult">
        <result property="id"    column="id"    />
        <result property="pch"    column="pch"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateTime"    column="update_time"    />
        <result property="initationType"    column="initation_type"    />
        <result property="initationTime"    column="initation_time"    />
        <result property="initationStatus"    column="initation_status"    />
        <result property="gmfsbh"    column="gmfsbh"    />
        <result property="identity"    column="identity"    />
        <result property="taxno"    column="taxno"    />
        <result property="initationNum"    column="initation_num"    />
    </resultMap>

    <sql id="selectIncomeInvoiceAuthQueryResultVo">
        select id, pch, create_time, update_time, initation_type, initation_time, initation_status, gmfsbh, identity, taxno, initation_num from income_invoice_auth_query_result
    </sql>

    <select id="selectIncomeInvoiceAuthQueryResultList" parameterType="IncomeInvoiceAuthQueryResult" resultMap="IncomeInvoiceAuthQueryResultResult">
        <include refid="selectIncomeInvoiceAuthQueryResultVo"/>
        <where>  
            <if test="pch != null  and pch != ''"> and pch = #{pch}</if>
            <if test="initationType != null  and initationType != ''"> and initation_type = #{initationType}</if>
            <if test="initationTime != null "> and initation_time = #{initationTime}</if>
            <if test="initationStatus != null  and initationStatus != ''"> and initation_status = #{initationStatus}</if>
            <if test="gmfsbh != null  and gmfsbh != ''"> and gmfsbh = #{gmfsbh}</if>
            <if test="identity != null  and identity != ''"> and identity = #{identity}</if>
            <if test="taxno != null  and taxno != ''"> and taxno = #{taxno}</if>
            <if test="initationNum != null "> and initation_num = #{initationNum}</if>
        </where>
    </select>
    
    <select id="selectIncomeInvoiceAuthQueryResultById" parameterType="String" resultMap="IncomeInvoiceAuthQueryResultResult">
        <include refid="selectIncomeInvoiceAuthQueryResultVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertIncomeInvoiceAuthQueryResult" parameterType="IncomeInvoiceAuthQueryResult">
        insert into income_invoice_auth_query_result
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="pch != null">pch,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="initationType != null">initation_type,</if>
            <if test="initationTime != null">initation_time,</if>
            <if test="initationStatus != null">initation_status,</if>
            <if test="gmfsbh != null">gmfsbh,</if>
            <if test="identity != null">identity,</if>
            <if test="taxno != null">taxno,</if>
            <if test="initationNum != null">initation_num,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="pch != null">#{pch},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="initationType != null">#{initationType},</if>
            <if test="initationTime != null">#{initationTime},</if>
            <if test="initationStatus != null">#{initationStatus},</if>
            <if test="gmfsbh != null">#{gmfsbh},</if>
            <if test="identity != null">#{identity},</if>
            <if test="taxno != null">#{taxno},</if>
            <if test="initationNum != null">#{initationNum},</if>
         </trim>
    </insert>

    <update id="updateIncomeInvoiceAuthQueryResult" parameterType="IncomeInvoiceAuthQueryResult">
        update income_invoice_auth_query_result
        <trim prefix="SET" suffixOverrides=",">
            <if test="pch != null">pch = #{pch},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="initationType != null">initation_type = #{initationType},</if>
            <if test="initationTime != null">initation_time = #{initationTime},</if>
            <if test="initationStatus != null">initation_status = #{initationStatus},</if>
            <if test="gmfsbh != null">gmfsbh = #{gmfsbh},</if>
            <if test="identity != null">identity = #{identity},</if>
            <if test="taxno != null">taxno = #{taxno},</if>
            <if test="initationNum != null">initation_num = #{initationNum},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIncomeInvoiceAuthQueryResultById" parameterType="String">
        delete from income_invoice_auth_query_result where id = #{id}
    </delete>

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

    <select id="selectIncomeAuthQueryResultList" parameterType="IncomeAuthQueryResult" resultMap="IncomeInvoiceAuthQueryResultResult">
        <include refid="selectIncomeInvoiceAuthQueryResultVo"/>
        <where>
            <if test="pch != null  and pch != ''"> and pch = #{pch}</if>
            <if test="initationType != null  and initationType != ''"> and initation_type = #{initationType}</if>
            <if test="initationTime != null "> and initation_time = #{initationTime}</if>
            <if test="initationStatus != null  and initationStatus != ''"> and initation_status = #{initationStatus}</if>
            <if test="gmfsbh != null  and gmfsbh != ''"> and gmfsbh = #{gmfsbh}</if>
            <if test="identity != null  and identity != ''"> and identity = #{identity}</if>
            <if test="taxno != null  and taxno != ''"> and taxno = #{taxno}</if>
            <if test="initationNum != null "> and initation_num = #{initationNum}</if>
        </where>
    </select>

    <update id="updateIncomeAuthQueryResult" parameterType="IncomeAuthQueryResult">
        update income_query_result
        <trim prefix="SET" suffixOverrides=",">
            <if test="pch != null">pch = #{pch},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="initationType != null">initation_type = #{initationType},</if>
            <if test="initationTime != null">initation_time = #{initationTime},</if>
            <if test="initationStatus != null">initation_status = #{initationStatus},</if>
            <if test="gmfsbh != null">gmfsbh = #{gmfsbh},</if>
            <if test="identity != null">identity = #{identity},</if>
            <if test="taxno != null">taxno = #{taxno},</if>
            <if test="initationNum != null">initation_num = #{initationNum},</if>
        </trim>
        where id = #{id}
    </update>
</mapper>