<?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.hzya.frame.plugin.lets.dao.impl.SoSaleinvoiceDaoImpl">

    <resultMap id="get-SoSaleinvoiceEntity-result" type="com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity" >
       <result property="bfreecustflag" column="BFREECUSTFLAG" jdbcType="VARCHAR"/>
           <result property="binitflag" column="BINITFLAG" jdbcType="VARCHAR"/>
           <result property="btogoldtax" column="BTOGOLDTAX" jdbcType="VARCHAR"/>
           <result property="capproveid" column="CAPPROVEID" jdbcType="VARCHAR"/>
           <result property="cbiztype" column="CBIZTYPE" jdbcType="VARCHAR"/>
           <result property="ccalbodyid" column="CCALBODYID" jdbcType="VARCHAR"/>
           <result property="ccreditnum" column="CCREDITNUM" jdbcType="VARCHAR"/>
           <result property="ccustbankid" column="CCUSTBANKID" jdbcType="VARCHAR"/>
           <result property="cdeptid" column="CDEPTID" jdbcType="VARCHAR"/>
           <result property="cdispatcherid" column="CDISPATCHERID" jdbcType="VARCHAR"/>
           <result property="cemployeeid" column="CEMPLOYEEID" jdbcType="VARCHAR"/>
           <result property="cfreecustid" column="CFREECUSTID" jdbcType="VARCHAR"/>
           <result property="cgoldtaxcode" column="CGOLDTAXCODE" jdbcType="VARCHAR"/>
           <result property="coperatorid" column="COPERATORID" jdbcType="VARCHAR"/>
           <result property="creceiptcorpid" column="CRECEIPTCORPID" jdbcType="VARCHAR"/>
           <result property="creceiptcustomerid" column="CRECEIPTCUSTOMERID" jdbcType="VARCHAR"/>
           <result property="creceipttype" column="CRECEIPTTYPE" jdbcType="VARCHAR"/>
           <result property="csalecorpid" column="CSALECORPID" jdbcType="VARCHAR"/>
           <result property="csaleid" column="CSALEID" jdbcType="VARCHAR"/>
           <result property="ctermprotocolid" column="CTERMPROTOCOLID" jdbcType="VARCHAR"/>
           <result property="ctransmodeid" column="CTRANSMODEID" jdbcType="VARCHAR"/>
           <result property="cwarehouseid" column="CWAREHOUSEID" jdbcType="VARCHAR"/>
           <result property="dapprovedate" column="DAPPROVEDATE" jdbcType="VARCHAR"/>
           <result property="daudittime" column="DAUDITTIME" jdbcType="VARCHAR"/>
           <result property="dbilldate" column="DBILLDATE" jdbcType="VARCHAR"/>
           <result property="dbilltime" column="DBILLTIME" jdbcType="VARCHAR"/>
           <result property="deinvdate" column="DEINVDATE" jdbcType="VARCHAR"/>
           <result property="dmakedate" column="DMAKEDATE" jdbcType="VARCHAR"/>
           <result property="dmoditime" column="DMODITIME" jdbcType="VARCHAR"/>
           <result property="dr" column="DR" jdbcType="VARCHAR"/>
           <result property="dtogoldtaxtime" column="DTOGOLDTAXTIME" jdbcType="VARCHAR"/>
           <result property="fcounteractflag" column="FCOUNTERACTFLAG" jdbcType="VARCHAR"/>
           <result property="feinvstatus" column="FEINVSTATUS" jdbcType="VARCHAR"/>
           <result property="finvoiceclass" column="FINVOICECLASS" jdbcType="VARCHAR"/>
           <result property="finvoicetype" column="FINVOICETYPE" jdbcType="VARCHAR"/>
           <result property="fstatus" column="FSTATUS" jdbcType="VARCHAR"/>
           <result property="ibalanceflag" column="IBALANCEFLAG" jdbcType="VARCHAR"/>
           <result property="iprintcount" column="IPRINTCOUNT" jdbcType="VARCHAR"/>
           <result property="ndiscountrate" column="NDISCOUNTRATE" jdbcType="VARCHAR"/>
           <result property="nevaluatecarriage" column="NEVALUATECARRIAGE" jdbcType="VARCHAR"/>
           <result property="nnetmny" column="NNETMNY" jdbcType="VARCHAR"/>
           <result property="nstrikemny" column="NSTRIKEMNY" jdbcType="VARCHAR"/>
           <result property="nsubscription" column="NSUBSCRIPTION" jdbcType="VARCHAR"/>
           <result property="ntotalnum" column="NTOTALNUM" jdbcType="VARCHAR"/>
           <result property="ntotalsummny" column="NTOTALSUMMNY" jdbcType="VARCHAR"/>
           <result property="pkConnected" column="PK_CONNECTED" jdbcType="VARCHAR"/>
           <result property="pkCorp" column="PK_CORP" jdbcType="VARCHAR"/>
           <result property="pkDefdoc1" column="PK_DEFDOC1" jdbcType="VARCHAR"/>
           <result property="pkDefdoc10" column="PK_DEFDOC10" jdbcType="VARCHAR"/>
           <result property="pkDefdoc11" column="PK_DEFDOC11" jdbcType="VARCHAR"/>
           <result property="pkDefdoc12" column="PK_DEFDOC12" jdbcType="VARCHAR"/>
           <result property="pkDefdoc13" column="PK_DEFDOC13" jdbcType="VARCHAR"/>
           <result property="pkDefdoc14" column="PK_DEFDOC14" jdbcType="VARCHAR"/>
           <result property="pkDefdoc15" column="PK_DEFDOC15" jdbcType="VARCHAR"/>
           <result property="pkDefdoc16" column="PK_DEFDOC16" jdbcType="VARCHAR"/>
           <result property="pkDefdoc17" column="PK_DEFDOC17" jdbcType="VARCHAR"/>
           <result property="pkDefdoc18" column="PK_DEFDOC18" jdbcType="VARCHAR"/>
           <result property="pkDefdoc19" column="PK_DEFDOC19" jdbcType="VARCHAR"/>
           <result property="pkDefdoc2" column="PK_DEFDOC2" jdbcType="VARCHAR"/>
           <result property="pkDefdoc20" column="PK_DEFDOC20" jdbcType="VARCHAR"/>
           <result property="pkDefdoc3" column="PK_DEFDOC3" jdbcType="VARCHAR"/>
           <result property="pkDefdoc4" column="PK_DEFDOC4" jdbcType="VARCHAR"/>
           <result property="pkDefdoc5" column="PK_DEFDOC5" jdbcType="VARCHAR"/>
           <result property="pkDefdoc6" column="PK_DEFDOC6" jdbcType="VARCHAR"/>
           <result property="pkDefdoc7" column="PK_DEFDOC7" jdbcType="VARCHAR"/>
           <result property="pkDefdoc8" column="PK_DEFDOC8" jdbcType="VARCHAR"/>
           <result property="pkDefdoc9" column="PK_DEFDOC9" jdbcType="VARCHAR"/>
           <result property="ts" column="TS" jdbcType="VARCHAR"/>
           <result property="vaccountyear" column="VACCOUNTYEAR" jdbcType="VARCHAR"/>
           <result property="vdef1" column="VDEF1" jdbcType="VARCHAR"/>
           <result property="vdef10" column="VDEF10" jdbcType="VARCHAR"/>
           <result property="vdef11" column="VDEF11" jdbcType="VARCHAR"/>
           <result property="vdef12" column="VDEF12" jdbcType="VARCHAR"/>
           <result property="vdef13" column="VDEF13" jdbcType="VARCHAR"/>
           <result property="vdef14" column="VDEF14" jdbcType="VARCHAR"/>
           <result property="vdef15" column="VDEF15" jdbcType="VARCHAR"/>
           <result property="vdef16" column="VDEF16" jdbcType="VARCHAR"/>
           <result property="vdef17" column="VDEF17" jdbcType="VARCHAR"/>
           <result property="vdef18" column="VDEF18" jdbcType="VARCHAR"/>
           <result property="vdef19" column="VDEF19" jdbcType="VARCHAR"/>
           <result property="vdef2" column="VDEF2" jdbcType="VARCHAR"/>
           <result property="vdef20" column="VDEF20" jdbcType="VARCHAR"/>
           <result property="vdef3" column="VDEF3" jdbcType="VARCHAR"/>
           <result property="vdef4" column="VDEF4" jdbcType="VARCHAR"/>
           <result property="vdef5" column="VDEF5" jdbcType="VARCHAR"/>
           <result property="vdef6" column="VDEF6" jdbcType="VARCHAR"/>
           <result property="vdef7" column="VDEF7" jdbcType="VARCHAR"/>
           <result property="vdef8" column="VDEF8" jdbcType="VARCHAR"/>
           <result property="vdef9" column="VDEF9" jdbcType="VARCHAR"/>
           <result property="veditreason" column="VEDITREASON" jdbcType="VARCHAR"/>
           <result property="veinvcode" column="VEINVCODE" jdbcType="VARCHAR"/>
           <result property="veinvfailnote" column="VEINVFAILNOTE" jdbcType="VARCHAR"/>
           <result property="veinvnumber" column="VEINVNUMBER" jdbcType="VARCHAR"/>
           <result property="vnote" column="VNOTE" jdbcType="VARCHAR"/>
           <result property="vprintcustname" column="VPRINTCUSTNAME" jdbcType="VARCHAR"/>
           <result property="vreceiptcode" column="VRECEIPTCODE" jdbcType="VARCHAR"/>
           <result property="vreceiveaddress" column="VRECEIVEADDRESS" jdbcType="VARCHAR"/>
           <result property="vredflushcause" column="VREDFLUSHCAUSE" jdbcType="VARCHAR"/>
           <result property="vredletterinfo" column="VREDLETTERINFO" jdbcType="VARCHAR"/>
           <result property="vsplitrecord" column="VSPLITRECORD" jdbcType="VARCHAR"/>
           <result property="vsrceinvcode" column="VSRCEINVCODE" jdbcType="VARCHAR"/>
           <result property="vsrceinvnumber" column="VSRCEINVNUMBER" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "SoSaleinvoiceEntity_Base_Column_List">
        BFREECUSTFLAG
       ,BINITFLAG 
        ,BTOGOLDTAX 
        ,CAPPROVEID 
        ,CBIZTYPE 
        ,CCALBODYID 
        ,CCREDITNUM 
        ,CCUSTBANKID 
        ,CDEPTID 
        ,CDISPATCHERID 
        ,CEMPLOYEEID 
        ,CFREECUSTID 
        ,CGOLDTAXCODE 
        ,COPERATORID 
        ,CRECEIPTCORPID 
        ,CRECEIPTCUSTOMERID 
        ,CRECEIPTTYPE 
        ,CSALECORPID 
        ,CSALEID 
        ,CTERMPROTOCOLID 
        ,CTRANSMODEID 
        ,CWAREHOUSEID 
        ,DAPPROVEDATE 
        ,DAUDITTIME 
        ,DBILLDATE 
        ,DBILLTIME 
        ,DEINVDATE 
        ,DMAKEDATE 
        ,DMODITIME 
        ,DR 
        ,DTOGOLDTAXTIME 
        ,FCOUNTERACTFLAG 
        ,FEINVSTATUS 
        ,FINVOICECLASS 
        ,FINVOICETYPE 
        ,FSTATUS 
        ,IBALANCEFLAG 
        ,IPRINTCOUNT 
        ,NDISCOUNTRATE 
        ,NEVALUATECARRIAGE 
        ,NNETMNY 
        ,NSTRIKEMNY 
        ,NSUBSCRIPTION 
        ,NTOTALNUM 
        ,NTOTALSUMMNY 
        ,PK_CONNECTED 
        ,PK_CORP 
        ,PK_DEFDOC1 
        ,PK_DEFDOC10 
        ,PK_DEFDOC11 
        ,PK_DEFDOC12 
        ,PK_DEFDOC13 
        ,PK_DEFDOC14 
        ,PK_DEFDOC15 
        ,PK_DEFDOC16 
        ,PK_DEFDOC17 
        ,PK_DEFDOC18 
        ,PK_DEFDOC19 
        ,PK_DEFDOC2 
        ,PK_DEFDOC20 
        ,PK_DEFDOC3 
        ,PK_DEFDOC4 
        ,PK_DEFDOC5 
        ,PK_DEFDOC6 
        ,PK_DEFDOC7 
        ,PK_DEFDOC8 
        ,PK_DEFDOC9 
        ,TS 
        ,VACCOUNTYEAR 
        ,VDEF1 
        ,VDEF10 
        ,VDEF11 
        ,VDEF12 
        ,VDEF13 
        ,VDEF14 
        ,VDEF15 
        ,VDEF16 
        ,VDEF17 
        ,VDEF18 
        ,VDEF19 
        ,VDEF2 
        ,VDEF20 
        ,VDEF3 
        ,VDEF4 
        ,VDEF5 
        ,VDEF6 
        ,VDEF7 
        ,VDEF8 
        ,VDEF9 
        ,VEDITREASON 
        ,VEINVCODE 
        ,VEINVFAILNOTE 
        ,VEINVNUMBER 
        ,VNOTE 
        ,VPRINTCUSTNAME 
        ,VRECEIPTCODE 
        ,VRECEIVEADDRESS 
        ,VREDFLUSHCAUSE 
        ,VREDLETTERINFO 
        ,VSPLITRECORD 
        ,VSRCEINVCODE 
        ,VSRCEINVNUMBER 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-SoSaleinvoiceEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity">
    select
    <include refid="SoSaleinvoiceEntity_Base_Column_List" />
    from SO_SALEINVOICE
    <trim prefix="where" prefixOverrides="and"> 
        <if test="bfreecustflag != null and bfreecustflag != ''"> and BFREECUSTFLAG = #{bfreecustflag} </if>
            <if test="binitflag != null and binitflag != ''"> and BINITFLAG = #{binitflag} </if>
            <if test="btogoldtax != null and btogoldtax != ''"> and BTOGOLDTAX = #{btogoldtax} </if>
            <if test="capproveid != null and capproveid != ''"> and CAPPROVEID = #{capproveid} </if>
            <if test="cbiztype != null and cbiztype != ''"> and CBIZTYPE = #{cbiztype} </if>
            <if test="ccalbodyid != null and ccalbodyid != ''"> and CCALBODYID = #{ccalbodyid} </if>
            <if test="ccreditnum != null and ccreditnum != ''"> and CCREDITNUM = #{ccreditnum} </if>
            <if test="ccustbankid != null and ccustbankid != ''"> and CCUSTBANKID = #{ccustbankid} </if>
            <if test="cdeptid != null and cdeptid != ''"> and CDEPTID = #{cdeptid} </if>
            <if test="cdispatcherid != null and cdispatcherid != ''"> and CDISPATCHERID = #{cdispatcherid} </if>
            <if test="cemployeeid != null and cemployeeid != ''"> and CEMPLOYEEID = #{cemployeeid} </if>
            <if test="cfreecustid != null and cfreecustid != ''"> and CFREECUSTID = #{cfreecustid} </if>
            <if test="cgoldtaxcode != null and cgoldtaxcode != ''"> and CGOLDTAXCODE = #{cgoldtaxcode} </if>
            <if test="coperatorid != null and coperatorid != ''"> and COPERATORID = #{coperatorid} </if>
            <if test="creceiptcorpid != null and creceiptcorpid != ''"> and CRECEIPTCORPID = #{creceiptcorpid} </if>
            <if test="creceiptcustomerid != null and creceiptcustomerid != ''"> and CRECEIPTCUSTOMERID = #{creceiptcustomerid} </if>
            <if test="creceipttype != null and creceipttype != ''"> and CRECEIPTTYPE = #{creceipttype} </if>
            <if test="csalecorpid != null and csalecorpid != ''"> and CSALECORPID = #{csalecorpid} </if>
            <if test="csaleid != null and csaleid != ''"> and CSALEID = #{csaleid} </if>
            <if test="ctermprotocolid != null and ctermprotocolid != ''"> and CTERMPROTOCOLID = #{ctermprotocolid} </if>
            <if test="ctransmodeid != null and ctransmodeid != ''"> and CTRANSMODEID = #{ctransmodeid} </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> and CWAREHOUSEID = #{cwarehouseid} </if>
            <if test="dapprovedate != null and dapprovedate != ''"> and DAPPROVEDATE = #{dapprovedate} </if>
            <if test="daudittime != null and daudittime != ''"> and DAUDITTIME = #{daudittime} </if>
            <if test="dbilldate != null and dbilldate != ''"> and DBILLDATE = #{dbilldate} </if>
            <if test="dbilltime != null and dbilltime != ''"> and DBILLTIME = #{dbilltime} </if>
            <if test="deinvdate != null and deinvdate != ''"> and DEINVDATE = #{deinvdate} </if>
            <if test="dmakedate != null and dmakedate != ''"> and DMAKEDATE = #{dmakedate} </if>
            <if test="dmoditime != null and dmoditime != ''"> and DMODITIME = #{dmoditime} </if>
            <if test="dr != null and dr != ''"> and DR = #{dr} </if>
            <if test="dtogoldtaxtime != null and dtogoldtaxtime != ''"> and DTOGOLDTAXTIME = #{dtogoldtaxtime} </if>
            <if test="fcounteractflag != null and fcounteractflag != ''"> and FCOUNTERACTFLAG = #{fcounteractflag} </if>
            <if test="feinvstatus != null and feinvstatus != ''"> and FEINVSTATUS = #{feinvstatus} </if>
            <if test="finvoiceclass != null and finvoiceclass != ''"> and FINVOICECLASS = #{finvoiceclass} </if>
            <if test="finvoicetype != null and finvoicetype != ''"> and FINVOICETYPE = #{finvoicetype} </if>
            <if test="fstatus != null and fstatus != ''"> and FSTATUS = #{fstatus} </if>
            <if test="ibalanceflag != null and ibalanceflag != ''"> and IBALANCEFLAG = #{ibalanceflag} </if>
            <if test="iprintcount != null and iprintcount != ''"> and IPRINTCOUNT = #{iprintcount} </if>
            <if test="ndiscountrate != null and ndiscountrate != ''"> and NDISCOUNTRATE = #{ndiscountrate} </if>
            <if test="nevaluatecarriage != null and nevaluatecarriage != ''"> and NEVALUATECARRIAGE = #{nevaluatecarriage} </if>
            <if test="nnetmny != null and nnetmny != ''"> and NNETMNY = #{nnetmny} </if>
            <if test="nstrikemny != null and nstrikemny != ''"> and NSTRIKEMNY = #{nstrikemny} </if>
            <if test="nsubscription != null and nsubscription != ''"> and NSUBSCRIPTION = #{nsubscription} </if>
            <if test="ntotalnum != null and ntotalnum != ''"> and NTOTALNUM = #{ntotalnum} </if>
            <if test="ntotalsummny != null and ntotalsummny != ''"> and NTOTALSUMMNY = #{ntotalsummny} </if>
            <if test="pkConnected != null and pkConnected != ''"> and PK_CONNECTED = #{pkConnected} </if>
            <if test="pkCorp != null and pkCorp != ''"> and PK_CORP = #{pkCorp} </if>
            <if test="pkDefdoc1 != null and pkDefdoc1 != ''"> and PK_DEFDOC1 = #{pkDefdoc1} </if>
            <if test="pkDefdoc10 != null and pkDefdoc10 != ''"> and PK_DEFDOC10 = #{pkDefdoc10} </if>
            <if test="pkDefdoc11 != null and pkDefdoc11 != ''"> and PK_DEFDOC11 = #{pkDefdoc11} </if>
            <if test="pkDefdoc12 != null and pkDefdoc12 != ''"> and PK_DEFDOC12 = #{pkDefdoc12} </if>
            <if test="pkDefdoc13 != null and pkDefdoc13 != ''"> and PK_DEFDOC13 = #{pkDefdoc13} </if>
            <if test="pkDefdoc14 != null and pkDefdoc14 != ''"> and PK_DEFDOC14 = #{pkDefdoc14} </if>
            <if test="pkDefdoc15 != null and pkDefdoc15 != ''"> and PK_DEFDOC15 = #{pkDefdoc15} </if>
            <if test="pkDefdoc16 != null and pkDefdoc16 != ''"> and PK_DEFDOC16 = #{pkDefdoc16} </if>
            <if test="pkDefdoc17 != null and pkDefdoc17 != ''"> and PK_DEFDOC17 = #{pkDefdoc17} </if>
            <if test="pkDefdoc18 != null and pkDefdoc18 != ''"> and PK_DEFDOC18 = #{pkDefdoc18} </if>
            <if test="pkDefdoc19 != null and pkDefdoc19 != ''"> and PK_DEFDOC19 = #{pkDefdoc19} </if>
            <if test="pkDefdoc2 != null and pkDefdoc2 != ''"> and PK_DEFDOC2 = #{pkDefdoc2} </if>
            <if test="pkDefdoc20 != null and pkDefdoc20 != ''"> and PK_DEFDOC20 = #{pkDefdoc20} </if>
            <if test="pkDefdoc3 != null and pkDefdoc3 != ''"> and PK_DEFDOC3 = #{pkDefdoc3} </if>
            <if test="pkDefdoc4 != null and pkDefdoc4 != ''"> and PK_DEFDOC4 = #{pkDefdoc4} </if>
            <if test="pkDefdoc5 != null and pkDefdoc5 != ''"> and PK_DEFDOC5 = #{pkDefdoc5} </if>
            <if test="pkDefdoc6 != null and pkDefdoc6 != ''"> and PK_DEFDOC6 = #{pkDefdoc6} </if>
            <if test="pkDefdoc7 != null and pkDefdoc7 != ''"> and PK_DEFDOC7 = #{pkDefdoc7} </if>
            <if test="pkDefdoc8 != null and pkDefdoc8 != ''"> and PK_DEFDOC8 = #{pkDefdoc8} </if>
            <if test="pkDefdoc9 != null and pkDefdoc9 != ''"> and PK_DEFDOC9 = #{pkDefdoc9} </if>
            <if test="ts != null and ts != ''"> and TS = #{ts} </if>
            <if test="vaccountyear != null and vaccountyear != ''"> and VACCOUNTYEAR = #{vaccountyear} </if>
            <if test="vdef1 != null and vdef1 != ''"> and VDEF1 = #{vdef1} </if>
            <if test="vdef10 != null and vdef10 != ''"> and VDEF10 = #{vdef10} </if>
            <if test="vdef11 != null and vdef11 != ''"> and VDEF11 = #{vdef11} </if>
            <if test="vdef12 != null and vdef12 != ''"> and VDEF12 = #{vdef12} </if>
            <if test="vdef13 != null and vdef13 != ''"> and VDEF13 = #{vdef13} </if>
            <if test="vdef14 != null and vdef14 != ''"> and VDEF14 = #{vdef14} </if>
            <if test="vdef15 != null and vdef15 != ''"> and VDEF15 = #{vdef15} </if>
            <if test="vdef16 != null and vdef16 != ''"> and VDEF16 = #{vdef16} </if>
            <if test="vdef17 != null and vdef17 != ''"> and VDEF17 = #{vdef17} </if>
            <if test="vdef18 != null and vdef18 != ''"> and VDEF18 = #{vdef18} </if>
            <if test="vdef19 != null and vdef19 != ''"> and VDEF19 = #{vdef19} </if>
            <if test="vdef2 != null and vdef2 != ''"> and VDEF2 = #{vdef2} </if>
            <if test="vdef20 != null and vdef20 != ''"> and VDEF20 = #{vdef20} </if>
            <if test="vdef3 != null and vdef3 != ''"> and VDEF3 = #{vdef3} </if>
            <if test="vdef4 != null and vdef4 != ''"> and VDEF4 = #{vdef4} </if>
            <if test="vdef5 != null and vdef5 != ''"> and VDEF5 = #{vdef5} </if>
            <if test="vdef6 != null and vdef6 != ''"> and VDEF6 = #{vdef6} </if>
            <if test="vdef7 != null and vdef7 != ''"> and VDEF7 = #{vdef7} </if>
            <if test="vdef8 != null and vdef8 != ''"> and VDEF8 = #{vdef8} </if>
            <if test="vdef9 != null and vdef9 != ''"> and VDEF9 = #{vdef9} </if>
            <if test="veditreason != null and veditreason != ''"> and VEDITREASON = #{veditreason} </if>
            <if test="veinvcode != null and veinvcode != ''"> and VEINVCODE = #{veinvcode} </if>
            <if test="veinvfailnote != null and veinvfailnote != ''"> and VEINVFAILNOTE = #{veinvfailnote} </if>
            <if test="veinvnumber != null and veinvnumber != ''"> and VEINVNUMBER = #{veinvnumber} </if>
            <if test="vnote != null and vnote != ''"> and VNOTE = #{vnote} </if>
            <if test="vprintcustname != null and vprintcustname != ''"> and VPRINTCUSTNAME = #{vprintcustname} </if>
            <if test="vreceiptcode != null and vreceiptcode != ''"> and VRECEIPTCODE = #{vreceiptcode} </if>
            <if test="vreceiveaddress != null and vreceiveaddress != ''"> and VRECEIVEADDRESS = #{vreceiveaddress} </if>
            <if test="vredflushcause != null and vredflushcause != ''"> and VREDFLUSHCAUSE = #{vredflushcause} </if>
            <if test="vredletterinfo != null and vredletterinfo != ''"> and VREDLETTERINFO = #{vredletterinfo} </if>
            <if test="vsplitrecord != null and vsplitrecord != ''"> and VSPLITRECORD = #{vsplitrecord} </if>
            <if test="vsrceinvcode != null and vsrceinvcode != ''"> and VSRCEINVCODE = #{vsrceinvcode} </if>
            <if test="vsrceinvnumber != null and vsrceinvnumber != ''"> and VSRCEINVNUMBER = #{vsrceinvnumber} </if>
