<?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.IncomeInvoiceAuthMapper">
    
    <resultMap type="IncomeInvoiceAuth" id="IncomeInvoiceAuthResult">
        <result property="id"    column="id"    />
        <result property="identity"    column="identity"    />
        <result property="taxno"    column="taxno"    />
        <result property="pch"    column="pch"    />
        <result property="fpdm"    column="fpdm"    />
        <result property="fphm"    column="fphm"    />
        <result property="qdfphm"    column="qdfphm"    />
        <result property="dqskssq"    column="dqskssq"    />
        <result property="gxjzr"    column="gxjzr"    />
        <result property="gxrqq"    column="gxrqq"    />
        <result property="gxrqz"    column="gxrqz"    />
        <result property="fplxdm"    column="fplxdm"    />
        <result property="gmfmc"    column="gmfmc"    />
        <result property="gmfsbh"    column="gmfsbh"    />
        <result property="buyerIdcard"    column="buyer_idcard"    />
        <result property="gmfdzdh"    column="gmfdzdh"    />
        <result property="buyerAddress"    column="buyer_address"    />
        <result property="buyerPhone"    column="buyer_phone"    />
        <result property="gmfyhzh"    column="gmfyhzh"    />
        <result property="xhfmc"    column="xhfmc"    />
        <result property="xhfsbh"    column="xhfsbh"    />
        <result property="xhfdzdh"    column="xhfdzdh"    />
        <result property="sellerAddress"    column="seller_address"    />
        <result property="sellerPhone"    column="seller_phone"    />
        <result property="xhfyhzh"    column="xhfyhzh"    />
        <result property="sellerBank"    column="seller_bank"    />
        <result property="sellerAccount"    column="seller_account"    />
        <result property="kprq"    column="kprq"    />
        <result property="hjje"    column="hjje"    />
        <result property="se"    column="se"    />
        <result property="jshj"    column="jshj"    />
        <result property="bz"    column="bz"    />
        <result property="fpzt"    column="fpzt"    />
        <result property="rzzt"    column="rzzt"    />
        <result property="rzrq"    column="rzrq"    />
        <result property="rzsq"    column="rzsq"    />
        <result property="sfdbts"    column="sfdbts"    />
        <result property="rzlx"    column="rzlx"    />
        <result property="jym"    column="jym"    />
        <result property="txfbz"    column="txfbz"    />
        <result property="lslbz"    column="lslbz"    />
        <result property="xxly"    column="xxly"    />
        <result property="yxse"    column="yxse"    />
        <result property="yqkgxbz"    column="yqkgxbz"    />
        <result property="glzt"    column="glzt"    />
        <result property="fply"    column="fply"    />
        <result property="dkse"    column="dkse"    />
        <result property="bdkyy"    column="bdkyy"    />
        <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="remark"    column="remark"    />
        <result property="organizeid"    column="organizeid"    />
        <result property="rzstatus"    column="rzstatus"    />
        <result property="qrstatus"    column="qrstatus"    />
        <result property="tjstatus"    column="tjstatus"    />
        <result property="intertype"    column="intertype"    />
        <result property="pzh"    column="pzh"    />
    </resultMap>

    <sql id="selectIncomeInvoiceAuthVo">
        select id, identity, taxno, pch, fpdm, fphm, qdfphm, dqskssq, gxjzr, gxrqq, gxrqz, fplxdm, gmfmc, gmfsbh, buyer_idcard, gmfdzdh, buyer_address, buyer_phone, gmfyhzh, xhfmc, xhfsbh, xhfdzdh, seller_address, seller_phone, xhfyhzh, seller_bank, seller_account, kprq, hjje, se, jshj, bz, fpzt, rzzt, rzrq, rzsq, sfdbts, rzlx, jym, txfbz, lslbz, xxly, yxse, yqkgxbz, glzt, fply, dkse, bdkyy, create_by, create_time, update_by, update_time, remark, organizeid, rzstatus, qrstatus, tjstatus, intertype, pzh from income_invoice_auth
    </sql>

    <select id="selectIncomeInvoiceAuthList" parameterType="IncomeInvoiceAuth" resultMap="IncomeInvoiceAuthResult">
        <include refid="selectIncomeInvoiceAuthVo"/>
        <where>  
            <if test="identity != null "> and identity = #{identity}</if>
            <if test="taxno != null  and taxno != ''"> and taxno = #{taxno}</if>
            <if test="pch != null  and pch != ''"> and pch = #{pch}</if>
            <if test="fpdm != null  and fpdm != ''"> and fpdm = #{fpdm}</if>
            <if test="fphm != null  and fphm != ''"> and fphm = #{fphm}</if>
            <if test="qdfphm != null  and qdfphm != ''"> and qdfphm = #{qdfphm}</if>
            <if test="dqskssq != null  and dqskssq != ''"> and dqskssq = #{dqskssq}</if>
            <if test="gxjzr != null  and gxjzr != ''"> and gxjzr = #{gxjzr}</if>
            <if test="gxrqq != null  and gxrqq != ''"> and gxrqq = #{gxrqq}</if>
            <if test="gxrqz != null  and gxrqz != ''"> and gxrqz = #{gxrqz}</if>
            <if test="fplxdm != null  and fplxdm != ''"> and fplxdm = #{fplxdm}</if>
            <if test="gmfmc != null  and gmfmc != ''"> and gmfmc = #{gmfmc}</if>
            <if test="gmfsbh != null  and gmfsbh != ''"> and gmfsbh = #{gmfsbh}</if>
            <if test="buyerIdcard != null  and buyerIdcard != ''"> and buyer_idcard = #{buyerIdcard}</if>
            <if test="gmfdzdh != null  and gmfdzdh != ''"> and gmfdzdh = #{gmfdzdh}</if>
            <if test="buyerAddress != null  and buyerAddress != ''"> and buyer_address = #{buyerAddress}</if>
            <if test="buyerPhone != null  and buyerPhone != ''"> and buyer_phone = #{buyerPhone}</if>
            <if test="gmfyhzh != null  and gmfyhzh != ''"> and gmfyhzh = #{gmfyhzh}</if>
            <if test="xhfmc != null  and xhfmc != ''"> and xhfmc = #{xhfmc}</if>
            <if test="xhfsbh != null  and xhfsbh != ''"> and xhfsbh = #{xhfsbh}</if>
            <if test="xhfdzdh != null  and xhfdzdh != ''"> and xhfdzdh = #{xhfdzdh}</if>
            <if test="sellerAddress != null  and sellerAddress != ''"> and seller_address = #{sellerAddress}</if>
            <if test="sellerPhone != null  and sellerPhone != ''"> and seller_phone = #{sellerPhone}</if>
            <if test="xhfyhzh != null  and xhfyhzh != ''"> and xhfyhzh = #{xhfyhzh}</if>
            <if test="sellerBank != null  and sellerBank != ''"> and seller_bank = #{sellerBank}</if>
            <if test="sellerAccount != null  and sellerAccount != ''"> and seller_account = #{sellerAccount}</if>
            <if test="kprq != null  and kprq != ''"> and kprq = #{kprq}</if>
            <if test="hjje != null  and hjje != ''"> and hjje = #{hjje}</if>
            <if test="se != null  and se != ''"> and se = #{se}</if>
            <if test="jshj != null  and jshj != ''"> and jshj = #{jshj}</if>
            <if test="bz != null  and bz != ''"> and bz = #{bz}</if>
            <if test="fpzt != null  and fpzt != ''"> and fpzt = #{fpzt}</if>
            <if test="rzzt != null  and rzzt != ''"> and rzzt = #{rzzt}</if>
            <if test="rzrq != null  and rzrq != ''"> and rzrq = #{rzrq}</if>
            <if test="rzsq != null  and rzsq != ''"> and rzsq = #{rzsq}</if>
            <if test="sfdbts != null  and sfdbts != ''"> and sfdbts = #{sfdbts}</if>
            <if test="rzlx != null  and rzlx != ''"> and rzlx = #{rzlx}</if>
            <if test="jym != null  and jym != ''"> and jym = #{jym}</if>
            <if test="txfbz != null  and txfbz != ''"> and txfbz = #{txfbz}</if>
            <if test="lslbz != null  and lslbz != ''"> and lslbz = #{lslbz}</if>
            <if test="xxly != null  and xxly != ''"> and xxly = #{xxly}</if>
            <if test="yxse != null  and yxse != ''"> and yxse = #{yxse}</if>
            <if test="yqkgxbz != null  and yqkgxbz != ''"> and yqkgxbz = #{yqkgxbz}</if>
            <if test="glzt != null  and glzt != ''"> and glzt = #{glzt}</if>
            <if test="fply != null  and fply != ''"> and fply = #{fply}</if>
            <if test="dkse != null  and dkse != ''"> and dkse = #{dkse}</if>
            <if test="bdkyy != null  and bdkyy != ''"> and bdkyy = #{bdkyy}</if>
            <if test="organizeid != null  and organizeid != ''"> and organizeid = #{organizeid}</if>
            <if test="rzstatus != null  and rzstatus != ''"> and rzstatus = #{rzstatus}</if>
            <if test="qrstatus != null  and qrstatus != ''"> and qrstatus = #{qrstatus}</if>
            <if test="tjstatus != null  and tjstatus != ''"> and tjstatus = #{tjstatus}</if>
            <if test="intertype != null  and intertype != ''"> and intertype = #{intertype}</if>
            <if test="pzh != null  and pzh != ''"> and pzh = #{pzh}</if>
        </where>
    </select>
    
    <select id="selectIncomeInvoiceAuthById" parameterType="String" resultMap="IncomeInvoiceAuthResult">
        <include refid="selectIncomeInvoiceAuthVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertIncomeInvoiceAuth" parameterType="IncomeInvoiceAuth">
        insert into income_invoice_auth
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="identity != null">identity,</if>
            <if test="taxno != null">taxno,</if>
            <if test="pch != null and pch != ''">pch,</if>
            <if test="fpdm != null and fpdm != ''">fpdm,</if>
            <if test="fphm != null and fphm != ''">fphm,</if>
            <if test="qdfphm != null">qdfphm,</if>
            <if test="dqskssq != null and dqskssq != ''">dqskssq,</if>
            <if test="gxjzr != null and gxjzr != ''">gxjzr,</if>
            <if test="gxrqq != null and gxrqq != ''">gxrqq,</if>
            <if test="gxrqz != null and gxrqz != ''">gxrqz,</if>
            <if test="fplxdm != null and fplxdm != ''">fplxdm,</if>
            <if test="gmfmc != null">gmfmc,</if>
            <if test="gmfsbh != null">gmfsbh,</if>
            <if test="buyerIdcard != null">buyer_idcard,</if>
            <if test="gmfdzdh != null">gmfdzdh,</if>
            <if test="buyerAddress != null">buyer_address,</if>
            <if test="buyerPhone != null">buyer_phone,</if>
            <if test="gmfyhzh != null">gmfyhzh,</if>
            <if test="xhfmc != null">xhfmc,</if>
            <if test="xhfsbh != null">xhfsbh,</if>
            <if test="xhfdzdh != null">xhfdzdh,</if>
            <if test="sellerAddress != null">seller_address,</if>
            <if test="sellerPhone != null">seller_phone,</if>
            <if test="xhfyhzh != null">xhfyhzh,</if>
            <if test="sellerBank != null">seller_bank,</if>
            <if test="sellerAccount != null">seller_account,</if>
            <if test="kprq != null">kprq,</if>
            <if test="hjje != null">hjje,</if>
            <if test="se != null">se,</if>
            <if test="jshj != null">jshj,</if>
            <if test="bz != null">bz,</if>
            <if test="fpzt != null">fpzt,</if>
            <if test="rzzt != null">rzzt,</if>
            <if test="rzrq != null">rzrq,</if>
            <if test="rzsq != null">rzsq,</if>
            <if test="sfdbts != null">sfdbts,</if>
            <if test="rzlx != null">rzlx,</if>
            <if test="jym != null">jym,</if>
            <if test="txfbz != null">txfbz,</if>
            <if test="lslbz != null">lslbz,</if>
            <if test="xxly != null">xxly,</if>
            <if test="yxse != null">yxse,</if>
            <if test="yqkgxbz != null">yqkgxbz,</if>
            <if test="glzt != null">glzt,</if>
            <if test="fply != null">fply,</if>
            <if test="dkse != null">dkse,</if>
            <if test="bdkyy != null">bdkyy,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
            <if test="organizeid != null">organizeid,</if>
            <if test="rzstatus != null">rzstatus,</if>
            <if test="qrstatus != null">qrstatus,</if>
            <if test="tjstatus != null">tjstatus,</if>
            <if test="intertype != null">intertype,</if>
            <if test="pzh != null">pzh,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="identity != null">#{identity},</if>
            <if test="taxno != null">#{taxno},</if>
            <if test="pch != null and pch != ''">#{pch},</if>
            <if test="fpdm != null and fpdm != ''">#{fpdm},</if>
            <if test="fphm != null and fphm != ''">#{fphm},</if>
            <if test="qdfphm != null">#{qdfphm},</if>
            <if test="dqskssq != null and dqskssq != ''">#{dqskssq},</if>
            <if test="gxjzr != null and gxjzr != ''">#{gxjzr},</if>
            <if test="gxrqq != null and gxrqq != ''">#{gxrqq},</if>
            <if test="gxrqz != null and gxrqz != ''">#{gxrqz},</if>
            <if test="fplxdm != null and fplxdm != ''">#{fplxdm},</if>
            <if test="gmfmc != null">#{gmfmc},</if>
            <if test="gmfsbh != null">#{gmfsbh},</if>
            <if test="buyerIdcard != null">#{buyerIdcard},</if>
            <if test="gmfdzdh != null">#{gmfdzdh},</if>
            <if test="buyerAddress != null">#{buyerAddress},</if>
            <if test="buyerPhone != null">#{buyerPhone},</if>
            <if test="gmfyhzh != null">#{gmfyhzh},</if>
            <if test="xhfmc != null">#{xhfmc},</if>
            <if test="xhfsbh != null">#{xhfsbh},</if>
            <if test="xhfdzdh != null">#{xhfdzdh},</if>
            <if test="sellerAddress != null">#{sellerAddress},</if>
            <if test="sellerPhone != null">#{sellerPhone},</if>
            <if test="xhfyhzh != null">#{xhfyhzh},</if>
            <if test="sellerBank != null">#{sellerBank},</if>
            <if test="sellerAccount != null">#{sellerAccount},</if>
            <if test="kprq != null">#{kprq},</if>
            <if test="hjje != null">#{hjje},</if>
            <if test="se != null">#{se},</if>
            <if test="jshj != null">#{jshj},</if>
            <if test="bz != null">#{bz},</if>
            <if test="fpzt != null">#{fpzt},</if>
            <if test="rzzt != null">#{rzzt},</if>
            <if test="rzrq != null">#{rzrq},</if>
            <if test="rzsq != null">#{rzsq},</if>
            <if test="sfdbts != null">#{sfdbts},</if>
            <if test="rzlx != null">#{rzlx},</if>
            <if test="jym != null">#{jym},</if>
            <if test="txfbz != null">#{txfbz},</if>
            <if test="lslbz != null">#{lslbz},</if>
            <if test="xxly != null">#{xxly},</if>
            <if test="yxse != null">#{yxse},</if>
            <if test="yqkgxbz != null">#{yqkgxbz},</if>
            <if test="glzt != null">#{glzt},</if>
            <if test="fply != null">#{fply},</if>
            <if test="dkse != null">#{dkse},</if>
            <if test="bdkyy != null">#{bdkyy},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
            <if test="organizeid != null">#{organizeid},</if>
            <if test="rzstatus != null">#{rzstatus},</if>
            <if test="qrstatus != null">#{qrstatus},</if>
            <if test="tjstatus != null">#{tjstatus},</if>
            <if test="intertype != null">#{intertype},</if>
            <if test="pzh != null">#{pzh},</if>
         </trim>
    </insert>

    <update id="updateIncomeInvoiceAuth" parameterType="IncomeInvoiceAuth">
        update income_invoice_auth
        <trim prefix="SET" suffixOverrides=",">
            <if test="identity != null">identity = #{identity},</if>
            <if test="taxno != null">taxno = #{taxno},</if>
            <if test="pch != null and pch != ''">pch = #{pch},</if>
            <if test="fpdm != null and fpdm != ''">fpdm = #{fpdm},</if>
            <if test="fphm != null and fphm != ''">fphm = #{fphm},</if>
            <if test="qdfphm != null">qdfphm = #{qdfphm},</if>
            <if test="dqskssq != null and dqskssq != ''">dqskssq = #{dqskssq},</if>
            <if test="gxjzr != null and gxjzr != ''">gxjzr = #{gxjzr},</if>
            <if test="gxrqq != null and gxrqq != ''">gxrqq = #{gxrqq},</if>
            <if test="gxrqz != null and gxrqz != ''">gxrqz = #{gxrqz},</if>
            <if test="fplxdm != null and fplxdm != ''">fplxdm = #{fplxdm},</if>
            <if test="gmfmc != null">gmfmc = #{gmfmc},</if>
            <if test="gmfsbh != null">gmfsbh = #{gmfsbh},</if>
            <if test="buyerIdcard != null">buyer_idcard = #{buyerIdcard},</if>
            <if test="gmfdzdh != null">gmfdzdh = #{gmfdzdh},</if>
            <if test="buyerAddress != null">buyer_address = #{buyerAddress},</if>
            <if test="buyerPhone != null">buyer_phone = #{buyerPhone},</if>
            <if test="gmfyhzh != null">gmfyhzh = #{gmfyhzh},</if>
            <if test="xhfmc != null">xhfmc = #{xhfmc},</if>
            <if test="xhfsbh != null">xhfsbh = #{xhfsbh},</if>
            <if test="xhfdzdh != null">xhfdzdh = #{xhfdzdh},</if>
            <if test="sellerAddress != null">seller_address = #{sellerAddress},</if>
            <if test="sellerPhone != null">seller_phone = #{sellerPhone},</if>
            <if test="xhfyhzh != null">xhfyhzh = #{xhfyhzh},</if>
            <if test="sellerBank != null">seller_bank = #{sellerBank},</if>
            <if test="sellerAccount != null">seller_account = #{sellerAccount},</if>
            <if test="kprq != null">kprq = #{kprq},</if>
            <if test="hjje != null">hjje = #{hjje},</if>
            <if test="se != null">se = #{se},</if>
            <if test="jshj != null">jshj = #{jshj},</if>
            <if test="bz != null">bz = #{bz},</if>
            <if test="fpzt != null">fpzt = #{fpzt},</if>
            <if test="rzzt != null">rzzt = #{rzzt},</if>
            <if test="rzrq != null">rzrq = #{rzrq},</if>
            <if test="rzsq != null">rzsq = #{rzsq},</if>
            <if test="sfdbts != null">sfdbts = #{sfdbts},</if>
            <if test="rzlx != null">rzlx = #{rzlx},</if>
            <if test="jym != null">jym = #{jym},</if>
            <if test="txfbz != null">txfbz = #{txfbz},</if>
            <if test="lslbz != null">lslbz = #{lslbz},</if>
            <if test="xxly != null">xxly = #{xxly},</if>
            <if test="yxse != null">yxse = #{yxse},</if>
            <if test="yqkgxbz != null">yqkgxbz = #{yqkgxbz},</if>
            <if test="glzt != null">glzt = #{glzt},</if>
            <if test="fply != null">fply = #{fply},</if>
            <if test="dkse != null">dkse = #{dkse},</if>
            <if test="bdkyy != null">bdkyy = #{bdkyy},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="organizeid != null">organizeid = #{organizeid},</if>
            <if test="rzstatus != null">rzstatus = #{rzstatus},</if>
            <if test="qrstatus != null">qrstatus = #{qrstatus},</if>
            <if test="tjstatus != null">tjstatus = #{tjstatus},</if>
            <if test="intertype != null">intertype = #{intertype},</if>
            <if test="pzh != null">pzh = #{pzh},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteIncomeInvoiceAuthById" parameterType="String">
        delete from income_invoice_auth where id = #{id}
    </delete>

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