--             and sts='Y'
    </trim>
<!--    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
<!--    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>-->
</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity">
        select  count(1)   from SO_SALEINVOICE
    <trim prefix="where" prefixOverrides="and"> 
        <if test="bfreecustflag != null and bfreecustflag != ''"> and BFREECUSTFLAG = #{bfreecustflag} </if>
            <if test="binitflag != null and binitflag != ''"> and BINITFLAG = #{binitflag} </if>
            <if test="btogoldtax != null and btogoldtax != ''"> and BTOGOLDTAX = #{btogoldtax} </if>
            <if test="capproveid != null and capproveid != ''"> and CAPPROVEID = #{capproveid} </if>
            <if test="cbiztype != null and cbiztype != ''"> and CBIZTYPE = #{cbiztype} </if>
            <if test="ccalbodyid != null and ccalbodyid != ''"> and CCALBODYID = #{ccalbodyid} </if>
            <if test="ccreditnum != null and ccreditnum != ''"> and CCREDITNUM = #{ccreditnum} </if>
            <if test="ccustbankid != null and ccustbankid != ''"> and CCUSTBANKID = #{ccustbankid} </if>
            <if test="cdeptid != null and cdeptid != ''"> and CDEPTID = #{cdeptid} </if>
            <if test="cdispatcherid != null and cdispatcherid != ''"> and CDISPATCHERID = #{cdispatcherid} </if>
            <if test="cemployeeid != null and cemployeeid != ''"> and CEMPLOYEEID = #{cemployeeid} </if>
            <if test="cfreecustid != null and cfreecustid != ''"> and CFREECUSTID = #{cfreecustid} </if>
            <if test="cgoldtaxcode != null and cgoldtaxcode != ''"> and CGOLDTAXCODE = #{cgoldtaxcode} </if>
            <if test="coperatorid != null and coperatorid != ''"> and COPERATORID = #{coperatorid} </if>
            <if test="creceiptcorpid != null and creceiptcorpid != ''"> and CRECEIPTCORPID = #{creceiptcorpid} </if>
            <if test="creceiptcustomerid != null and creceiptcustomerid != ''"> and CRECEIPTCUSTOMERID = #{creceiptcustomerid} </if>
            <if test="creceipttype != null and creceipttype != ''"> and CRECEIPTTYPE = #{creceipttype} </if>
            <if test="csalecorpid != null and csalecorpid != ''"> and CSALECORPID = #{csalecorpid} </if>
            <if test="csaleid != null and csaleid != ''"> and CSALEID = #{csaleid} </if>
            <if test="ctermprotocolid != null and ctermprotocolid != ''"> and CTERMPROTOCOLID = #{ctermprotocolid} </if>
            <if test="ctransmodeid != null and ctransmodeid != ''"> and CTRANSMODEID = #{ctransmodeid} </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> and CWAREHOUSEID = #{cwarehouseid} </if>
            <if test="dapprovedate != null and dapprovedate != ''"> and DAPPROVEDATE = #{dapprovedate} </if>
            <if test="daudittime != null and daudittime != ''"> and DAUDITTIME = #{daudittime} </if>
            <if test="dbilldate != null and dbilldate != ''"> and DBILLDATE = #{dbilldate} </if>
            <if test="dbilltime != null and dbilltime != ''"> and DBILLTIME = #{dbilltime} </if>
            <if test="deinvdate != null and deinvdate != ''"> and DEINVDATE = #{deinvdate} </if>
            <if test="dmakedate != null and dmakedate != ''"> and DMAKEDATE = #{dmakedate} </if>
            <if test="dmoditime != null and dmoditime != ''"> and DMODITIME = #{dmoditime} </if>
            <if test="dr != null and dr != ''"> and DR = #{dr} </if>
            <if test="dtogoldtaxtime != null and dtogoldtaxtime != ''"> and DTOGOLDTAXTIME = #{dtogoldtaxtime} </if>
            <if test="fcounteractflag != null and fcounteractflag != ''"> and FCOUNTERACTFLAG = #{fcounteractflag} </if>
            <if test="feinvstatus != null and feinvstatus != ''"> and FEINVSTATUS = #{feinvstatus} </if>
            <if test="finvoiceclass != null and finvoiceclass != ''"> and FINVOICECLASS = #{finvoiceclass} </if>
            <if test="finvoicetype != null and finvoicetype != ''"> and FINVOICETYPE = #{finvoicetype} </if>
            <if test="fstatus != null and fstatus != ''"> and FSTATUS = #{fstatus} </if>
            <if test="ibalanceflag != null and ibalanceflag != ''"> and IBALANCEFLAG = #{ibalanceflag} </if>
            <if test="iprintcount != null and iprintcount != ''"> and IPRINTCOUNT = #{iprintcount} </if>
            <if test="ndiscountrate != null and ndiscountrate != ''"> and NDISCOUNTRATE = #{ndiscountrate} </if>
            <if test="nevaluatecarriage != null and nevaluatecarriage != ''"> and NEVALUATECARRIAGE = #{nevaluatecarriage} </if>
            <if test="nnetmny != null and nnetmny != ''"> and NNETMNY = #{nnetmny} </if>
            <if test="nstrikemny != null and nstrikemny != ''"> and NSTRIKEMNY = #{nstrikemny} </if>
            <if test="nsubscription != null and nsubscription != ''"> and NSUBSCRIPTION = #{nsubscription} </if>
            <if test="ntotalnum != null and ntotalnum != ''"> and NTOTALNUM = #{ntotalnum} </if>
            <if test="ntotalsummny != null and ntotalsummny != ''"> and NTOTALSUMMNY = #{ntotalsummny} </if>
            <if test="pkConnected != null and pkConnected != ''"> and PK_CONNECTED = #{pkConnected} </if>
            <if test="pkCorp != null and pkCorp != ''"> and PK_CORP = #{pkCorp} </if>
            <if test="pkDefdoc1 != null and pkDefdoc1 != ''"> and PK_DEFDOC1 = #{pkDefdoc1} </if>
            <if test="pkDefdoc10 != null and pkDefdoc10 != ''"> and PK_DEFDOC10 = #{pkDefdoc10} </if>
            <if test="pkDefdoc11 != null and pkDefdoc11 != ''"> and PK_DEFDOC11 = #{pkDefdoc11} </if>
            <if test="pkDefdoc12 != null and pkDefdoc12 != ''"> and PK_DEFDOC12 = #{pkDefdoc12} </if>
            <if test="pkDefdoc13 != null and pkDefdoc13 != ''"> and PK_DEFDOC13 = #{pkDefdoc13} </if>
            <if test="pkDefdoc14 != null and pkDefdoc14 != ''"> and PK_DEFDOC14 = #{pkDefdoc14} </if>
            <if test="pkDefdoc15 != null and pkDefdoc15 != ''"> and PK_DEFDOC15 = #{pkDefdoc15} </if>
            <if test="pkDefdoc16 != null and pkDefdoc16 != ''"> and PK_DEFDOC16 = #{pkDefdoc16} </if>
            <if test="pkDefdoc17 != null and pkDefdoc17 != ''"> and PK_DEFDOC17 = #{pkDefdoc17} </if>
            <if test="pkDefdoc18 != null and pkDefdoc18 != ''"> and PK_DEFDOC18 = #{pkDefdoc18} </if>
            <if test="pkDefdoc19 != null and pkDefdoc19 != ''"> and PK_DEFDOC19 = #{pkDefdoc19} </if>
            <if test="pkDefdoc2 != null and pkDefdoc2 != ''"> and PK_DEFDOC2 = #{pkDefdoc2} </if>
            <if test="pkDefdoc20 != null and pkDefdoc20 != ''"> and PK_DEFDOC20 = #{pkDefdoc20} </if>
            <if test="pkDefdoc3 != null and pkDefdoc3 != ''"> and PK_DEFDOC3 = #{pkDefdoc3} </if>
            <if test="pkDefdoc4 != null and pkDefdoc4 != ''"> and PK_DEFDOC4 = #{pkDefdoc4} </if>
            <if test="pkDefdoc5 != null and pkDefdoc5 != ''"> and PK_DEFDOC5 = #{pkDefdoc5} </if>
            <if test="pkDefdoc6 != null and pkDefdoc6 != ''"> and PK_DEFDOC6 = #{pkDefdoc6} </if>
            <if test="pkDefdoc7 != null and pkDefdoc7 != ''"> and PK_DEFDOC7 = #{pkDefdoc7} </if>
            <if test="pkDefdoc8 != null and pkDefdoc8 != ''"> and PK_DEFDOC8 = #{pkDefdoc8} </if>
            <if test="pkDefdoc9 != null and pkDefdoc9 != ''"> and PK_DEFDOC9 = #{pkDefdoc9} </if>
            <if test="ts != null and ts != ''"> and TS = #{ts} </if>
            <if test="vaccountyear != null and vaccountyear != ''"> and VACCOUNTYEAR = #{vaccountyear} </if>
            <if test="vdef1 != null and vdef1 != ''"> and VDEF1 = #{vdef1} </if>
            <if test="vdef10 != null and vdef10 != ''"> and VDEF10 = #{vdef10} </if>
            <if test="vdef11 != null and vdef11 != ''"> and VDEF11 = #{vdef11} </if>
            <if test="vdef12 != null and vdef12 != ''"> and VDEF12 = #{vdef12} </if>
            <if test="vdef13 != null and vdef13 != ''"> and VDEF13 = #{vdef13} </if>
            <if test="vdef14 != null and vdef14 != ''"> and VDEF14 = #{vdef14} </if>
            <if test="vdef15 != null and vdef15 != ''"> and VDEF15 = #{vdef15} </if>
            <if test="vdef16 != null and vdef16 != ''"> and VDEF16 = #{vdef16} </if>
            <if test="vdef17 != null and vdef17 != ''"> and VDEF17 = #{vdef17} </if>
            <if test="vdef18 != null and vdef18 != ''"> and VDEF18 = #{vdef18} </if>
            <if test="vdef19 != null and vdef19 != ''"> and VDEF19 = #{vdef19} </if>
            <if test="vdef2 != null and vdef2 != ''"> and VDEF2 = #{vdef2} </if>
            <if test="vdef20 != null and vdef20 != ''"> and VDEF20 = #{vdef20} </if>
            <if test="vdef3 != null and vdef3 != ''"> and VDEF3 = #{vdef3} </if>
            <if test="vdef4 != null and vdef4 != ''"> and VDEF4 = #{vdef4} </if>
            <if test="vdef5 != null and vdef5 != ''"> and VDEF5 = #{vdef5} </if>
            <if test="vdef6 != null and vdef6 != ''"> and VDEF6 = #{vdef6} </if>
            <if test="vdef7 != null and vdef7 != ''"> and VDEF7 = #{vdef7} </if>
            <if test="vdef8 != null and vdef8 != ''"> and VDEF8 = #{vdef8} </if>
            <if test="vdef9 != null and vdef9 != ''"> and VDEF9 = #{vdef9} </if>
            <if test="veditreason != null and veditreason != ''"> and VEDITREASON = #{veditreason} </if>
            <if test="veinvcode != null and veinvcode != ''"> and VEINVCODE = #{veinvcode} </if>
            <if test="veinvfailnote != null and veinvfailnote != ''"> and VEINVFAILNOTE = #{veinvfailnote} </if>
            <if test="veinvnumber != null and veinvnumber != ''"> and VEINVNUMBER = #{veinvnumber} </if>
            <if test="vnote != null and vnote != ''"> and VNOTE = #{vnote} </if>
            <if test="vprintcustname != null and vprintcustname != ''"> and VPRINTCUSTNAME = #{vprintcustname} </if>
            <if test="vreceiptcode != null and vreceiptcode != ''"> and VRECEIPTCODE = #{vreceiptcode} </if>
            <if test="vreceiveaddress != null and vreceiveaddress != ''"> and VRECEIVEADDRESS = #{vreceiveaddress} </if>
            <if test="vredflushcause != null and vredflushcause != ''"> and VREDFLUSHCAUSE = #{vredflushcause} </if>
            <if test="vredletterinfo != null and vredletterinfo != ''"> and VREDLETTERINFO = #{vredletterinfo} </if>
            <if test="vsplitrecord != null and vsplitrecord != ''"> and VSPLITRECORD = #{vsplitrecord} </if>
            <if test="vsrceinvcode != null and vsrceinvcode != ''"> and VSRCEINVCODE = #{vsrceinvcode} </if>
            <if test="vsrceinvnumber != null and vsrceinvnumber != ''"> and VSRCEINVNUMBER = #{vsrceinvnumber} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-SoSaleinvoiceEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity">
    select
    <include refid="SoSaleinvoiceEntity_Base_Column_List" />
    from SO_SALEINVOICE
    <trim prefix="where" prefixOverrides="and"> 
        <if test="bfreecustflag != null and bfreecustflag != ''"> and BFREECUSTFLAG like concat('%',#{bfreecustflag},'%') </if>
            <if test="binitflag != null and binitflag != ''"> and BINITFLAG like concat('%',#{binitflag},'%') </if>
            <if test="btogoldtax != null and btogoldtax != ''"> and BTOGOLDTAX like concat('%',#{btogoldtax},'%') </if>
            <if test="capproveid != null and capproveid != ''"> and CAPPROVEID like concat('%',#{capproveid},'%') </if>
            <if test="cbiztype != null and cbiztype != ''"> and CBIZTYPE like concat('%',#{cbiztype},'%') </if>
            <if test="ccalbodyid != null and ccalbodyid != ''"> and CCALBODYID like concat('%',#{ccalbodyid},'%') </if>
            <if test="ccreditnum != null and ccreditnum != ''"> and CCREDITNUM like concat('%',#{ccreditnum},'%') </if>
            <if test="ccustbankid != null and ccustbankid != ''"> and CCUSTBANKID like concat('%',#{ccustbankid},'%') </if>
            <if test="cdeptid != null and cdeptid != ''"> and CDEPTID like concat('%',#{cdeptid},'%') </if>
            <if test="cdispatcherid != null and cdispatcherid != ''"> and CDISPATCHERID like concat('%',#{cdispatcherid},'%') </if>
            <if test="cemployeeid != null and cemployeeid != ''"> and CEMPLOYEEID like concat('%',#{cemployeeid},'%') </if>
            <if test="cfreecustid != null and cfreecustid != ''"> and CFREECUSTID like concat('%',#{cfreecustid},'%') </if>
            <if test="cgoldtaxcode != null and cgoldtaxcode != ''"> and CGOLDTAXCODE like concat('%',#{cgoldtaxcode},'%') </if>
            <if test="coperatorid != null and coperatorid != ''"> and COPERATORID like concat('%',#{coperatorid},'%') </if>
            <if test="creceiptcorpid != null and creceiptcorpid != ''"> and CRECEIPTCORPID like concat('%',#{creceiptcorpid},'%') </if>
            <if test="creceiptcustomerid != null and creceiptcustomerid != ''"> and CRECEIPTCUSTOMERID like concat('%',#{creceiptcustomerid},'%') </if>
            <if test="creceipttype != null and creceipttype != ''"> and CRECEIPTTYPE like concat('%',#{creceipttype},'%') </if>
            <if test="csalecorpid != null and csalecorpid != ''"> and CSALECORPID like concat('%',#{csalecorpid},'%') </if>
            <if test="csaleid != null and csaleid != ''"> and CSALEID like concat('%',#{csaleid},'%') </if>
            <if test="ctermprotocolid != null and ctermprotocolid != ''"> and CTERMPROTOCOLID like concat('%',#{ctermprotocolid},'%') </if>
            <if test="ctransmodeid != null and ctransmodeid != ''"> and CTRANSMODEID like concat('%',#{ctransmodeid},'%') </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> and CWAREHOUSEID like concat('%',#{cwarehouseid},'%') </if>
            <if test="dapprovedate != null and dapprovedate != ''"> and DAPPROVEDATE like concat('%',#{dapprovedate},'%') </if>
            <if test="daudittime != null and daudittime != ''"> and DAUDITTIME like concat('%',#{daudittime},'%') </if>
            <if test="dbilldate != null and dbilldate != ''"> and DBILLDATE like concat('%',#{dbilldate},'%') </if>
            <if test="dbilltime != null and dbilltime != ''"> and DBILLTIME like concat('%',#{dbilltime},'%') </if>
            <if test="deinvdate != null and deinvdate != ''"> and DEINVDATE like concat('%',#{deinvdate},'%') </if>
            <if test="dmakedate != null and dmakedate != ''"> and DMAKEDATE like concat('%',#{dmakedate},'%') </if>
            <if test="dmoditime != null and dmoditime != ''"> and DMODITIME like concat('%',#{dmoditime},'%') </if>
            <if test="dr != null and dr != ''"> and DR like concat('%',#{dr},'%') </if>
            <if test="dtogoldtaxtime != null and dtogoldtaxtime != ''"> and DTOGOLDTAXTIME like concat('%',#{dtogoldtaxtime},'%') </if>
            <if test="fcounteractflag != null and fcounteractflag != ''"> and FCOUNTERACTFLAG like concat('%',#{fcounteractflag},'%') </if>
            <if test="feinvstatus != null and feinvstatus != ''"> and FEINVSTATUS like concat('%',#{feinvstatus},'%') </if>
            <if test="finvoiceclass != null and finvoiceclass != ''"> and FINVOICECLASS like concat('%',#{finvoiceclass},'%') </if>
            <if test="finvoicetype != null and finvoicetype != ''"> and FINVOICETYPE like concat('%',#{finvoicetype},'%') </if>
            <if test="fstatus != null and fstatus != ''"> and FSTATUS like concat('%',#{fstatus},'%') </if>
            <if test="ibalanceflag != null and ibalanceflag != ''"> and IBALANCEFLAG like concat('%',#{ibalanceflag},'%') </if>
            <if test="iprintcount != null and iprintcount != ''"> and IPRINTCOUNT like concat('%',#{iprintcount},'%') </if>
            <if test="ndiscountrate != null and ndiscountrate != ''"> and NDISCOUNTRATE like concat('%',#{ndiscountrate},'%') </if>
            <if test="nevaluatecarriage != null and nevaluatecarriage != ''"> and NEVALUATECARRIAGE like concat('%',#{nevaluatecarriage},'%') </if>
            <if test="nnetmny != null and nnetmny != ''"> and NNETMNY like concat('%',#{nnetmny},'%') </if>
            <if test="nstrikemny != null and nstrikemny != ''"> and NSTRIKEMNY like concat('%',#{nstrikemny},'%') </if>
            <if test="nsubscription != null and nsubscription != ''"> and NSUBSCRIPTION like concat('%',#{nsubscription},'%') </if>
            <if test="ntotalnum != null and ntotalnum != ''"> and NTOTALNUM like concat('%',#{ntotalnum},'%') </if>
            <if test="ntotalsummny != null and ntotalsummny != ''"> and NTOTALSUMMNY like concat('%',#{ntotalsummny},'%') </if>
            <if test="pkConnected != null and pkConnected != ''"> and PK_CONNECTED like concat('%',#{pkConnected},'%') </if>
            <if test="pkCorp != null and pkCorp != ''"> and PK_CORP like concat('%',#{pkCorp},'%') </if>
            <if test="pkDefdoc1 != null and pkDefdoc1 != ''"> and PK_DEFDOC1 like concat('%',#{pkDefdoc1},'%') </if>
            <if test="pkDefdoc10 != null and pkDefdoc10 != ''"> and PK_DEFDOC10 like concat('%',#{pkDefdoc10},'%') </if>
            <if test="pkDefdoc11 != null and pkDefdoc11 != ''"> and PK_DEFDOC11 like concat('%',#{pkDefdoc11},'%') </if>
            <if test="pkDefdoc12 != null and pkDefdoc12 != ''"> and PK_DEFDOC12 like concat('%',#{pkDefdoc12},'%') </if>
            <if test="pkDefdoc13 != null and pkDefdoc13 != ''"> and PK_DEFDOC13 like concat('%',#{pkDefdoc13},'%') </if>
            <if test="pkDefdoc14 != null and pkDefdoc14 != ''"> and PK_DEFDOC14 like concat('%',#{pkDefdoc14},'%') </if>
            <if test="pkDefdoc15 != null and pkDefdoc15 != ''"> and PK_DEFDOC15 like concat('%',#{pkDefdoc15},'%') </if>
            <if test="pkDefdoc16 != null and pkDefdoc16 != ''"> and PK_DEFDOC16 like concat('%',#{pkDefdoc16},'%') </if>
            <if test="pkDefdoc17 != null and pkDefdoc17 != ''"> and PK_DEFDOC17 like concat('%',#{pkDefdoc17},'%') </if>
            <if test="pkDefdoc18 != null and pkDefdoc18 != ''"> and PK_DEFDOC18 like concat('%',#{pkDefdoc18},'%') </if>
            <if test="pkDefdoc19 != null and pkDefdoc19 != ''"> and PK_DEFDOC19 like concat('%',#{pkDefdoc19},'%') </if>
            <if test="pkDefdoc2 != null and pkDefdoc2 != ''"> and PK_DEFDOC2 like concat('%',#{pkDefdoc2},'%') </if>
            <if test="pkDefdoc20 != null and pkDefdoc20 != ''"> and PK_DEFDOC20 like concat('%',#{pkDefdoc20},'%') </if>
            <if test="pkDefdoc3 != null and pkDefdoc3 != ''"> and PK_DEFDOC3 like concat('%',#{pkDefdoc3},'%') </if>
            <if test="pkDefdoc4 != null and pkDefdoc4 != ''"> and PK_DEFDOC4 like concat('%',#{pkDefdoc4},'%') </if>
            <if test="pkDefdoc5 != null and pkDefdoc5 != ''"> and PK_DEFDOC5 like concat('%',#{pkDefdoc5},'%') </if>
            <if test="pkDefdoc6 != null and pkDefdoc6 != ''"> and PK_DEFDOC6 like concat('%',#{pkDefdoc6},'%') </if>
            <if test="pkDefdoc7 != null and pkDefdoc7 != ''"> and PK_DEFDOC7 like concat('%',#{pkDefdoc7},'%') </if>
            <if test="pkDefdoc8 != null and pkDefdoc8 != ''"> and PK_DEFDOC8 like concat('%',#{pkDefdoc8},'%') </if>
            <if test="pkDefdoc9 != null and pkDefdoc9 != ''"> and PK_DEFDOC9 like concat('%',#{pkDefdoc9},'%') </if>
            <if test="ts != null and ts != ''"> and TS like concat('%',#{ts},'%') </if>
            <if test="vaccountyear != null and vaccountyear != ''"> and VACCOUNTYEAR like concat('%',#{vaccountyear},'%') </if>
            <if test="vdef1 != null and vdef1 != ''"> and VDEF1 like concat('%',#{vdef1},'%') </if>
            <if test="vdef10 != null and vdef10 != ''"> and VDEF10 like concat('%',#{vdef10},'%') </if>
            <if test="vdef11 != null and vdef11 != ''"> and VDEF11 like concat('%',#{vdef11},'%') </if>
            <if test="vdef12 != null and vdef12 != ''"> and VDEF12 like concat('%',#{vdef12},'%') </if>
            <if test="vdef13 != null and vdef13 != ''"> and VDEF13 like concat('%',#{vdef13},'%') </if>
            <if test="vdef14 != null and vdef14 != ''"> and VDEF14 like concat('%',#{vdef14},'%') </if>
            <if test="vdef15 != null and vdef15 != ''"> and VDEF15 like concat('%',#{vdef15},'%') </if>
            <if test="vdef16 != null and vdef16 != ''"> and VDEF16 like concat('%',#{vdef16},'%') </if>
            <if test="vdef17 != null and vdef17 != ''"> and VDEF17 like concat('%',#{vdef17},'%') </if>
            <if test="vdef18 != null and vdef18 != ''"> and VDEF18 like concat('%',#{vdef18},'%') </if>
            <if test="vdef19 != null and vdef19 != ''"> and VDEF19 like concat('%',#{vdef19},'%') </if>
            <if test="vdef2 != null and vdef2 != ''"> and VDEF2 like concat('%',#{vdef2},'%') </if>
            <if test="vdef20 != null and vdef20 != ''"> and VDEF20 like concat('%',#{vdef20},'%') </if>
            <if test="vdef3 != null and vdef3 != ''"> and VDEF3 like concat('%',#{vdef3},'%') </if>
            <if test="vdef4 != null and vdef4 != ''"> and VDEF4 like concat('%',#{vdef4},'%') </if>
            <if test="vdef5 != null and vdef5 != ''"> and VDEF5 like concat('%',#{vdef5},'%') </if>
            <if test="vdef6 != null and vdef6 != ''"> and VDEF6 like concat('%',#{vdef6},'%') </if>
            <if test="vdef7 != null and vdef7 != ''"> and VDEF7 like concat('%',#{vdef7},'%') </if>
            <if test="vdef8 != null and vdef8 != ''"> and VDEF8 like concat('%',#{vdef8},'%') </if>
            <if test="vdef9 != null and vdef9 != ''"> and VDEF9 like concat('%',#{vdef9},'%') </if>
            <if test="veditreason != null and veditreason != ''"> and VEDITREASON like concat('%',#{veditreason},'%') </if>
            <if test="veinvcode != null and veinvcode != ''"> and VEINVCODE like concat('%',#{veinvcode},'%') </if>
            <if test="veinvfailnote != null and veinvfailnote != ''"> and VEINVFAILNOTE like concat('%',#{veinvfailnote},'%') </if>
            <if test="veinvnumber != null and veinvnumber != ''"> and VEINVNUMBER like concat('%',#{veinvnumber},'%') </if>
            <if test="vnote != null and vnote != ''"> and VNOTE like concat('%',#{vnote},'%') </if>
            <if test="vprintcustname != null and vprintcustname != ''"> and VPRINTCUSTNAME like concat('%',#{vprintcustname},'%') </if>
            <if test="vreceiptcode != null and vreceiptcode != ''"> and VRECEIPTCODE like concat('%',#{vreceiptcode},'%') </if>
            <if test="vreceiveaddress != null and vreceiveaddress != ''"> and VRECEIVEADDRESS like concat('%',#{vreceiveaddress},'%') </if>
            <if test="vredflushcause != null and vredflushcause != ''"> and VREDFLUSHCAUSE like concat('%',#{vredflushcause},'%') </if>
            <if test="vredletterinfo != null and vredletterinfo != ''"> and VREDLETTERINFO like concat('%',#{vredletterinfo},'%') </if>
            <if test="vsplitrecord != null and vsplitrecord != ''"> and VSPLITRECORD like concat('%',#{vsplitrecord},'%') </if>
            <if test="vsrceinvcode != null and vsrceinvcode != ''"> and VSRCEINVCODE like concat('%',#{vsrceinvcode},'%') </if>
            <if test="vsrceinvnumber != null and vsrceinvnumber != ''"> and VSRCEINVNUMBER like concat('%',#{vsrceinvnumber},'%') </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="SoSaleinvoiceentity_list_or" resultMap="get-SoSaleinvoiceEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity">
    select
    <include refid="SoSaleinvoiceEntity_Base_Column_List" />
    from SO_SALEINVOICE
    <trim prefix="where" prefixOverrides="and"> 
         <if test="bfreecustflag != null and bfreecustflag != ''"> or BFREECUSTFLAG = #{bfreecustflag} </if>
             <if test="binitflag != null and binitflag != ''"> or BINITFLAG = #{binitflag} </if>
             <if test="btogoldtax != null and btogoldtax != ''"> or BTOGOLDTAX = #{btogoldtax} </if>
             <if test="capproveid != null and capproveid != ''"> or CAPPROVEID = #{capproveid} </if>
             <if test="cbiztype != null and cbiztype != ''"> or CBIZTYPE = #{cbiztype} </if>
             <if test="ccalbodyid != null and ccalbodyid != ''"> or CCALBODYID = #{ccalbodyid} </if>
             <if test="ccreditnum != null and ccreditnum != ''"> or CCREDITNUM = #{ccreditnum} </if>
             <if test="ccustbankid != null and ccustbankid != ''"> or CCUSTBANKID = #{ccustbankid} </if>
             <if test="cdeptid != null and cdeptid != ''"> or CDEPTID = #{cdeptid} </if>
             <if test="cdispatcherid != null and cdispatcherid != ''"> or CDISPATCHERID = #{cdispatcherid} </if>
             <if test="cemployeeid != null and cemployeeid != ''"> or CEMPLOYEEID = #{cemployeeid} </if>
             <if test="cfreecustid != null and cfreecustid != ''"> or CFREECUSTID = #{cfreecustid} </if>
             <if test="cgoldtaxcode != null and cgoldtaxcode != ''"> or CGOLDTAXCODE = #{cgoldtaxcode} </if>
             <if test="coperatorid != null and coperatorid != ''"> or COPERATORID = #{coperatorid} </if>
             <if test="creceiptcorpid != null and creceiptcorpid != ''"> or CRECEIPTCORPID = #{creceiptcorpid} </if>
             <if test="creceiptcustomerid != null and creceiptcustomerid != ''"> or CRECEIPTCUSTOMERID = #{creceiptcustomerid} </if>
             <if test="creceipttype != null and creceipttype != ''"> or CRECEIPTTYPE = #{creceipttype} </if>
             <if test="csalecorpid != null and csalecorpid != ''"> or CSALECORPID = #{csalecorpid} </if>
             <if test="csaleid != null and csaleid != ''"> or CSALEID = #{csaleid} </if>
             <if test="ctermprotocolid != null and ctermprotocolid != ''"> or CTERMPROTOCOLID = #{ctermprotocolid} </if>
             <if test="ctransmodeid != null and ctransmodeid != ''"> or CTRANSMODEID = #{ctransmodeid} </if>
             <if test="cwarehouseid != null and cwarehouseid != ''"> or CWAREHOUSEID = #{cwarehouseid} </if>
             <if test="dapprovedate != null and dapprovedate != ''"> or DAPPROVEDATE = #{dapprovedate} </if>
             <if test="daudittime != null and daudittime != ''"> or DAUDITTIME = #{daudittime} </if>
             <if test="dbilldate != null and dbilldate != ''"> or DBILLDATE = #{dbilldate} </if>
             <if test="dbilltime != null and dbilltime != ''"> or DBILLTIME = #{dbilltime} </if>
             <if test="deinvdate != null and deinvdate != ''"> or DEINVDATE = #{deinvdate} </if>
             <if test="dmakedate != null and dmakedate != ''"> or DMAKEDATE = #{dmakedate} </if>
             <if test="dmoditime != null and dmoditime != ''"> or DMODITIME = #{dmoditime} </if>
             <if test="dr != null and dr != ''"> or DR = #{dr} </if>
             <if test="dtogoldtaxtime != null and dtogoldtaxtime != ''"> or DTOGOLDTAXTIME = #{dtogoldtaxtime} </if>
             <if test="fcounteractflag != null and fcounteractflag != ''"> or FCOUNTERACTFLAG = #{fcounteractflag} </if>
             <if test="feinvstatus != null and feinvstatus != ''"> or FEINVSTATUS = #{feinvstatus} </if>
             <if test="finvoiceclass != null and finvoiceclass != ''"> or FINVOICECLASS = #{finvoiceclass} </if>
             <if test="finvoicetype != null and finvoicetype != ''"> or FINVOICETYPE = #{finvoicetype} </if>
             <if test="fstatus != null and fstatus != ''"> or FSTATUS = #{fstatus} </if>
             <if test="ibalanceflag != null and ibalanceflag != ''"> or IBALANCEFLAG = #{ibalanceflag} </if>
             <if test="iprintcount != null and iprintcount != ''"> or IPRINTCOUNT = #{iprintcount} </if>
             <if test="ndiscountrate != null and ndiscountrate != ''"> or NDISCOUNTRATE = #{ndiscountrate} </if>
             <if test="nevaluatecarriage != null and nevaluatecarriage != ''"> or NEVALUATECARRIAGE = #{nevaluatecarriage} </if>
             <if test="nnetmny != null and nnetmny != ''"> or NNETMNY = #{nnetmny} </if>
             <if test="nstrikemny != null and nstrikemny != ''"> or NSTRIKEMNY = #{nstrikemny} </if>
             <if test="nsubscription != null and nsubscription != ''"> or NSUBSCRIPTION = #{nsubscription} </if>
             <if test="ntotalnum != null and ntotalnum != ''"> or NTOTALNUM = #{ntotalnum} </if>
             <if test="ntotalsummny != null and ntotalsummny != ''"> or NTOTALSUMMNY = #{ntotalsummny} </if>
             <if test="pkConnected != null and pkConnected != ''"> or PK_CONNECTED = #{pkConnected} </if>
             <if test="pkCorp != null and pkCorp != ''"> or PK_CORP = #{pkCorp} </if>
             <if test="pkDefdoc1 != null and pkDefdoc1 != ''"> or PK_DEFDOC1 = #{pkDefdoc1} </if>
             <if test="pkDefdoc10 != null and pkDefdoc10 != ''"> or PK_DEFDOC10 = #{pkDefdoc10} </if>
             <if test="pkDefdoc11 != null and pkDefdoc11 != ''"> or PK_DEFDOC11 = #{pkDefdoc11} </if>
             <if test="pkDefdoc12 != null and pkDefdoc12 != ''"> or PK_DEFDOC12 = #{pkDefdoc12} </if>
             <if test="pkDefdoc13 != null and pkDefdoc13 != ''"> or PK_DEFDOC13 = #{pkDefdoc13} </if>
             <if test="pkDefdoc14 != null and pkDefdoc14 != ''"> or PK_DEFDOC14 = #{pkDefdoc14} </if>
             <if test="pkDefdoc15 != null and pkDefdoc15 != ''"> or PK_DEFDOC15 = #{pkDefdoc15} </if>
             <if test="pkDefdoc16 != null and pkDefdoc16 != ''"> or PK_DEFDOC16 = #{pkDefdoc16} </if>
             <if test="pkDefdoc17 != null and pkDefdoc17 != ''"> or PK_DEFDOC17 = #{pkDefdoc17} </if>
             <if test="pkDefdoc18 != null and pkDefdoc18 != ''"> or PK_DEFDOC18 = #{pkDefdoc18} </if>
             <if test="pkDefdoc19 != null and pkDefdoc19 != ''"> or PK_DEFDOC19 = #{pkDefdoc19} </if>
             <if test="pkDefdoc2 != null and pkDefdoc2 != ''"> or PK_DEFDOC2 = #{pkDefdoc2} </if>
             <if test="pkDefdoc20 != null and pkDefdoc20 != ''"> or PK_DEFDOC20 = #{pkDefdoc20} </if>
             <if test="pkDefdoc3 != null and pkDefdoc3 != ''"> or PK_DEFDOC3 = #{pkDefdoc3} </if>
             <if test="pkDefdoc4 != null and pkDefdoc4 != ''"> or PK_DEFDOC4 = #{pkDefdoc4} </if>
             <if test="pkDefdoc5 != null and pkDefdoc5 != ''"> or PK_DEFDOC5 = #{pkDefdoc5} </if>
             <if test="pkDefdoc6 != null and pkDefdoc6 != ''"> or PK_DEFDOC6 = #{pkDefdoc6} </if>
             <if test="pkDefdoc7 != null and pkDefdoc7 != ''"> or PK_DEFDOC7 = #{pkDefdoc7} </if>
             <if test="pkDefdoc8 != null and pkDefdoc8 != ''"> or PK_DEFDOC8 = #{pkDefdoc8} </if>
             <if test="pkDefdoc9 != null and pkDefdoc9 != ''"> or PK_DEFDOC9 = #{pkDefdoc9} </if>
             <if test="ts != null and ts != ''"> or TS = #{ts} </if>
             <if test="vaccountyear != null and vaccountyear != ''"> or VACCOUNTYEAR = #{vaccountyear} </if>
             <if test="vdef1 != null and vdef1 != ''"> or VDEF1 = #{vdef1} </if>
             <if test="vdef10 != null and vdef10 != ''"> or VDEF10 = #{vdef10} </if>
             <if test="vdef11 != null and vdef11 != ''"> or VDEF11 = #{vdef11} </if>
             <if test="vdef12 != null and vdef12 != ''"> or VDEF12 = #{vdef12} </if>
             <if test="vdef13 != null and vdef13 != ''"> or VDEF13 = #{vdef13} </if>
             <if test="vdef14 != null and vdef14 != ''"> or VDEF14 = #{vdef14} </if>
             <if test="vdef15 != null and vdef15 != ''"> or VDEF15 = #{vdef15} </if>
             <if test="vdef16 != null and vdef16 != ''"> or VDEF16 = #{vdef16} </if>
             <if test="vdef17 != null and vdef17 != ''"> or VDEF17 = #{vdef17} </if>
             <if test="vdef18 != null and vdef18 != ''"> or VDEF18 = #{vdef18} </if>
             <if test="vdef19 != null and vdef19 != ''"> or VDEF19 = #{vdef19} </if>
             <if test="vdef2 != null and vdef2 != ''"> or VDEF2 = #{vdef2} </if>
             <if test="vdef20 != null and vdef20 != ''"> or VDEF20 = #{vdef20} </if>
             <if test="vdef3 != null and vdef3 != ''"> or VDEF3 = #{vdef3} </if>
             <if test="vdef4 != null and vdef4 != ''"> or VDEF4 = #{vdef4} </if>
             <if test="vdef5 != null and vdef5 != ''"> or VDEF5 = #{vdef5} </if>
             <if test="vdef6 != null and vdef6 != ''"> or VDEF6 = #{vdef6} </if>
             <if test="vdef7 != null and vdef7 != ''"> or VDEF7 = #{vdef7} </if>
             <if test="vdef8 != null and vdef8 != ''"> or VDEF8 = #{vdef8} </if>
             <if test="vdef9 != null and vdef9 != ''"> or VDEF9 = #{vdef9} </if>
             <if test="veditreason != null and veditreason != ''"> or VEDITREASON = #{veditreason} </if>
             <if test="veinvcode != null and veinvcode != ''"> or VEINVCODE = #{veinvcode} </if>
             <if test="veinvfailnote != null and veinvfailnote != ''"> or VEINVFAILNOTE = #{veinvfailnote} </if>
             <if test="veinvnumber != null and veinvnumber != ''"> or VEINVNUMBER = #{veinvnumber} </if>
             <if test="vnote != null and vnote != ''"> or VNOTE = #{vnote} </if>
             <if test="vprintcustname != null and vprintcustname != ''"> or VPRINTCUSTNAME = #{vprintcustname} </if>
             <if test="vreceiptcode != null and vreceiptcode != ''"> or VRECEIPTCODE = #{vreceiptcode} </if>
             <if test="vreceiveaddress != null and vreceiveaddress != ''"> or VRECEIVEADDRESS = #{vreceiveaddress} </if>
             <if test="vredflushcause != null and vredflushcause != ''"> or VREDFLUSHCAUSE = #{vredflushcause} </if>
             <if test="vredletterinfo != null and vredletterinfo != ''"> or VREDLETTERINFO = #{vredletterinfo} </if>
             <if test="vsplitrecord != null and vsplitrecord != ''"> or VSPLITRECORD = #{vsplitrecord} </if>
             <if test="vsrceinvcode != null and vsrceinvcode != ''"> or VSRCEINVCODE = #{vsrceinvcode} </if>
             <if test="vsrceinvnumber != null and vsrceinvnumber != ''"> or VSRCEINVNUMBER = #{vsrceinvnumber} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString()  "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity" keyProperty="csaleid" useGeneratedKeys="true">
    insert into SO_SALEINVOICE(
  <trim suffix="" suffixOverrides=",">
       <if test="bfreecustflag != null and bfreecustflag != ''"> BFREECUSTFLAG , </if>
            <if test="binitflag != null and binitflag != ''"> BINITFLAG , </if>
            <if test="btogoldtax != null and btogoldtax != ''"> BTOGOLDTAX , </if>
            <if test="capproveid != null and capproveid != ''"> CAPPROVEID , </if>
            <if test="cbiztype != null and cbiztype != ''"> CBIZTYPE , </if>
            <if test="ccalbodyid != null and ccalbodyid != ''"> CCALBODYID , </if>
            <if test="ccreditnum != null and ccreditnum != ''"> CCREDITNUM , </if>
            <if test="ccustbankid != null and ccustbankid != ''"> CCUSTBANKID , </if>
            <if test="cdeptid != null and cdeptid != ''"> CDEPTID , </if>
            <if test="cdispatcherid != null and cdispatcherid != ''"> CDISPATCHERID , </if>
            <if test="cemployeeid != null and cemployeeid != ''"> CEMPLOYEEID , </if>
            <if test="cfreecustid != null and cfreecustid != ''"> CFREECUSTID , </if>
            <if test="cgoldtaxcode != null and cgoldtaxcode != ''"> CGOLDTAXCODE , </if>
            <if test="coperatorid != null and coperatorid != ''"> COPERATORID , </if>
            <if test="creceiptcorpid != null and creceiptcorpid != ''"> CRECEIPTCORPID , </if>
            <if test="creceiptcustomerid != null and creceiptcustomerid != ''"> CRECEIPTCUSTOMERID , </if>
            <if test="creceipttype != null and creceipttype != ''"> CRECEIPTTYPE , </if>
            <if test="csalecorpid != null and csalecorpid != ''"> CSALECORPID , </if>
            <if test="csaleid != null and csaleid != ''"> CSALEID , </if>
            <if test="ctermprotocolid != null and ctermprotocolid != ''"> CTERMPROTOCOLID , </if>
            <if test="ctransmodeid != null and ctransmodeid != ''"> CTRANSMODEID , </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> CWAREHOUSEID , </if>
            <if test="dapprovedate != null and dapprovedate != ''"> DAPPROVEDATE , </if>
            <if test="daudittime != null and daudittime != ''"> DAUDITTIME , </if>
            <if test="dbilldate != null and dbilldate != ''"> DBILLDATE , </if>
            <if test="dbilltime != null and dbilltime != ''"> DBILLTIME , </if>
            <if test="deinvdate != null and deinvdate != ''"> DEINVDATE , </if>
            <if test="dmakedate != null and dmakedate != ''"> DMAKEDATE , </if>
            <if test="dmoditime != null and dmoditime != ''"> DMODITIME , </if>
            <if test="dr != null and dr != ''"> DR , </if>
            <if test="dtogoldtaxtime != null and dtogoldtaxtime != ''"> DTOGOLDTAXTIME , </if>
            <if test="fcounteractflag != null and fcounteractflag != ''"> FCOUNTERACTFLAG , </if>
            <if test="feinvstatus != null and feinvstatus != ''"> FEINVSTATUS , </if>
            <if test="finvoiceclass != null and finvoiceclass != ''"> FINVOICECLASS , </if>
            <if test="finvoicetype != null and finvoicetype != ''"> FINVOICETYPE , </if>
            <if test="fstatus != null and fstatus != ''"> FSTATUS , </if>
            <if test="ibalanceflag != null and ibalanceflag != ''"> IBALANCEFLAG , </if>
            <if test="iprintcount != null and iprintcount != ''"> IPRINTCOUNT , </if>
            <if test="ndiscountrate != null and ndiscountrate != ''"> NDISCOUNTRATE , </if>
            <if test="nevaluatecarriage != null and nevaluatecarriage != ''"> NEVALUATECARRIAGE , </if>
            <if test="nnetmny != null and nnetmny != ''"> NNETMNY , </if>
            <if test="nstrikemny != null and nstrikemny != ''"> NSTRIKEMNY , </if>
            <if test="nsubscription != null and nsubscription != ''"> NSUBSCRIPTION , </if>
            <if test="ntotalnum != null and ntotalnum != ''"> NTOTALNUM , </if>
            <if test="ntotalsummny != null and ntotalsummny != ''"> NTOTALSUMMNY , </if>
            <if test="pkConnected != null and pkConnected != ''"> PK_CONNECTED , </if>
            <if test="pkCorp != null and pkCorp != ''"> PK_CORP , </if>
            <if test="pkDefdoc1 != null and pkDefdoc1 != ''"> PK_DEFDOC1 , </if>
            <if test="pkDefdoc10 != null and pkDefdoc10 != ''"> PK_DEFDOC10 , </if>
            <if test="pkDefdoc11 != null and pkDefdoc11 != ''"> PK_DEFDOC11 , </if>
            <if test="pkDefdoc12 != null and pkDefdoc12 != ''"> PK_DEFDOC12 , </if>
            <if test="pkDefdoc13 != null and pkDefdoc13 != ''"> PK_DEFDOC13 , </if>
            <if test="pkDefdoc14 != null and pkDefdoc14 != ''"> PK_DEFDOC14 , </if>
            <if test="pkDefdoc15 != null and pkDefdoc15 != ''"> PK_DEFDOC15 , </if>
            <if test="pkDefdoc16 != null and pkDefdoc16 != ''"> PK_DEFDOC16 , </if>
            <if test="pkDefdoc17 != null and pkDefdoc17 != ''"> PK_DEFDOC17 , </if>
            <if test="pkDefdoc18 != null and pkDefdoc18 != ''"> PK_DEFDOC18 , </if>
            <if test="pkDefdoc19 != null and pkDefdoc19 != ''"> PK_DEFDOC19 , </if>
            <if test="pkDefdoc2 != null and pkDefdoc2 != ''"> PK_DEFDOC2 , </if>
            <if test="pkDefdoc20 != null and pkDefdoc20 != ''"> PK_DEFDOC20 , </if>
            <if test="pkDefdoc3 != null and pkDefdoc3 != ''"> PK_DEFDOC3 , </if>
            <if test="pkDefdoc4 != null and pkDefdoc4 != ''"> PK_DEFDOC4 , </if>
            <if test="pkDefdoc5 != null and pkDefdoc5 != ''"> PK_DEFDOC5 , </if>
            <if test="pkDefdoc6 != null and pkDefdoc6 != ''"> PK_DEFDOC6 , </if>
            <if test="pkDefdoc7 != null and pkDefdoc7 != ''"> PK_DEFDOC7 , </if>
            <if test="pkDefdoc8 != null and pkDefdoc8 != ''"> PK_DEFDOC8 , </if>
            <if test="pkDefdoc9 != null and pkDefdoc9 != ''"> PK_DEFDOC9 , </if>
            <if test="ts != null and ts != ''"> TS , </if>
            <if test="vaccountyear != null and vaccountyear != ''"> VACCOUNTYEAR , </if>
            <if test="vdef1 != null and vdef1 != ''"> VDEF1 , </if>
            <if test="vdef10 != null and vdef10 != ''"> VDEF10 , </if>
            <if test="vdef11 != null and vdef11 != ''"> VDEF11 , </if>
            <if test="vdef12 != null and vdef12 != ''"> VDEF12 , </if>
            <if test="vdef13 != null and vdef13 != ''"> VDEF13 , </if>
            <if test="vdef14 != null and vdef14 != ''"> VDEF14 , </if>
            <if test="vdef15 != null and vdef15 != ''"> VDEF15 , </if>
            <if test="vdef16 != null and vdef16 != ''"> VDEF16 , </if>
            <if test="vdef17 != null and vdef17 != ''"> VDEF17 , </if>
            <if test="vdef18 != null and vdef18 != ''"> VDEF18 , </if>
            <if test="vdef19 != null and vdef19 != ''"> VDEF19 , </if>
            <if test="vdef2 != null and vdef2 != ''"> VDEF2 , </if>
            <if test="vdef20 != null and vdef20 != ''"> VDEF20 , </if>
            <if test="vdef3 != null and vdef3 != ''"> VDEF3 , </if>
            <if test="vdef4 != null and vdef4 != ''"> VDEF4 , </if>
            <if test="vdef5 != null and vdef5 != ''"> VDEF5 , </if>
            <if test="vdef6 != null and vdef6 != ''"> VDEF6 , </if>
            <if test="vdef7 != null and vdef7 != ''"> VDEF7 , </if>
            <if test="vdef8 != null and vdef8 != ''"> VDEF8 , </if>
            <if test="vdef9 != null and vdef9 != ''"> VDEF9 , </if>
            <if test="veditreason != null and veditreason != ''"> VEDITREASON , </if>
            <if test="veinvcode != null and veinvcode != ''"> VEINVCODE , </if>
            <if test="veinvfailnote != null and veinvfailnote != ''"> VEINVFAILNOTE , </if>
            <if test="veinvnumber != null and veinvnumber != ''"> VEINVNUMBER , </if>
            <if test="vnote != null and vnote != ''"> VNOTE , </if>
            <if test="vprintcustname != null and vprintcustname != ''"> VPRINTCUSTNAME , </if>
            <if test="vreceiptcode != null and vreceiptcode != ''"> VRECEIPTCODE , </if>
            <if test="vreceiveaddress != null and vreceiveaddress != ''"> VRECEIVEADDRESS , </if>
            <if test="vredflushcause != null and vredflushcause != ''"> VREDFLUSHCAUSE , </if>
            <if test="vredletterinfo != null and vredletterinfo != ''"> VREDLETTERINFO , </if>
            <if test="vsplitrecord != null and vsplitrecord != ''"> VSPLITRECORD , </if>
            <if test="vsrceinvcode != null and vsrceinvcode != ''"> VSRCEINVCODE , </if>
            <if test="vsrceinvnumber != null and vsrceinvnumber != ''"> VSRCEINVNUMBER , </if>
            <if test="sorts == null ">sorts,</if>
    <if test="sts == null ">sts,</if>
  </trim>
  )values(
 <trim suffix="" suffixOverrides=",">
       <if test="bfreecustflag != null and bfreecustflag != ''"> #{bfreecustflag} ,</if>
            <if test="binitflag != null and binitflag != ''"> #{binitflag} ,</if>
            <if test="btogoldtax != null and btogoldtax != ''"> #{btogoldtax} ,</if>
            <if test="capproveid != null and capproveid != ''"> #{capproveid} ,</if>
            <if test="cbiztype != null and cbiztype != ''"> #{cbiztype} ,</if>
            <if test="ccalbodyid != null and ccalbodyid != ''"> #{ccalbodyid} ,</if>
            <if test="ccreditnum != null and ccreditnum != ''"> #{ccreditnum} ,</if>
            <if test="ccustbankid != null and ccustbankid != ''"> #{ccustbankid} ,</if>
            <if test="cdeptid != null and cdeptid != ''"> #{cdeptid} ,</if>
            <if test="cdispatcherid != null and cdispatcherid != ''"> #{cdispatcherid} ,</if>
            <if test="cemployeeid != null and cemployeeid != ''"> #{cemployeeid} ,</if>
            <if test="cfreecustid != null and cfreecustid != ''"> #{cfreecustid} ,</if>
            <if test="cgoldtaxcode != null and cgoldtaxcode != ''"> #{cgoldtaxcode} ,</if>
            <if test="coperatorid != null and coperatorid != ''"> #{coperatorid} ,</if>
            <if test="creceiptcorpid != null and creceiptcorpid != ''"> #{creceiptcorpid} ,</if>
            <if test="creceiptcustomerid != null and creceiptcustomerid != ''"> #{creceiptcustomerid} ,</if>
            <if test="creceipttype != null and creceipttype != ''"> #{creceipttype} ,</if>
            <if test="csalecorpid != null and csalecorpid != ''"> #{csalecorpid} ,</if>
            <if test="csaleid != null and csaleid != ''"> #{csaleid} ,</if>
            <if test="ctermprotocolid != null and ctermprotocolid != ''"> #{ctermprotocolid} ,</if>
            <if test="ctransmodeid != null and ctransmodeid != ''"> #{ctransmodeid} ,</if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> #{cwarehouseid} ,</if>
            <if test="dapprovedate != null and dapprovedate != ''"> #{dapprovedate} ,</if>
            <if test="daudittime != null and daudittime != ''"> #{daudittime} ,</if>
            <if test="dbilldate != null and dbilldate != ''"> #{dbilldate} ,</if>
            <if test="dbilltime != null and dbilltime != ''"> #{dbilltime} ,</if>
            <if test="deinvdate != null and deinvdate != ''"> #{deinvdate} ,</if>
            <if test="dmakedate != null and dmakedate != ''"> #{dmakedate} ,</if>
            <if test="dmoditime != null and dmoditime != ''"> #{dmoditime} ,</if>
            <if test="dr != null and dr != ''"> #{dr} ,</if>
            <if test="dtogoldtaxtime != null and dtogoldtaxtime != ''"> #{dtogoldtaxtime} ,</if>
            <if test="fcounteractflag != null and fcounteractflag != ''"> #{fcounteractflag} ,</if>
            <if test="feinvstatus != null and feinvstatus != ''"> #{feinvstatus} ,</if>
            <if test="finvoiceclass != null and finvoiceclass != ''"> #{finvoiceclass} ,</if>
            <if test="finvoicetype != null and finvoicetype != ''"> #{finvoicetype} ,</if>
            <if test="fstatus != null and fstatus != ''"> #{fstatus} ,</if>
            <if test="ibalanceflag != null and ibalanceflag != ''"> #{ibalanceflag} ,</if>
            <if test="iprintcount != null and iprintcount != ''"> #{iprintcount} ,</if>
            <if test="ndiscountrate != null and ndiscountrate != ''"> #{ndiscountrate} ,</if>
            <if test="nevaluatecarriage != null and nevaluatecarriage != ''"> #{nevaluatecarriage} ,</if>
            <if test="nnetmny != null and nnetmny != ''"> #{nnetmny} ,</if>
            <if test="nstrikemny != null and nstrikemny != ''"> #{nstrikemny} ,</if>
            <if test="nsubscription != null and nsubscription != ''"> #{nsubscription} ,</if>
            <if test="ntotalnum != null and ntotalnum != ''"> #{ntotalnum} ,</if>
            <if test="ntotalsummny != null and ntotalsummny != ''"> #{ntotalsummny} ,</if>
            <if test="pkConnected != null and pkConnected != ''"> #{pkConnected} ,</if>
            <if test="pkCorp != null and pkCorp != ''"> #{pkCorp} ,</if>
            <if test="pkDefdoc1 != null and pkDefdoc1 != ''"> #{pkDefdoc1} ,</if>
            <if test="pkDefdoc10 != null and pkDefdoc10 != ''"> #{pkDefdoc10} ,</if>
            <if test="pkDefdoc11 != null and pkDefdoc11 != ''"> #{pkDefdoc11} ,</if>
            <if test="pkDefdoc12 != null and pkDefdoc12 != ''"> #{pkDefdoc12} ,</if>
            <if test="pkDefdoc13 != null and pkDefdoc13 != ''"> #{pkDefdoc13} ,</if>
            <if test="pkDefdoc14 != null and pkDefdoc14 != ''"> #{pkDefdoc14} ,</if>
            <if test="pkDefdoc15 != null and pkDefdoc15 != ''"> #{pkDefdoc15} ,</if>
            <if test="pkDefdoc16 != null and pkDefdoc16 != ''"> #{pkDefdoc16} ,</if>
            <if test="pkDefdoc17 != null and pkDefdoc17 != ''"> #{pkDefdoc17} ,</if>
            <if test="pkDefdoc18 != null and pkDefdoc18 != ''"> #{pkDefdoc18} ,</if>
            <if test="pkDefdoc19 != null and pkDefdoc19 != ''"> #{pkDefdoc19} ,</if>
            <if test="pkDefdoc2 != null and pkDefdoc2 != ''"> #{pkDefdoc2} ,</if>
            <if test="pkDefdoc20 != null and pkDefdoc20 != ''"> #{pkDefdoc20} ,</if>
            <if test="pkDefdoc3 != null and pkDefdoc3 != ''"> #{pkDefdoc3} ,</if>
            <if test="pkDefdoc4 != null and pkDefdoc4 != ''"> #{pkDefdoc4} ,</if>
            <if test="pkDefdoc5 != null and pkDefdoc5 != ''"> #{pkDefdoc5} ,</if>
            <if test="pkDefdoc6 != null and pkDefdoc6 != ''"> #{pkDefdoc6} ,</if>
            <if test="pkDefdoc7 != null and pkDefdoc7 != ''"> #{pkDefdoc7} ,</if>
            <if test="pkDefdoc8 != null and pkDefdoc8 != ''"> #{pkDefdoc8} ,</if>
            <if test="pkDefdoc9 != null and pkDefdoc9 != ''"> #{pkDefdoc9} ,</if>
            <if test="ts != null and ts != ''"> #{ts} ,</if>
            <if test="vaccountyear != null and vaccountyear != ''"> #{vaccountyear} ,</if>
            <if test="vdef1 != null and vdef1 != ''"> #{vdef1} ,</if>
            <if test="vdef10 != null and vdef10 != ''"> #{vdef10} ,</if>
            <if test="vdef11 != null and vdef11 != ''"> #{vdef11} ,</if>
            <if test="vdef12 != null and vdef12 != ''"> #{vdef12} ,</if>
            <if test="vdef13 != null and vdef13 != ''"> #{vdef13} ,</if>
            <if test="vdef14 != null and vdef14 != ''"> #{vdef14} ,</if>
            <if test="vdef15 != null and vdef15 != ''"> #{vdef15} ,</if>
            <if test="vdef16 != null and vdef16 != ''"> #{vdef16} ,</if>
            <if test="vdef17 != null and vdef17 != ''"> #{vdef17} ,</if>
            <if test="vdef18 != null and vdef18 != ''"> #{vdef18} ,</if>
            <if test="vdef19 != null and vdef19 != ''"> #{vdef19} ,</if>
            <if test="vdef2 != null and vdef2 != ''"> #{vdef2} ,</if>
            <if test="vdef20 != null and vdef20 != ''"> #{vdef20} ,</if>
            <if test="vdef3 != null and vdef3 != ''"> #{vdef3} ,</if>
            <if test="vdef4 != null and vdef4 != ''"> #{vdef4} ,</if>
            <if test="vdef5 != null and vdef5 != ''"> #{vdef5} ,</if>
            <if test="vdef6 != null and vdef6 != ''"> #{vdef6} ,</if>
            <if test="vdef7 != null and vdef7 != ''"> #{vdef7} ,</if>
            <if test="vdef8 != null and vdef8 != ''"> #{vdef8} ,</if>
            <if test="vdef9 != null and vdef9 != ''"> #{vdef9} ,</if>
            <if test="veditreason != null and veditreason != ''"> #{veditreason} ,</if>
            <if test="veinvcode != null and veinvcode != ''"> #{veinvcode} ,</if>
            <if test="veinvfailnote != null and veinvfailnote != ''"> #{veinvfailnote} ,</if>
            <if test="veinvnumber != null and veinvnumber != ''"> #{veinvnumber} ,</if>
            <if test="vnote != null and vnote != ''"> #{vnote} ,</if>
            <if test="vprintcustname != null and vprintcustname != ''"> #{vprintcustname} ,</if>
            <if test="vreceiptcode != null and vreceiptcode != ''"> #{vreceiptcode} ,</if>
            <if test="vreceiveaddress != null and vreceiveaddress != ''"> #{vreceiveaddress} ,</if>
            <if test="vredflushcause != null and vredflushcause != ''"> #{vredflushcause} ,</if>
            <if test="vredletterinfo != null and vredletterinfo != ''"> #{vredletterinfo} ,</if>
            <if test="vsplitrecord != null and vsplitrecord != ''"> #{vsplitrecord} ,</if>
            <if test="vsrceinvcode != null and vsrceinvcode != ''"> #{vsrceinvcode} ,</if>
            <if test="vsrceinvnumber != null and vsrceinvnumber != ''"> #{vsrceinvnumber} ,</if>
            <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from SO_SALEINVOICE a WHERE a.sts = 'Y' ),</if>
    <if test="sts == null ">'Y',</if>
  </trim>
  )  
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="csaleid" useGeneratedKeys="true">
  insert into SO_SALEINVOICE(BFREECUSTFLAG, BINITFLAG, BTOGOLDTAX, CAPPROVEID, CBIZTYPE, CCALBODYID, CCREDITNUM, CCUSTBANKID, CDEPTID, CDISPATCHERID, CEMPLOYEEID, CFREECUSTID, CGOLDTAXCODE, COPERATORID, CRECEIPTCORPID, CRECEIPTCUSTOMERID, CRECEIPTTYPE, CSALECORPID, CTERMPROTOCOLID, CTRANSMODEID, CWAREHOUSEID, DAPPROVEDATE, DAUDITTIME, DBILLDATE, DBILLTIME, DEINVDATE, DMAKEDATE, DMODITIME, DR, DTOGOLDTAXTIME, FCOUNTERACTFLAG, FEINVSTATUS, FINVOICECLASS, FINVOICETYPE, FSTATUS, IBALANCEFLAG, IPRINTCOUNT, NDISCOUNTRATE, NEVALUATECARRIAGE, NNETMNY, NSTRIKEMNY, NSUBSCRIPTION, NTOTALNUM, NTOTALSUMMNY, PK_CONNECTED, PK_CORP, PK_DEFDOC1, PK_DEFDOC10, PK_DEFDOC11, PK_DEFDOC12, PK_DEFDOC13, PK_DEFDOC14, PK_DEFDOC15, PK_DEFDOC16, PK_DEFDOC17, PK_DEFDOC18, PK_DEFDOC19, PK_DEFDOC2, PK_DEFDOC20, PK_DEFDOC3, PK_DEFDOC4, PK_DEFDOC5, PK_DEFDOC6, PK_DEFDOC7, PK_DEFDOC8, PK_DEFDOC9, TS, VACCOUNTYEAR, VDEF1, VDEF10, VDEF11, VDEF12, VDEF13, VDEF14, VDEF15, VDEF16, VDEF17, VDEF18, VDEF19, VDEF2, VDEF20, VDEF3, VDEF4, VDEF5, VDEF6, VDEF7, VDEF8, VDEF9, VEDITREASON, VEINVCODE, VEINVFAILNOTE, VEINVNUMBER, VNOTE, VPRINTCUSTNAME, VRECEIPTCODE, VRECEIVEADDRESS, VREDFLUSHCAUSE, VREDLETTERINFO, VSPLITRECORD, VSRCEINVCODE, VSRCEINVNUMBER,  sts) 
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.bfreecustflag},#{entity.binitflag},#{entity.btogoldtax},#{entity.capproveid},#{entity.cbiztype},#{entity.ccalbodyid},#{entity.ccreditnum},#{entity.ccustbankid},#{entity.cdeptid},#{entity.cdispatcherid},#{entity.cemployeeid},#{entity.cfreecustid},#{entity.cgoldtaxcode},#{entity.coperatorid},#{entity.creceiptcorpid},#{entity.creceiptcustomerid},#{entity.creceipttype},#{entity.csalecorpid},#{entity.ctermprotocolid},#{entity.ctransmodeid},#{entity.cwarehouseid},#{entity.dapprovedate},#{entity.daudittime},#{entity.dbilldate},#{entity.dbilltime},#{entity.deinvdate},#{entity.dmakedate},#{entity.dmoditime},#{entity.dr},#{entity.dtogoldtaxtime},#{entity.fcounteractflag},#{entity.feinvstatus},#{entity.finvoiceclass},#{entity.finvoicetype},#{entity.fstatus},#{entity.ibalanceflag},#{entity.iprintcount},#{entity.ndiscountrate},#{entity.nevaluatecarriage},#{entity.nnetmny},#{entity.nstrikemny},#{entity.nsubscription},#{entity.ntotalnum},#{entity.ntotalsummny},#{entity.pkConnected},#{entity.pkCorp},#{entity.pkDefdoc1},#{entity.pkDefdoc10},#{entity.pkDefdoc11},#{entity.pkDefdoc12},#{entity.pkDefdoc13},#{entity.pkDefdoc14},#{entity.pkDefdoc15},#{entity.pkDefdoc16},#{entity.pkDefdoc17},#{entity.pkDefdoc18},#{entity.pkDefdoc19},#{entity.pkDefdoc2},#{entity.pkDefdoc20},#{entity.pkDefdoc3},#{entity.pkDefdoc4},#{entity.pkDefdoc5},#{entity.pkDefdoc6},#{entity.pkDefdoc7},#{entity.pkDefdoc8},#{entity.pkDefdoc9},#{entity.ts},#{entity.vaccountyear},#{entity.vdef1},#{entity.vdef10},#{entity.vdef11},#{entity.vdef12},#{entity.vdef13},#{entity.vdef14},#{entity.vdef15},#{entity.vdef16},#{entity.vdef17},#{entity.vdef18},#{entity.vdef19},#{entity.vdef2},#{entity.vdef20},#{entity.vdef3},#{entity.vdef4},#{entity.vdef5},#{entity.vdef6},#{entity.vdef7},#{entity.vdef8},#{entity.vdef9},#{entity.veditreason},#{entity.veinvcode},#{entity.veinvfailnote},#{entity.veinvnumber},#{entity.vnote},#{entity.vprintcustname},#{entity.vreceiptcode},#{entity.vreceiveaddress},#{entity.vredflushcause},#{entity.vredletterinfo},#{entity.vsplitrecord},#{entity.vsrceinvcode},#{entity.vsrceinvnumber}, 'Y')
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="csaleid" useGeneratedKeys="true">
    insert into SO_SALEINVOICE(BFREECUSTFLAG, BINITFLAG, BTOGOLDTAX, CAPPROVEID, CBIZTYPE, CCALBODYID, CCREDITNUM, CCUSTBANKID, CDEPTID, CDISPATCHERID, CEMPLOYEEID, CFREECUSTID, CGOLDTAXCODE, COPERATORID, CRECEIPTCORPID, CRECEIPTCUSTOMERID, CRECEIPTTYPE, CSALECORPID, CTERMPROTOCOLID, CTRANSMODEID, CWAREHOUSEID, DAPPROVEDATE, DAUDITTIME, DBILLDATE, DBILLTIME, DEINVDATE, DMAKEDATE, DMODITIME, DR, DTOGOLDTAXTIME, FCOUNTERACTFLAG, FEINVSTATUS, FINVOICECLASS, FINVOICETYPE, FSTATUS, IBALANCEFLAG, IPRINTCOUNT, NDISCOUNTRATE, NEVALUATECARRIAGE, NNETMNY, NSTRIKEMNY, NSUBSCRIPTION, NTOTALNUM, NTOTALSUMMNY, PK_CONNECTED, PK_CORP, PK_DEFDOC1, PK_DEFDOC10, PK_DEFDOC11, PK_DEFDOC12, PK_DEFDOC13, PK_DEFDOC14, PK_DEFDOC15, PK_DEFDOC16, PK_DEFDOC17, PK_DEFDOC18, PK_DEFDOC19, PK_DEFDOC2, PK_DEFDOC20, PK_DEFDOC3, PK_DEFDOC4, PK_DEFDOC5, PK_DEFDOC6, PK_DEFDOC7, PK_DEFDOC8, PK_DEFDOC9, TS, VACCOUNTYEAR, VDEF1, VDEF10, VDEF11, VDEF12, VDEF13, VDEF14, VDEF15, VDEF16, VDEF17, VDEF18, VDEF19, VDEF2, VDEF20, VDEF3, VDEF4, VDEF5, VDEF6, VDEF7, VDEF8, VDEF9, VEDITREASON, VEINVCODE, VEINVFAILNOTE, VEINVNUMBER, VNOTE, VPRINTCUSTNAME, VRECEIPTCODE, VRECEIVEADDRESS, VREDFLUSHCAUSE, VREDLETTERINFO, VSPLITRECORD, VSRCEINVCODE, VSRCEINVNUMBER)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.bfreecustflag},#{entity.binitflag},#{entity.btogoldtax},#{entity.capproveid},#{entity.cbiztype},#{entity.ccalbodyid},#{entity.ccreditnum},#{entity.ccustbankid},#{entity.cdeptid},#{entity.cdispatcherid},#{entity.cemployeeid},#{entity.cfreecustid},#{entity.cgoldtaxcode},#{entity.coperatorid},#{entity.creceiptcorpid},#{entity.creceiptcustomerid},#{entity.creceipttype},#{entity.csalecorpid},#{entity.ctermprotocolid},#{entity.ctransmodeid},#{entity.cwarehouseid},#{entity.dapprovedate},#{entity.daudittime},#{entity.dbilldate},#{entity.dbilltime},#{entity.deinvdate},#{entity.dmakedate},#{entity.dmoditime},#{entity.dr},#{entity.dtogoldtaxtime},#{entity.fcounteractflag},#{entity.feinvstatus},#{entity.finvoiceclass},#{entity.finvoicetype},#{entity.fstatus},#{entity.ibalanceflag},#{entity.iprintcount},#{entity.ndiscountrate},#{entity.nevaluatecarriage},#{entity.nnetmny},#{entity.nstrikemny},#{entity.nsubscription},#{entity.ntotalnum},#{entity.ntotalsummny},#{entity.pkConnected},#{entity.pkCorp},#{entity.pkDefdoc1},#{entity.pkDefdoc10},#{entity.pkDefdoc11},#{entity.pkDefdoc12},#{entity.pkDefdoc13},#{entity.pkDefdoc14},#{entity.pkDefdoc15},#{entity.pkDefdoc16},#{entity.pkDefdoc17},#{entity.pkDefdoc18},#{entity.pkDefdoc19},#{entity.pkDefdoc2},#{entity.pkDefdoc20},#{entity.pkDefdoc3},#{entity.pkDefdoc4},#{entity.pkDefdoc5},#{entity.pkDefdoc6},#{entity.pkDefdoc7},#{entity.pkDefdoc8},#{entity.pkDefdoc9},#{entity.ts},#{entity.vaccountyear},#{entity.vdef1},#{entity.vdef10},#{entity.vdef11},#{entity.vdef12},#{entity.vdef13},#{entity.vdef14},#{entity.vdef15},#{entity.vdef16},#{entity.vdef17},#{entity.vdef18},#{entity.vdef19},#{entity.vdef2},#{entity.vdef20},#{entity.vdef3},#{entity.vdef4},#{entity.vdef5},#{entity.vdef6},#{entity.vdef7},#{entity.vdef8},#{entity.vdef9},#{entity.veditreason},#{entity.veinvcode},#{entity.veinvfailnote},#{entity.veinvnumber},#{entity.vnote},#{entity.vprintcustname},#{entity.vreceiptcode},#{entity.vreceiveaddress},#{entity.vredflushcause},#{entity.vredletterinfo},#{entity.vsplitrecord},#{entity.vsrceinvcode},#{entity.vsrceinvnumber})
    </foreach>
    on duplicate key update
    BFREECUSTFLAG = values(BFREECUSTFLAG),
    BINITFLAG = values(BINITFLAG),
    BTOGOLDTAX = values(BTOGOLDTAX),
    CAPPROVEID = values(CAPPROVEID),
    CBIZTYPE = values(CBIZTYPE),
    CCALBODYID = values(CCALBODYID),
    CCREDITNUM = values(CCREDITNUM),
    CCUSTBANKID = values(CCUSTBANKID),
    CDEPTID = values(CDEPTID),
    CDISPATCHERID = values(CDISPATCHERID),
    CEMPLOYEEID = values(CEMPLOYEEID),
    CFREECUSTID = values(CFREECUSTID),
    CGOLDTAXCODE = values(CGOLDTAXCODE),
    COPERATORID = values(COPERATORID),
    CRECEIPTCORPID = values(CRECEIPTCORPID),
    CRECEIPTCUSTOMERID = values(CRECEIPTCUSTOMERID),
    CRECEIPTTYPE = values(CRECEIPTTYPE),
    CSALECORPID = values(CSALECORPID),
    CTERMPROTOCOLID = values(CTERMPROTOCOLID),
    CTRANSMODEID = values(CTRANSMODEID),
    CWAREHOUSEID = values(CWAREHOUSEID),
    DAPPROVEDATE = values(DAPPROVEDATE),
    DAUDITTIME = values(DAUDITTIME),
    DBILLDATE = values(DBILLDATE),
    DBILLTIME = values(DBILLTIME),
    DEINVDATE = values(DEINVDATE),
    DMAKEDATE = values(DMAKEDATE),
    DMODITIME = values(DMODITIME),
    DR = values(DR),
    DTOGOLDTAXTIME = values(DTOGOLDTAXTIME),
    FCOUNTERACTFLAG = values(FCOUNTERACTFLAG),
    FEINVSTATUS = values(FEINVSTATUS),
    FINVOICECLASS = values(FINVOICECLASS),
    FINVOICETYPE = values(FINVOICETYPE),
    FSTATUS = values(FSTATUS),
    IBALANCEFLAG = values(IBALANCEFLAG),
    IPRINTCOUNT = values(IPRINTCOUNT),
    NDISCOUNTRATE = values(NDISCOUNTRATE),
    NEVALUATECARRIAGE = values(NEVALUATECARRIAGE),
    NNETMNY = values(NNETMNY),
    NSTRIKEMNY = values(NSTRIKEMNY),
    NSUBSCRIPTION = values(NSUBSCRIPTION),
    NTOTALNUM = values(NTOTALNUM),
    NTOTALSUMMNY = values(NTOTALSUMMNY),
    PK_CONNECTED = values(PK_CONNECTED),
    PK_CORP = values(PK_CORP),
    PK_DEFDOC1 = values(PK_DEFDOC1),
    PK_DEFDOC10 = values(PK_DEFDOC10),
    PK_DEFDOC11 = values(PK_DEFDOC11),
    PK_DEFDOC12 = values(PK_DEFDOC12),
    PK_DEFDOC13 = values(PK_DEFDOC13),
    PK_DEFDOC14 = values(PK_DEFDOC14),
    PK_DEFDOC15 = values(PK_DEFDOC15),
    PK_DEFDOC16 = values(PK_DEFDOC16),
    PK_DEFDOC17 = values(PK_DEFDOC17),
    PK_DEFDOC18 = values(PK_DEFDOC18),
    PK_DEFDOC19 = values(PK_DEFDOC19),
    PK_DEFDOC2 = values(PK_DEFDOC2),
    PK_DEFDOC20 = values(PK_DEFDOC20),
    PK_DEFDOC3 = values(PK_DEFDOC3),
    PK_DEFDOC4 = values(PK_DEFDOC4),
    PK_DEFDOC5 = values(PK_DEFDOC5),
    PK_DEFDOC6 = values(PK_DEFDOC6),
    PK_DEFDOC7 = values(PK_DEFDOC7),
    PK_DEFDOC8 = values(PK_DEFDOC8),
    PK_DEFDOC9 = values(PK_DEFDOC9),
    TS = values(TS),
    VACCOUNTYEAR = values(VACCOUNTYEAR),
    VDEF1 = values(VDEF1),
    VDEF10 = values(VDEF10),
    VDEF11 = values(VDEF11),
    VDEF12 = values(VDEF12),
    VDEF13 = values(VDEF13),
    VDEF14 = values(VDEF14),
    VDEF15 = values(VDEF15),
    VDEF16 = values(VDEF16),
    VDEF17 = values(VDEF17),
    VDEF18 = values(VDEF18),
    VDEF19 = values(VDEF19),
    VDEF2 = values(VDEF2),
    VDEF20 = values(VDEF20),
    VDEF3 = values(VDEF3),
    VDEF4 = values(VDEF4),
    VDEF5 = values(VDEF5),
    VDEF6 = values(VDEF6),
    VDEF7 = values(VDEF7),
    VDEF8 = values(VDEF8),
    VDEF9 = values(VDEF9),
    VEDITREASON = values(VEDITREASON),
    VEINVCODE = values(VEINVCODE),
    VEINVFAILNOTE = values(VEINVFAILNOTE),
    VEINVNUMBER = values(VEINVNUMBER),
    VNOTE = values(VNOTE),
    VPRINTCUSTNAME = values(VPRINTCUSTNAME),
    VRECEIPTCODE = values(VRECEIPTCODE),
    VRECEIVEADDRESS = values(VRECEIVEADDRESS),
    VREDFLUSHCAUSE = values(VREDFLUSHCAUSE),
    VREDLETTERINFO = values(VREDLETTERINFO),
    VSPLITRECORD = values(VSPLITRECORD),
    VSRCEINVCODE = values(VSRCEINVCODE),
    VSRCEINVNUMBER = values(VSRCEINVNUMBER)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity" >
update SO_SALEINVOICE  set
<trim suffix="" suffixOverrides=",">
  <if test="bfreecustflag != null and bfreecustflag != ''"> BFREECUSTFLAG = #{bfreecustflag},</if>
  <if test="binitflag != null and binitflag != ''"> BINITFLAG = #{binitflag},</if>
  <if test="btogoldtax != null and btogoldtax != ''"> BTOGOLDTAX = #{btogoldtax},</if>
  <if test="capproveid != null and capproveid != ''"> CAPPROVEID = #{capproveid},</if>
  <if test="cbiztype != null and cbiztype != ''"> CBIZTYPE = #{cbiztype},</if>
  <if test="ccalbodyid != null and ccalbodyid != ''"> CCALBODYID = #{ccalbodyid},</if>
  <if test="ccreditnum != null and ccreditnum != ''"> CCREDITNUM = #{ccreditnum},</if>
  <if test="ccustbankid != null and ccustbankid != ''"> CCUSTBANKID = #{ccustbankid},</if>
  <if test="cdeptid != null and cdeptid != ''"> CDEPTID = #{cdeptid},</if>
  <if test="cdispatcherid != null and cdispatcherid != ''"> CDISPATCHERID = #{cdispatcherid},</if>
  <if test="cemployeeid != null and cemployeeid != ''"> CEMPLOYEEID = #{cemployeeid},</if>
  <if test="cfreecustid != null and cfreecustid != ''"> CFREECUSTID = #{cfreecustid},</if>
  <if test="cgoldtaxcode != null and cgoldtaxcode != ''"> CGOLDTAXCODE = #{cgoldtaxcode},</if>
  <if test="coperatorid != null and coperatorid != ''"> COPERATORID = #{coperatorid},</if>
  <if test="creceiptcorpid != null and creceiptcorpid != ''"> CRECEIPTCORPID = #{creceiptcorpid},</if>
  <if test="creceiptcustomerid != null and creceiptcustomerid != ''"> CRECEIPTCUSTOMERID = #{creceiptcustomerid},</if>
  <if test="creceipttype != null and creceipttype != ''"> CRECEIPTTYPE = #{creceipttype},</if>
  <if test="csalecorpid != null and csalecorpid != ''"> CSALECORPID = #{csalecorpid},</if>
  <if test="ctermprotocolid != null and ctermprotocolid != ''"> CTERMPROTOCOLID = #{ctermprotocolid},</if>
  <if test="ctransmodeid != null and ctransmodeid != ''"> CTRANSMODEID = #{ctransmodeid},</if>
  <if test="cwarehouseid != null and cwarehouseid != ''"> CWAREHOUSEID = #{cwarehouseid},</if>
  <if test="dapprovedate != null and dapprovedate != ''"> DAPPROVEDATE = #{dapprovedate},</if>
  <if test="daudittime != null and daudittime != ''"> DAUDITTIME = #{daudittime},</if>
  <if test="dbilldate != null and dbilldate != ''"> DBILLDATE = #{dbilldate},</if>
  <if test="dbilltime != null and dbilltime != ''"> DBILLTIME = #{dbilltime},</if>
  <if test="deinvdate != null and deinvdate != ''"> DEINVDATE = #{deinvdate},</if>
  <if test="dmakedate != null and dmakedate != ''"> DMAKEDATE = #{dmakedate},</if>
  <if test="dmoditime != null and dmoditime != ''"> DMODITIME = #{dmoditime},</if>
  <if test="dr != null and dr != ''"> DR = #{dr},</if>
  <if test="dtogoldtaxtime != null and dtogoldtaxtime != ''"> DTOGOLDTAXTIME = #{dtogoldtaxtime},</if>
  <if test="fcounteractflag != null and fcounteractflag != ''"> FCOUNTERACTFLAG = #{fcounteractflag},</if>
  <if test="feinvstatus != null and feinvstatus != ''"> FEINVSTATUS = #{feinvstatus},</if>
  <if test="finvoiceclass != null and finvoiceclass != ''"> FINVOICECLASS = #{finvoiceclass},</if>
  <if test="finvoicetype != null and finvoicetype != ''"> FINVOICETYPE = #{finvoicetype},</if>
  <if test="fstatus != null and fstatus != ''"> FSTATUS = #{fstatus},</if>
  <if test="ibalanceflag != null and ibalanceflag != ''"> IBALANCEFLAG = #{ibalanceflag},</if>
  <if test="iprintcount != null and iprintcount != ''"> IPRINTCOUNT = #{iprintcount},</if>
  <if test="ndiscountrate != null and ndiscountrate != ''"> NDISCOUNTRATE = #{ndiscountrate},</if>
  <if test="nevaluatecarriage != null and nevaluatecarriage != ''"> NEVALUATECARRIAGE = #{nevaluatecarriage},</if>
  <if test="nnetmny != null and nnetmny != ''"> NNETMNY = #{nnetmny},</if>
  <if test="nstrikemny != null and nstrikemny != ''"> NSTRIKEMNY = #{nstrikemny},</if>
  <if test="nsubscription != null and nsubscription != ''"> NSUBSCRIPTION = #{nsubscription},</if>
  <if test="ntotalnum != null and ntotalnum != ''"> NTOTALNUM = #{ntotalnum},</if>
  <if test="ntotalsummny != null and ntotalsummny != ''"> NTOTALSUMMNY = #{ntotalsummny},</if>
  <if test="pkConnected != null and pkConnected != ''"> PK_CONNECTED = #{pkConnected},</if>
  <if test="pkCorp != null and pkCorp != ''"> PK_CORP = #{pkCorp},</if>
  <if test="pkDefdoc1 != null and pkDefdoc1 != ''"> PK_DEFDOC1 = #{pkDefdoc1},</if>
  <if test="pkDefdoc10 != null and pkDefdoc10 != ''"> PK_DEFDOC10 = #{pkDefdoc10},</if>
  <if test="pkDefdoc11 != null and pkDefdoc11 != ''"> PK_DEFDOC11 = #{pkDefdoc11},</if>
  <if test="pkDefdoc12 != null and pkDefdoc12 != ''"> PK_DEFDOC12 = #{pkDefdoc12},</if>
  <if test="pkDefdoc13 != null and pkDefdoc13 != ''"> PK_DEFDOC13 = #{pkDefdoc13},</if>
  <if test="pkDefdoc14 != null and pkDefdoc14 != ''"> PK_DEFDOC14 = #{pkDefdoc14},</if>
  <if test="pkDefdoc15 != null and pkDefdoc15 != ''"> PK_DEFDOC15 = #{pkDefdoc15},</if>
  <if test="pkDefdoc16 != null and pkDefdoc16 != ''"> PK_DEFDOC16 = #{pkDefdoc16},</if>
  <if test="pkDefdoc17 != null and pkDefdoc17 != ''"> PK_DEFDOC17 = #{pkDefdoc17},</if>
  <if test="pkDefdoc18 != null and pkDefdoc18 != ''"> PK_DEFDOC18 = #{pkDefdoc18},</if>
  <if test="pkDefdoc19 != null and pkDefdoc19 != ''"> PK_DEFDOC19 = #{pkDefdoc19},</if>
  <if test="pkDefdoc2 != null and pkDefdoc2 != ''"> PK_DEFDOC2 = #{pkDefdoc2},</if>
  <if test="pkDefdoc20 != null and pkDefdoc20 != ''"> PK_DEFDOC20 = #{pkDefdoc20},</if>
  <if test="pkDefdoc3 != null and pkDefdoc3 != ''"> PK_DEFDOC3 = #{pkDefdoc3},</if>
  <if test="pkDefdoc4 != null and pkDefdoc4 != ''"> PK_DEFDOC4 = #{pkDefdoc4},</if>
  <if test="pkDefdoc5 != null and pkDefdoc5 != ''"> PK_DEFDOC5 = #{pkDefdoc5},</if>
  <if test="pkDefdoc6 != null and pkDefdoc6 != ''"> PK_DEFDOC6 = #{pkDefdoc6},</if>
  <if test="pkDefdoc7 != null and pkDefdoc7 != ''"> PK_DEFDOC7 = #{pkDefdoc7},</if>
  <if test="pkDefdoc8 != null and pkDefdoc8 != ''"> PK_DEFDOC8 = #{pkDefdoc8},</if>
  <if test="pkDefdoc9 != null and pkDefdoc9 != ''"> PK_DEFDOC9 = #{pkDefdoc9},</if>
  <if test="ts != null and ts != ''"> TS = #{ts},</if>
  <if test="vaccountyear != null and vaccountyear != ''"> VACCOUNTYEAR = #{vaccountyear},</if>
  <if test="vdef1 != null and vdef1 != ''"> VDEF1 = #{vdef1},</if>
  <if test="vdef10 != null and vdef10 != ''"> VDEF10 = #{vdef10},</if>
  <if test="vdef11 != null and vdef11 != ''"> VDEF11 = #{vdef11},</if>
  <if test="vdef12 != null and vdef12 != ''"> VDEF12 = #{vdef12},</if>
  <if test="vdef13 != null and vdef13 != ''"> VDEF13 = #{vdef13},</if>
  <if test="vdef14 != null and vdef14 != ''"> VDEF14 = #{vdef14},</if>
  <if test="vdef15 != null and vdef15 != ''"> VDEF15 = #{vdef15},</if>
  <if test="vdef16 != null and vdef16 != ''"> VDEF16 = #{vdef16},</if>
  <if test="vdef17 != null and vdef17 != ''"> VDEF17 = #{vdef17},</if>
  <if test="vdef18 != null and vdef18 != ''"> VDEF18 = #{vdef18},</if>
  <if test="vdef19 != null and vdef19 != ''"> VDEF19 = #{vdef19},</if>
  <if test="vdef2 != null and vdef2 != ''"> VDEF2 = #{vdef2},</if>
  <if test="vdef20 != null and vdef20 != ''"> VDEF20 = #{vdef20},</if>
  <if test="vdef3 != null and vdef3 != ''"> VDEF3 = #{vdef3},</if>
  <if test="vdef4 != null and vdef4 != ''"> VDEF4 = #{vdef4},</if>
  <if test="vdef5 != null and vdef5 != ''"> VDEF5 = #{vdef5},</if>
  <if test="vdef6 != null and vdef6 != ''"> VDEF6 = #{vdef6},</if>
  <if test="vdef7 != null and vdef7 != ''"> VDEF7 = #{vdef7},</if>
  <if test="vdef8 != null and vdef8 != ''"> VDEF8 = #{vdef8},</if>
  <if test="vdef9 != null and vdef9 != ''"> VDEF9 = #{vdef9},</if>
  <if test="veditreason != null and veditreason != ''"> VEDITREASON = #{veditreason},</if>
  <if test="veinvcode != null and veinvcode != ''"> VEINVCODE = #{veinvcode},</if>
  <if test="veinvfailnote != null and veinvfailnote != ''"> VEINVFAILNOTE = #{veinvfailnote},</if>
  <if test="veinvnumber != null and veinvnumber != ''"> VEINVNUMBER = #{veinvnumber},</if>
  <if test="vnote != null and vnote != ''"> VNOTE = #{vnote},</if>
  <if test="vprintcustname != null and vprintcustname != ''"> VPRINTCUSTNAME = #{vprintcustname},</if>
  <if test="vreceiptcode != null and vreceiptcode != ''"> VRECEIPTCODE = #{vreceiptcode},</if>
  <if test="vreceiveaddress != null and vreceiveaddress != ''"> VRECEIVEADDRESS = #{vreceiveaddress},</if>
  <if test="vredflushcause != null and vredflushcause != ''"> VREDFLUSHCAUSE = #{vredflushcause},</if>
  <if test="vredletterinfo != null and vredletterinfo != ''"> VREDLETTERINFO = #{vredletterinfo},</if>
  <if test="vsplitrecord != null and vsplitrecord != ''"> VSPLITRECORD = #{vsplitrecord},</if>
  <if test="vsrceinvcode != null and vsrceinvcode != ''"> VSRCEINVCODE = #{vsrceinvcode},</if>
  <if test="vsrceinvnumber != null and vsrceinvnumber != ''"> VSRCEINVNUMBER = #{vsrceinvnumber},</if>
</trim>
where CSALEID = #{csaleid}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity" >
update SO_SALEINVOICE  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where CSALEID = #{csaleid}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.entity.SoSaleinvoiceEntity" >
update SO_SALEINVOICE  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
 <trim prefix="where" prefixOverrides="and"> 
        <if test="bfreecustflag != null and bfreecustflag != ''"> and BFREECUSTFLAG = #{bfreecustflag} </if>
            <if test="binitflag != null and binitflag != ''"> and BINITFLAG = #{binitflag} </if>
            <if test="btogoldtax != null and btogoldtax != ''"> and BTOGOLDTAX = #{btogoldtax} </if>
            <if test="capproveid != null and capproveid != ''"> and CAPPROVEID = #{capproveid} </if>
            <if test="cbiztype != null and cbiztype != ''"> and CBIZTYPE = #{cbiztype} </if>
            <if test="ccalbodyid != null and ccalbodyid != ''"> and CCALBODYID = #{ccalbodyid} </if>
            <if test="ccreditnum != null and ccreditnum != ''"> and CCREDITNUM = #{ccreditnum} </if>
            <if test="ccustbankid != null and ccustbankid != ''"> and CCUSTBANKID = #{ccustbankid} </if>
            <if test="cdeptid != null and cdeptid != ''"> and CDEPTID = #{cdeptid} </if>
            <if test="cdispatcherid != null and cdispatcherid != ''"> and CDISPATCHERID = #{cdispatcherid} </if>
            <if test="cemployeeid != null and cemployeeid != ''"> and CEMPLOYEEID = #{cemployeeid} </if>
            <if test="cfreecustid != null and cfreecustid != ''"> and CFREECUSTID = #{cfreecustid} </if>
            <if test="cgoldtaxcode != null and cgoldtaxcode != ''"> and CGOLDTAXCODE = #{cgoldtaxcode} </if>
            <if test="coperatorid != null and coperatorid != ''"> and COPERATORID = #{coperatorid} </if>
            <if test="creceiptcorpid != null and creceiptcorpid != ''"> and CRECEIPTCORPID = #{creceiptcorpid} </if>
            <if test="creceiptcustomerid != null and creceiptcustomerid != ''"> and CRECEIPTCUSTOMERID = #{creceiptcustomerid} </if>
            <if test="creceipttype != null and creceipttype != ''"> and CRECEIPTTYPE = #{creceipttype} </if>
            <if test="csalecorpid != null and csalecorpid != ''"> and CSALECORPID = #{csalecorpid} </if>
            <if test="csaleid != null and csaleid != ''"> and CSALEID = #{csaleid} </if>
            <if test="ctermprotocolid != null and ctermprotocolid != ''"> and CTERMPROTOCOLID = #{ctermprotocolid} </if>
            <if test="ctransmodeid != null and ctransmodeid != ''"> and CTRANSMODEID = #{ctransmodeid} </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> and CWAREHOUSEID = #{cwarehouseid} </if>
            <if test="dapprovedate != null and dapprovedate != ''"> and DAPPROVEDATE = #{dapprovedate} </if>
            <if test="daudittime != null and daudittime != ''"> and DAUDITTIME = #{daudittime} </if>
            <if test="dbilldate != null and dbilldate != ''"> and DBILLDATE = #{dbilldate} </if>
            <if test="dbilltime != null and dbilltime != ''"> and DBILLTIME = #{dbilltime} </if>
            <if test="deinvdate != null and deinvdate != ''"> and DEINVDATE = #{deinvdate} </if>
            <if test="dmakedate != null and dmakedate != ''"> and DMAKEDATE = #{dmakedate} </if>
            <if test="dmoditime != null and dmoditime != ''"> and DMODITIME = #{dmoditime} </if>
            <if test="dr != null and dr != ''"> and DR = #{dr} </if>
            <if test="dtogoldtaxtime != null and dtogoldtaxtime != ''"> and DTOGOLDTAXTIME = #{dtogoldtaxtime} </if>
            <if test="fcounteractflag != null and fcounteractflag != ''"> and FCOUNTERACTFLAG = #{fcounteractflag} </if>
            <if test="feinvstatus != null and feinvstatus != ''"> and FEINVSTATUS = #{feinvstatus} </if>
            <if test="finvoiceclass != null and finvoiceclass != ''"> and FINVOICECLASS = #{finvoiceclass} </if>
            <if test="finvoicetype != null and finvoicetype != ''"> and FINVOICETYPE = #{finvoicetype} </if>
            <if test="fstatus != null and fstatus != ''"> and FSTATUS = #{fstatus} </if>
            <if test="ibalanceflag != null and ibalanceflag != ''"> and IBALANCEFLAG = #{ibalanceflag} </if>
            <if test="iprintcount != null and iprintcount != ''"> and IPRINTCOUNT = #{iprintcount} </if>
            <if test="ndiscountrate != null and ndiscountrate != ''"> and NDISCOUNTRATE = #{ndiscountrate} </if>
            <if test="nevaluatecarriage != null and nevaluatecarriage != ''"> and NEVALUATECARRIAGE = #{nevaluatecarriage} </if>
            <if test="nnetmny != null and nnetmny != ''"> and NNETMNY = #{nnetmny} </if>
            <if test="nstrikemny != null and nstrikemny != ''"> and NSTRIKEMNY = #{nstrikemny} </if>
            <if test="nsubscription != null and nsubscription != ''"> and NSUBSCRIPTION = #{nsubscription} </if>
            <if test="ntotalnum != null and ntotalnum != ''"> and NTOTALNUM = #{ntotalnum} </if>
            <if test="ntotalsummny != null and ntotalsummny != ''"> and NTOTALSUMMNY = #{ntotalsummny} </if>
            <if test="pkConnected != null and pkConnected != ''"> and PK_CONNECTED = #{pkConnected} </if>
            <if test="pkCorp != null and pkCorp != ''"> and PK_CORP = #{pkCorp} </if>
            <if test="pkDefdoc1 != null and pkDefdoc1 != ''"> and PK_DEFDOC1 = #{pkDefdoc1} </if>
            <if test="pkDefdoc10 != null and pkDefdoc10 != ''"> and PK_DEFDOC10 = #{pkDefdoc10} </if>
            <if test="pkDefdoc11 != null and pkDefdoc11 != ''"> and PK_DEFDOC11 = #{pkDefdoc11} </if>
            <if test="pkDefdoc12 != null and pkDefdoc12 != ''"> and PK_DEFDOC12 = #{pkDefdoc12} </if>
            <if test="pkDefdoc13 != null and pkDefdoc13 != ''"> and PK_DEFDOC13 = #{pkDefdoc13} </if>
            <if test="pkDefdoc14 != null and pkDefdoc14 != ''"> and PK_DEFDOC14 = #{pkDefdoc14} </if>
            <if test="pkDefdoc15 != null and pkDefdoc15 != ''"> and PK_DEFDOC15 = #{pkDefdoc15} </if>
            <if test="pkDefdoc16 != null and pkDefdoc16 != ''"> and PK_DEFDOC16 = #{pkDefdoc16} </if>
            <if test="pkDefdoc17 != null and pkDefdoc17 != ''"> and PK_DEFDOC17 = #{pkDefdoc17} </if>
            <if test="pkDefdoc18 != null and pkDefdoc18 != ''"> and PK_DEFDOC18 = #{pkDefdoc18} </if>
            <if test="pkDefdoc19 != null and pkDefdoc19 != ''"> and PK_DEFDOC19 = #{pkDefdoc19} </if>
            <if test="pkDefdoc2 != null and pkDefdoc2 != ''"> and PK_DEFDOC2 = #{pkDefdoc2} </if>
            <if test="pkDefdoc20 != null and pkDefdoc20 != ''"> and PK_DEFDOC20 = #{pkDefdoc20} </if>
            <if test="pkDefdoc3 != null and pkDefdoc3 != ''"> and PK_DEFDOC3 = #{pkDefdoc3} </if>
            <if test="pkDefdoc4 != null and pkDefdoc4 != ''"> and PK_DEFDOC4 = #{pkDefdoc4} </if>
            <if test="pkDefdoc5 != null and pkDefdoc5 != ''"> and PK_DEFDOC5 = #{pkDefdoc5} </if>
            <if test="pkDefdoc6 != null and pkDefdoc6 != ''"> and PK_DEFDOC6 = #{pkDefdoc6} </if>
            <if test="pkDefdoc7 != null and pkDefdoc7 != ''"> and PK_DEFDOC7 = #{pkDefdoc7} </if>
            <if test="pkDefdoc8 != null and pkDefdoc8 != ''"> and PK_DEFDOC8 = #{pkDefdoc8} </if>
            <if test="pkDefdoc9 != null and pkDefdoc9 != ''"> and PK_DEFDOC9 = #{pkDefdoc9} </if>
            <if test="ts != null and ts != ''"> and TS = #{ts} </if>
            <if test="vaccountyear != null and vaccountyear != ''"> and VACCOUNTYEAR = #{vaccountyear} </if>
            <if test="vdef1 != null and vdef1 != ''"> and VDEF1 = #{vdef1} </if>
            <if test="vdef10 != null and vdef10 != ''"> and VDEF10 = #{vdef10} </if>
            <if test="vdef11 != null and vdef11 != ''"> and VDEF11 = #{vdef11} </if>
            <if test="vdef12 != null and vdef12 != ''"> and VDEF12 = #{vdef12} </if>
            <if test="vdef13 != null and vdef13 != ''"> and VDEF13 = #{vdef13} </if>
            <if test="vdef14 != null and vdef14 != ''"> and VDEF14 = #{vdef14} </if>
            <if test="vdef15 != null and vdef15 != ''"> and VDEF15 = #{vdef15} </if>
            <if test="vdef16 != null and vdef16 != ''"> and VDEF16 = #{vdef16} </if>
            <if test="vdef17 != null and vdef17 != ''"> and VDEF17 = #{vdef17} </if>
            <if test="vdef18 != null and vdef18 != ''"> and VDEF18 = #{vdef18} </if>
            <if test="vdef19 != null and vdef19 != ''"> and VDEF19 = #{vdef19} </if>
            <if test="vdef2 != null and vdef2 != ''"> and VDEF2 = #{vdef2} </if>
            <if test="vdef20 != null and vdef20 != ''"> and VDEF20 = #{vdef20} </if>
            <if test="vdef3 != null and vdef3 != ''"> and VDEF3 = #{vdef3} </if>
            <if test="vdef4 != null and vdef4 != ''"> and VDEF4 = #{vdef4} </if>
            <if test="vdef5 != null and vdef5 != ''"> and VDEF5 = #{vdef5} </if>
            <if test="vdef6 != null and vdef6 != ''"> and VDEF6 = #{vdef6} </if>
            <if test="vdef7 != null and vdef7 != ''"> and VDEF7 = #{vdef7} </if>
            <if test="vdef8 != null and vdef8 != ''"> and VDEF8 = #{vdef8} </if>
            <if test="vdef9 != null and vdef9 != ''"> and VDEF9 = #{vdef9} </if>
            <if test="veditreason != null and veditreason != ''"> and VEDITREASON = #{veditreason} </if>
            <if test="veinvcode != null and veinvcode != ''"> and VEINVCODE = #{veinvcode} </if>
            <if test="veinvfailnote != null and veinvfailnote != ''"> and VEINVFAILNOTE = #{veinvfailnote} </if>
            <if test="veinvnumber != null and veinvnumber != ''"> and VEINVNUMBER = #{veinvnumber} </if>
            <if test="vnote != null and vnote != ''"> and VNOTE = #{vnote} </if>
            <if test="vprintcustname != null and vprintcustname != ''"> and VPRINTCUSTNAME = #{vprintcustname} </if>
            <if test="vreceiptcode != null and vreceiptcode != ''"> and VRECEIPTCODE = #{vreceiptcode} </if>
            <if test="vreceiveaddress != null and vreceiveaddress != ''"> and VRECEIVEADDRESS = #{vreceiveaddress} </if>
            <if test="vredflushcause != null and vredflushcause != ''"> and VREDFLUSHCAUSE = #{vredflushcause} </if>
            <if test="vredletterinfo != null and vredletterinfo != ''"> and VREDLETTERINFO = #{vredletterinfo} </if>
            <if test="vsplitrecord != null and vsplitrecord != ''"> and VSPLITRECORD = #{vsplitrecord} </if>
            <if test="vsrceinvcode != null and vsrceinvcode != ''"> and VSRCEINVCODE = #{vsrceinvcode} </if>
            <if test="vsrceinvnumber != null and vsrceinvnumber != ''"> and VSRCEINVNUMBER = #{vsrceinvnumber} </if>
            and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from SO_SALEINVOICE where CSALEID = #{csaleid}
</delete>

</mapper>

