<?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.IcSpecialBDaoImpl">

    <resultMap id="get-IcSpecialBEntity-result" type="com.hzya.frame.plugin.lets.entity.IcSpecialBEntity" >
       <result property="castunitid" column="castunitid" jdbcType="VARCHAR"/>
           <result property="cfirstbillbid" column="cfirstbillbid" jdbcType="VARCHAR"/>
           <result property="cfirstbillhid" column="cfirstbillhid" jdbcType="VARCHAR"/>
           <result property="cfirsttype" column="cfirsttype" jdbcType="VARCHAR"/>
           <result property="cinventoryid" column="cinventoryid" jdbcType="VARCHAR"/>
           <result property="crowno" column="crowno" jdbcType="VARCHAR"/>
           <result property="csourcebillbid" column="csourcebillbid" jdbcType="VARCHAR"/>
           <result property="csourcebillhid" column="csourcebillhid" jdbcType="VARCHAR"/>
           <result property="csourcetype" column="csourcetype" jdbcType="VARCHAR"/>
           <result property="cspaceid" column="cspaceid" jdbcType="VARCHAR"/>
           <result property="cspecialbid" column="cspecialbid" jdbcType="VARCHAR"/>
           <result property="cspecialhid" column="cspecialhid" jdbcType="VARCHAR"/>
           <result property="cvendorid" column="cvendorid" jdbcType="VARCHAR"/>
           <result property="cwarehouseid" column="cwarehouseid" jdbcType="VARCHAR"/>
           <result property="dr" column="dr" jdbcType="INTEGER"/>
           <result property="dshldtransnum" column="dshldtransnum" jdbcType="NUMERIC"/>
           <result property="dvalidate" column="dvalidate" jdbcType="VARCHAR"/>
           <result property="fbillrowflag" column="fbillrowflag" jdbcType="INTEGER"/>
           <result property="hsl" column="hsl" jdbcType="NUMERIC"/>
           <result property="naccountastnum" column="naccountastnum" jdbcType="NUMERIC"/>
           <result property="naccountgrsnum" column="naccountgrsnum" jdbcType="NUMERIC"/>
           <result property="naccountnum" column="naccountnum" jdbcType="NUMERIC"/>
           <result property="nadjustastnum" column="nadjustastnum" jdbcType="NUMERIC"/>
           <result property="nadjustgrsnum" column="nadjustgrsnum" jdbcType="NUMERIC"/>
           <result property="nadjustnum" column="nadjustnum" jdbcType="NUMERIC"/>
           <result property="nbarcodenum" column="nbarcodenum" jdbcType="NUMERIC"/>
           <result property="ncheckastnum" column="ncheckastnum" jdbcType="NUMERIC"/>
           <result property="ncheckgrsnum" column="ncheckgrsnum" jdbcType="NUMERIC"/>
           <result property="nchecknum" column="nchecknum" jdbcType="NUMERIC"/>
           <result property="nmny" column="nmny" jdbcType="NUMERIC"/>
           <result property="nperiodastnum" column="nperiodastnum" jdbcType="NUMERIC"/>
           <result property="nperiodnum" column="nperiodnum" jdbcType="NUMERIC"/>
           <result property="nplannedmny" column="nplannedmny" jdbcType="NUMERIC"/>
           <result property="nplannedprice" column="nplannedprice" jdbcType="NUMERIC"/>
           <result property="nprice" column="nprice" jdbcType="NUMERIC"/>
           <result property="nshldtransastnum" column="nshldtransastnum" jdbcType="NUMERIC"/>
           <result property="nshldtransgrsnum" column="nshldtransgrsnum" jdbcType="NUMERIC"/>
           <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="vbatchcode" column="vbatchcode" jdbcType="VARCHAR"/>
           <result property="vfree1" column="vfree1" jdbcType="VARCHAR"/>
           <result property="vfree10" column="vfree10" jdbcType="VARCHAR"/>
           <result property="vfree2" column="vfree2" jdbcType="VARCHAR"/>
           <result property="vfree3" column="vfree3" jdbcType="VARCHAR"/>
           <result property="vfree4" column="vfree4" jdbcType="VARCHAR"/>
           <result property="vfree5" column="vfree5" jdbcType="VARCHAR"/>
           <result property="vfree6" column="vfree6" jdbcType="VARCHAR"/>
           <result property="vfree7" column="vfree7" jdbcType="VARCHAR"/>
           <result property="vfree8" column="vfree8" jdbcType="VARCHAR"/>
           <result property="vfree9" column="vfree9" jdbcType="VARCHAR"/>
           <result property="vnote" column="vnote" jdbcType="VARCHAR"/>
           <result property="vsourcebillcode" column="vsourcebillcode" jdbcType="VARCHAR"/>
           <result property="vuserdef1" column="vuserdef1" jdbcType="VARCHAR"/>
           <result property="vuserdef10" column="vuserdef10" jdbcType="VARCHAR"/>
           <result property="vuserdef11" column="vuserdef11" jdbcType="VARCHAR"/>
           <result property="vuserdef12" column="vuserdef12" jdbcType="VARCHAR"/>
           <result property="vuserdef13" column="vuserdef13" jdbcType="VARCHAR"/>
           <result property="vuserdef14" column="vuserdef14" jdbcType="VARCHAR"/>
           <result property="vuserdef15" column="vuserdef15" jdbcType="VARCHAR"/>
           <result property="vuserdef16" column="vuserdef16" jdbcType="VARCHAR"/>
           <result property="vuserdef17" column="vuserdef17" jdbcType="VARCHAR"/>
           <result property="vuserdef18" column="vuserdef18" jdbcType="VARCHAR"/>
           <result property="vuserdef19" column="vuserdef19" jdbcType="VARCHAR"/>
           <result property="vuserdef2" column="vuserdef2" jdbcType="VARCHAR"/>
           <result property="vuserdef20" column="vuserdef20" jdbcType="VARCHAR"/>
           <result property="vuserdef3" column="vuserdef3" jdbcType="VARCHAR"/>
           <result property="vuserdef4" column="vuserdef4" jdbcType="VARCHAR"/>
           <result property="vuserdef5" column="vuserdef5" jdbcType="VARCHAR"/>
           <result property="vuserdef6" column="vuserdef6" jdbcType="VARCHAR"/>
           <result property="vuserdef7" column="vuserdef7" jdbcType="VARCHAR"/>
           <result property="vuserdef8" column="vuserdef8" jdbcType="VARCHAR"/>
           <result property="vuserdef9" column="vuserdef9" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "IcSpecialBEntity_Base_Column_List">
        castunitid
       ,cfirstbillbid 
        ,cfirstbillhid 
        ,cfirsttype 
        ,cinventoryid 
        ,crowno 
        ,csourcebillbid 
        ,csourcebillhid 
        ,csourcetype 
        ,cspaceid 
        ,cspecialbid 
        ,cspecialhid 
        ,cvendorid 
        ,cwarehouseid 
        ,dr 
        ,dshldtransnum 
        ,dvalidate 
        ,fbillrowflag 
        ,hsl 
        ,naccountastnum 
        ,naccountgrsnum 
        ,naccountnum 
        ,nadjustastnum 
        ,nadjustgrsnum 
        ,nadjustnum 
        ,nbarcodenum 
        ,ncheckastnum 
        ,ncheckgrsnum 
        ,nchecknum 
        ,nmny 
        ,nperiodastnum 
        ,nperiodnum 
        ,nplannedmny 
        ,nplannedprice 
        ,nprice 
        ,nshldtransastnum 
        ,nshldtransgrsnum 
        ,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 
        ,vbatchcode 
        ,vfree1 
        ,vfree10 
        ,vfree2 
        ,vfree3 
        ,vfree4 
        ,vfree5 
        ,vfree6 
        ,vfree7 
        ,vfree8 
        ,vfree9 
        ,vnote 
        ,vsourcebillcode 
        ,vuserdef1 
        ,vuserdef10 
        ,vuserdef11 
        ,vuserdef12 
        ,vuserdef13 
        ,vuserdef14 
        ,vuserdef15 
        ,vuserdef16 
        ,vuserdef17 
        ,vuserdef18 
        ,vuserdef19 
        ,vuserdef2 
        ,vuserdef20 
        ,vuserdef3 
        ,vuserdef4 
        ,vuserdef5 
        ,vuserdef6 
        ,vuserdef7 
        ,vuserdef8 
        ,vuserdef9 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-IcSpecialBEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.IcSpecialBEntity">
    select
    <include refid="IcSpecialBEntity_Base_Column_List" />
    from ic_special_b
    <trim prefix="where" prefixOverrides="and"> 
        <if test="castunitid != null and castunitid != ''"> and castunitid = #{castunitid} </if>
            <if test="cfirstbillbid != null and cfirstbillbid != ''"> and cfirstbillbid = #{cfirstbillbid} </if>
            <if test="cfirstbillhid != null and cfirstbillhid != ''"> and cfirstbillhid = #{cfirstbillhid} </if>
            <if test="cfirsttype != null and cfirsttype != ''"> and cfirsttype = #{cfirsttype} </if>
            <if test="cinventoryid != null and cinventoryid != ''"> and cinventoryid = #{cinventoryid} </if>
            <if test="crowno != null and crowno != ''"> and crowno = #{crowno} </if>
            <if test="csourcebillbid != null and csourcebillbid != ''"> and csourcebillbid = #{csourcebillbid} </if>
            <if test="csourcebillhid != null and csourcebillhid != ''"> and csourcebillhid = #{csourcebillhid} </if>
            <if test="csourcetype != null and csourcetype != ''"> and csourcetype = #{csourcetype} </if>
            <if test="cspaceid != null and cspaceid != ''"> and cspaceid = #{cspaceid} </if>
            <if test="cspecialbid != null and cspecialbid != ''"> and cspecialbid = #{cspecialbid} </if>
            <if test="cspecialhid != null and cspecialhid != ''"> and cspecialhid = #{cspecialhid} </if>
            <if test="cvendorid != null and cvendorid != ''"> and cvendorid = #{cvendorid} </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> and cwarehouseid = #{cwarehouseid} </if>
            <if test="dr != null"> and dr = #{dr} </if>
            <if test="dshldtransnum != null"> and dshldtransnum = #{dshldtransnum} </if>
            <if test="dvalidate != null and dvalidate != ''"> and dvalidate = #{dvalidate} </if>
            <if test="fbillrowflag != null"> and fbillrowflag = #{fbillrowflag} </if>
            <if test="hsl != null"> and hsl = #{hsl} </if>
            <if test="naccountastnum != null"> and naccountastnum = #{naccountastnum} </if>
            <if test="naccountgrsnum != null"> and naccountgrsnum = #{naccountgrsnum} </if>
            <if test="naccountnum != null"> and naccountnum = #{naccountnum} </if>
            <if test="nadjustastnum != null"> and nadjustastnum = #{nadjustastnum} </if>
            <if test="nadjustgrsnum != null"> and nadjustgrsnum = #{nadjustgrsnum} </if>
            <if test="nadjustnum != null"> and nadjustnum = #{nadjustnum} </if>
            <if test="nbarcodenum != null"> and nbarcodenum = #{nbarcodenum} </if>
            <if test="ncheckastnum != null"> and ncheckastnum = #{ncheckastnum} </if>
            <if test="ncheckgrsnum != null"> and ncheckgrsnum = #{ncheckgrsnum} </if>
            <if test="nchecknum != null"> and nchecknum = #{nchecknum} </if>
            <if test="nmny != null"> and nmny = #{nmny} </if>
            <if test="nperiodastnum != null"> and nperiodastnum = #{nperiodastnum} </if>
            <if test="nperiodnum != null"> and nperiodnum = #{nperiodnum} </if>
            <if test="nplannedmny != null"> and nplannedmny = #{nplannedmny} </if>
            <if test="nplannedprice != null"> and nplannedprice = #{nplannedprice} </if>
            <if test="nprice != null"> and nprice = #{nprice} </if>
            <if test="nshldtransastnum != null"> and nshldtransastnum = #{nshldtransastnum} </if>
            <if test="nshldtransgrsnum != null"> and nshldtransgrsnum = #{nshldtransgrsnum} </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="vbatchcode != null and vbatchcode != ''"> and vbatchcode = #{vbatchcode} </if>
            <if test="vfree1 != null and vfree1 != ''"> and vfree1 = #{vfree1} </if>
            <if test="vfree10 != null and vfree10 != ''"> and vfree10 = #{vfree10} </if>
            <if test="vfree2 != null and vfree2 != ''"> and vfree2 = #{vfree2} </if>
            <if test="vfree3 != null and vfree3 != ''"> and vfree3 = #{vfree3} </if>
            <if test="vfree4 != null and vfree4 != ''"> and vfree4 = #{vfree4} </if>
            <if test="vfree5 != null and vfree5 != ''"> and vfree5 = #{vfree5} </if>
            <if test="vfree6 != null and vfree6 != ''"> and vfree6 = #{vfree6} </if>
            <if test="vfree7 != null and vfree7 != ''"> and vfree7 = #{vfree7} </if>
            <if test="vfree8 != null and vfree8 != ''"> and vfree8 = #{vfree8} </if>
            <if test="vfree9 != null and vfree9 != ''"> and vfree9 = #{vfree9} </if>
            <if test="vnote != null and vnote != ''"> and vnote = #{vnote} </if>
            <if test="vsourcebillcode != null and vsourcebillcode != ''"> and vsourcebillcode = #{vsourcebillcode} </if>
            <if test="vuserdef1 != null and vuserdef1 != ''"> and vuserdef1 = #{vuserdef1} </if>
            <if test="vuserdef10 != null and vuserdef10 != ''"> and vuserdef10 = #{vuserdef10} </if>
            <if test="vuserdef11 != null and vuserdef11 != ''"> and vuserdef11 = #{vuserdef11} </if>
            <if test="vuserdef12 != null and vuserdef12 != ''"> and vuserdef12 = #{vuserdef12} </if>
            <if test="vuserdef13 != null and vuserdef13 != ''"> and vuserdef13 = #{vuserdef13} </if>
            <if test="vuserdef14 != null and vuserdef14 != ''"> and vuserdef14 = #{vuserdef14} </if>
            <if test="vuserdef15 != null and vuserdef15 != ''"> and vuserdef15 = #{vuserdef15} </if>
            <if test="vuserdef16 != null and vuserdef16 != ''"> and vuserdef16 = #{vuserdef16} </if>
            <if test="vuserdef17 != null and vuserdef17 != ''"> and vuserdef17 = #{vuserdef17} </if>
            <if test="vuserdef18 != null and vuserdef18 != ''"> and vuserdef18 = #{vuserdef18} </if>
            <if test="vuserdef19 != null and vuserdef19 != ''"> and vuserdef19 = #{vuserdef19} </if>
            <if test="vuserdef2 != null and vuserdef2 != ''"> and vuserdef2 = #{vuserdef2} </if>
            <if test="vuserdef20 != null and vuserdef20 != ''"> and vuserdef20 = #{vuserdef20} </if>
            <if test="vuserdef3 != null and vuserdef3 != ''"> and vuserdef3 = #{vuserdef3} </if>
            <if test="vuserdef4 != null and vuserdef4 != ''"> and vuserdef4 = #{vuserdef4} </if>
            <if test="vuserdef5 != null and vuserdef5 != ''"> and vuserdef5 = #{vuserdef5} </if>
            <if test="vuserdef6 != null and vuserdef6 != ''"> and vuserdef6 = #{vuserdef6} </if>
            <if test="vuserdef7 != null and vuserdef7 != ''"> and vuserdef7 = #{vuserdef7} </if>
            <if test="vuserdef8 != null and vuserdef8 != ''"> and vuserdef8 = #{vuserdef8} </if>
            <if test="vuserdef9 != null and vuserdef9 != ''"> and vuserdef9 = #{vuserdef9} </if>
            and dr='0'
    </trim>
</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.lets.entity.IcSpecialBEntity">
        select  count(1)   from ic_special_b
    <trim prefix="where" prefixOverrides="and"> 
        <if test="castunitid != null and castunitid != ''"> and castunitid = #{castunitid} </if>
            <if test="cfirstbillbid != null and cfirstbillbid != ''"> and cfirstbillbid = #{cfirstbillbid} </if>
            <if test="cfirstbillhid != null and cfirstbillhid != ''"> and cfirstbillhid = #{cfirstbillhid} </if>
            <if test="cfirsttype != null and cfirsttype != ''"> and cfirsttype = #{cfirsttype} </if>
            <if test="cinventoryid != null and cinventoryid != ''"> and cinventoryid = #{cinventoryid} </if>
            <if test="crowno != null and crowno != ''"> and crowno = #{crowno} </if>
            <if test="csourcebillbid != null and csourcebillbid != ''"> and csourcebillbid = #{csourcebillbid} </if>
            <if test="csourcebillhid != null and csourcebillhid != ''"> and csourcebillhid = #{csourcebillhid} </if>
            <if test="csourcetype != null and csourcetype != ''"> and csourcetype = #{csourcetype} </if>
            <if test="cspaceid != null and cspaceid != ''"> and cspaceid = #{cspaceid} </if>
            <if test="cspecialbid != null and cspecialbid != ''"> and cspecialbid = #{cspecialbid} </if>
            <if test="cspecialhid != null and cspecialhid != ''"> and cspecialhid = #{cspecialhid} </if>
            <if test="cvendorid != null and cvendorid != ''"> and cvendorid = #{cvendorid} </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> and cwarehouseid = #{cwarehouseid} </if>
            <if test="dr != null"> and dr = #{dr} </if>
            <if test="dshldtransnum != null"> and dshldtransnum = #{dshldtransnum} </if>
            <if test="dvalidate != null and dvalidate != ''"> and dvalidate = #{dvalidate} </if>
            <if test="fbillrowflag != null"> and fbillrowflag = #{fbillrowflag} </if>
            <if test="hsl != null"> and hsl = #{hsl} </if>
            <if test="naccountastnum != null"> and naccountastnum = #{naccountastnum} </if>
            <if test="naccountgrsnum != null"> and naccountgrsnum = #{naccountgrsnum} </if>
            <if test="naccountnum != null"> and naccountnum = #{naccountnum} </if>
            <if test="nadjustastnum != null"> and nadjustastnum = #{nadjustastnum} </if>
            <if test="nadjustgrsnum != null"> and nadjustgrsnum = #{nadjustgrsnum} </if>
            <if test="nadjustnum != null"> and nadjustnum = #{nadjustnum} </if>
            <if test="nbarcodenum != null"> and nbarcodenum = #{nbarcodenum} </if>
            <if test="ncheckastnum != null"> and ncheckastnum = #{ncheckastnum} </if>
            <if test="ncheckgrsnum != null"> and ncheckgrsnum = #{ncheckgrsnum} </if>
            <if test="nchecknum != null"> and nchecknum = #{nchecknum} </if>
            <if test="nmny != null"> and nmny = #{nmny} </if>
            <if test="nperiodastnum != null"> and nperiodastnum = #{nperiodastnum} </if>
            <if test="nperiodnum != null"> and nperiodnum = #{nperiodnum} </if>
            <if test="nplannedmny != null"> and nplannedmny = #{nplannedmny} </if>
            <if test="nplannedprice != null"> and nplannedprice = #{nplannedprice} </if>
            <if test="nprice != null"> and nprice = #{nprice} </if>
            <if test="nshldtransastnum != null"> and nshldtransastnum = #{nshldtransastnum} </if>
            <if test="nshldtransgrsnum != null"> and nshldtransgrsnum = #{nshldtransgrsnum} </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="vbatchcode != null and vbatchcode != ''"> and vbatchcode = #{vbatchcode} </if>
            <if test="vfree1 != null and vfree1 != ''"> and vfree1 = #{vfree1} </if>
            <if test="vfree10 != null and vfree10 != ''"> and vfree10 = #{vfree10} </if>
            <if test="vfree2 != null and vfree2 != ''"> and vfree2 = #{vfree2} </if>
            <if test="vfree3 != null and vfree3 != ''"> and vfree3 = #{vfree3} </if>
            <if test="vfree4 != null and vfree4 != ''"> and vfree4 = #{vfree4} </if>
            <if test="vfree5 != null and vfree5 != ''"> and vfree5 = #{vfree5} </if>
            <if test="vfree6 != null and vfree6 != ''"> and vfree6 = #{vfree6} </if>
            <if test="vfree7 != null and vfree7 != ''"> and vfree7 = #{vfree7} </if>
            <if test="vfree8 != null and vfree8 != ''"> and vfree8 = #{vfree8} </if>
            <if test="vfree9 != null and vfree9 != ''"> and vfree9 = #{vfree9} </if>
            <if test="vnote != null and vnote != ''"> and vnote = #{vnote} </if>
            <if test="vsourcebillcode != null and vsourcebillcode != ''"> and vsourcebillcode = #{vsourcebillcode} </if>
            <if test="vuserdef1 != null and vuserdef1 != ''"> and vuserdef1 = #{vuserdef1} </if>
            <if test="vuserdef10 != null and vuserdef10 != ''"> and vuserdef10 = #{vuserdef10} </if>
            <if test="vuserdef11 != null and vuserdef11 != ''"> and vuserdef11 = #{vuserdef11} </if>
            <if test="vuserdef12 != null and vuserdef12 != ''"> and vuserdef12 = #{vuserdef12} </if>
            <if test="vuserdef13 != null and vuserdef13 != ''"> and vuserdef13 = #{vuserdef13} </if>
            <if test="vuserdef14 != null and vuserdef14 != ''"> and vuserdef14 = #{vuserdef14} </if>
            <if test="vuserdef15 != null and vuserdef15 != ''"> and vuserdef15 = #{vuserdef15} </if>
            <if test="vuserdef16 != null and vuserdef16 != ''"> and vuserdef16 = #{vuserdef16} </if>
            <if test="vuserdef17 != null and vuserdef17 != ''"> and vuserdef17 = #{vuserdef17} </if>
            <if test="vuserdef18 != null and vuserdef18 != ''"> and vuserdef18 = #{vuserdef18} </if>
            <if test="vuserdef19 != null and vuserdef19 != ''"> and vuserdef19 = #{vuserdef19} </if>
            <if test="vuserdef2 != null and vuserdef2 != ''"> and vuserdef2 = #{vuserdef2} </if>
            <if test="vuserdef20 != null and vuserdef20 != ''"> and vuserdef20 = #{vuserdef20} </if>
            <if test="vuserdef3 != null and vuserdef3 != ''"> and vuserdef3 = #{vuserdef3} </if>
            <if test="vuserdef4 != null and vuserdef4 != ''"> and vuserdef4 = #{vuserdef4} </if>
            <if test="vuserdef5 != null and vuserdef5 != ''"> and vuserdef5 = #{vuserdef5} </if>
            <if test="vuserdef6 != null and vuserdef6 != ''"> and vuserdef6 = #{vuserdef6} </if>
            <if test="vuserdef7 != null and vuserdef7 != ''"> and vuserdef7 = #{vuserdef7} </if>
            <if test="vuserdef8 != null and vuserdef8 != ''"> and vuserdef8 = #{vuserdef8} </if>
            <if test="vuserdef9 != null and vuserdef9 != ''"> and vuserdef9 = #{vuserdef9} </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-IcSpecialBEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.IcSpecialBEntity">
    select
    <include refid="IcSpecialBEntity_Base_Column_List" />
    from ic_special_b
    <trim prefix="where" prefixOverrides="and"> 
        <if test="castunitid != null and castunitid != ''"> and castunitid like concat('%',#{castunitid},'%') </if>
            <if test="cfirstbillbid != null and cfirstbillbid != ''"> and cfirstbillbid like concat('%',#{cfirstbillbid},'%') </if>
            <if test="cfirstbillhid != null and cfirstbillhid != ''"> and cfirstbillhid like concat('%',#{cfirstbillhid},'%') </if>
            <if test="cfirsttype != null and cfirsttype != ''"> and cfirsttype like concat('%',#{cfirsttype},'%') </if>
            <if test="cinventoryid != null and cinventoryid != ''"> and cinventoryid like concat('%',#{cinventoryid},'%') </if>
            <if test="crowno != null and crowno != ''"> and crowno like concat('%',#{crowno},'%') </if>
            <if test="csourcebillbid != null and csourcebillbid != ''"> and csourcebillbid like concat('%',#{csourcebillbid},'%') </if>
            <if test="csourcebillhid != null and csourcebillhid != ''"> and csourcebillhid like concat('%',#{csourcebillhid},'%') </if>
            <if test="csourcetype != null and csourcetype != ''"> and csourcetype like concat('%',#{csourcetype},'%') </if>
            <if test="cspaceid != null and cspaceid != ''"> and cspaceid like concat('%',#{cspaceid},'%') </if>
            <if test="cspecialbid != null and cspecialbid != ''"> and cspecialbid like concat('%',#{cspecialbid},'%') </if>
            <if test="cspecialhid != null and cspecialhid != ''"> and cspecialhid like concat('%',#{cspecialhid},'%') </if>
            <if test="cvendorid != null and cvendorid != ''"> and cvendorid like concat('%',#{cvendorid},'%') </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> and cwarehouseid like concat('%',#{cwarehouseid},'%') </if>
            <if test="dr != null"> and dr like concat('%',#{dr},'%') </if>
            <if test="dshldtransnum != null"> and dshldtransnum like concat('%',#{dshldtransnum},'%') </if>
            <if test="dvalidate != null and dvalidate != ''"> and dvalidate like concat('%',#{dvalidate},'%') </if>
            <if test="fbillrowflag != null"> and fbillrowflag like concat('%',#{fbillrowflag},'%') </if>
            <if test="hsl != null"> and hsl like concat('%',#{hsl},'%') </if>
            <if test="naccountastnum != null"> and naccountastnum like concat('%',#{naccountastnum},'%') </if>
            <if test="naccountgrsnum != null"> and naccountgrsnum like concat('%',#{naccountgrsnum},'%') </if>
            <if test="naccountnum != null"> and naccountnum like concat('%',#{naccountnum},'%') </if>
            <if test="nadjustastnum != null"> and nadjustastnum like concat('%',#{nadjustastnum},'%') </if>
            <if test="nadjustgrsnum != null"> and nadjustgrsnum like concat('%',#{nadjustgrsnum},'%') </if>
            <if test="nadjustnum != null"> and nadjustnum like concat('%',#{nadjustnum},'%') </if>
            <if test="nbarcodenum != null"> and nbarcodenum like concat('%',#{nbarcodenum},'%') </if>
            <if test="ncheckastnum != null"> and ncheckastnum like concat('%',#{ncheckastnum},'%') </if>
            <if test="ncheckgrsnum != null"> and ncheckgrsnum like concat('%',#{ncheckgrsnum},'%') </if>
            <if test="nchecknum != null"> and nchecknum like concat('%',#{nchecknum},'%') </if>
            <if test="nmny != null"> and nmny like concat('%',#{nmny},'%') </if>
            <if test="nperiodastnum != null"> and nperiodastnum like concat('%',#{nperiodastnum},'%') </if>
            <if test="nperiodnum != null"> and nperiodnum like concat('%',#{nperiodnum},'%') </if>
            <if test="nplannedmny != null"> and nplannedmny like concat('%',#{nplannedmny},'%') </if>
            <if test="nplannedprice != null"> and nplannedprice like concat('%',#{nplannedprice},'%') </if>
            <if test="nprice != null"> and nprice like concat('%',#{nprice},'%') </if>
            <if test="nshldtransastnum != null"> and nshldtransastnum like concat('%',#{nshldtransastnum},'%') </if>
            <if test="nshldtransgrsnum != null"> and nshldtransgrsnum like concat('%',#{nshldtransgrsnum},'%') </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="vbatchcode != null and vbatchcode != ''"> and vbatchcode like concat('%',#{vbatchcode},'%') </if>
            <if test="vfree1 != null and vfree1 != ''"> and vfree1 like concat('%',#{vfree1},'%') </if>
            <if test="vfree10 != null and vfree10 != ''"> and vfree10 like concat('%',#{vfree10},'%') </if>
            <if test="vfree2 != null and vfree2 != ''"> and vfree2 like concat('%',#{vfree2},'%') </if>
            <if test="vfree3 != null and vfree3 != ''"> and vfree3 like concat('%',#{vfree3},'%') </if>
            <if test="vfree4 != null and vfree4 != ''"> and vfree4 like concat('%',#{vfree4},'%') </if>
            <if test="vfree5 != null and vfree5 != ''"> and vfree5 like concat('%',#{vfree5},'%') </if>
            <if test="vfree6 != null and vfree6 != ''"> and vfree6 like concat('%',#{vfree6},'%') </if>
            <if test="vfree7 != null and vfree7 != ''"> and vfree7 like concat('%',#{vfree7},'%') </if>
            <if test="vfree8 != null and vfree8 != ''"> and vfree8 like concat('%',#{vfree8},'%') </if>
            <if test="vfree9 != null and vfree9 != ''"> and vfree9 like concat('%',#{vfree9},'%') </if>
            <if test="vnote != null and vnote != ''"> and vnote like concat('%',#{vnote},'%') </if>
            <if test="vsourcebillcode != null and vsourcebillcode != ''"> and vsourcebillcode like concat('%',#{vsourcebillcode},'%') </if>
            <if test="vuserdef1 != null and vuserdef1 != ''"> and vuserdef1 like concat('%',#{vuserdef1},'%') </if>
            <if test="vuserdef10 != null and vuserdef10 != ''"> and vuserdef10 like concat('%',#{vuserdef10},'%') </if>
            <if test="vuserdef11 != null and vuserdef11 != ''"> and vuserdef11 like concat('%',#{vuserdef11},'%') </if>
            <if test="vuserdef12 != null and vuserdef12 != ''"> and vuserdef12 like concat('%',#{vuserdef12},'%') </if>
            <if test="vuserdef13 != null and vuserdef13 != ''"> and vuserdef13 like concat('%',#{vuserdef13},'%') </if>
            <if test="vuserdef14 != null and vuserdef14 != ''"> and vuserdef14 like concat('%',#{vuserdef14},'%') </if>
            <if test="vuserdef15 != null and vuserdef15 != ''"> and vuserdef15 like concat('%',#{vuserdef15},'%') </if>
            <if test="vuserdef16 != null and vuserdef16 != ''"> and vuserdef16 like concat('%',#{vuserdef16},'%') </if>
            <if test="vuserdef17 != null and vuserdef17 != ''"> and vuserdef17 like concat('%',#{vuserdef17},'%') </if>
            <if test="vuserdef18 != null and vuserdef18 != ''"> and vuserdef18 like concat('%',#{vuserdef18},'%') </if>
            <if test="vuserdef19 != null and vuserdef19 != ''"> and vuserdef19 like concat('%',#{vuserdef19},'%') </if>
            <if test="vuserdef2 != null and vuserdef2 != ''"> and vuserdef2 like concat('%',#{vuserdef2},'%') </if>
            <if test="vuserdef20 != null and vuserdef20 != ''"> and vuserdef20 like concat('%',#{vuserdef20},'%') </if>
            <if test="vuserdef3 != null and vuserdef3 != ''"> and vuserdef3 like concat('%',#{vuserdef3},'%') </if>
            <if test="vuserdef4 != null and vuserdef4 != ''"> and vuserdef4 like concat('%',#{vuserdef4},'%') </if>
            <if test="vuserdef5 != null and vuserdef5 != ''"> and vuserdef5 like concat('%',#{vuserdef5},'%') </if>
            <if test="vuserdef6 != null and vuserdef6 != ''"> and vuserdef6 like concat('%',#{vuserdef6},'%') </if>
            <if test="vuserdef7 != null and vuserdef7 != ''"> and vuserdef7 like concat('%',#{vuserdef7},'%') </if>
            <if test="vuserdef8 != null and vuserdef8 != ''"> and vuserdef8 like concat('%',#{vuserdef8},'%') </if>
            <if test="vuserdef9 != null and vuserdef9 != ''"> and vuserdef9 like concat('%',#{vuserdef9},'%') </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="IcSpecialBentity_list_or" resultMap="get-IcSpecialBEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.IcSpecialBEntity">
    select
    <include refid="IcSpecialBEntity_Base_Column_List" />
    from ic_special_b
    <trim prefix="where" prefixOverrides="and"> 
         <if test="castunitid != null and castunitid != ''"> or castunitid = #{castunitid} </if>
             <if test="cfirstbillbid != null and cfirstbillbid != ''"> or cfirstbillbid = #{cfirstbillbid} </if>
             <if test="cfirstbillhid != null and cfirstbillhid != ''"> or cfirstbillhid = #{cfirstbillhid} </if>
             <if test="cfirsttype != null and cfirsttype != ''"> or cfirsttype = #{cfirsttype} </if>
             <if test="cinventoryid != null and cinventoryid != ''"> or cinventoryid = #{cinventoryid} </if>
             <if test="crowno != null and crowno != ''"> or crowno = #{crowno} </if>
             <if test="csourcebillbid != null and csourcebillbid != ''"> or csourcebillbid = #{csourcebillbid} </if>
             <if test="csourcebillhid != null and csourcebillhid != ''"> or csourcebillhid = #{csourcebillhid} </if>
             <if test="csourcetype != null and csourcetype != ''"> or csourcetype = #{csourcetype} </if>
             <if test="cspaceid != null and cspaceid != ''"> or cspaceid = #{cspaceid} </if>
             <if test="cspecialbid != null and cspecialbid != ''"> or cspecialbid = #{cspecialbid} </if>
             <if test="cspecialhid != null and cspecialhid != ''"> or cspecialhid = #{cspecialhid} </if>
             <if test="cvendorid != null and cvendorid != ''"> or cvendorid = #{cvendorid} </if>
             <if test="cwarehouseid != null and cwarehouseid != ''"> or cwarehouseid = #{cwarehouseid} </if>
             <if test="dr != null"> or dr = #{dr} </if>
             <if test="dshldtransnum != null"> or dshldtransnum = #{dshldtransnum} </if>
             <if test="dvalidate != null and dvalidate != ''"> or dvalidate = #{dvalidate} </if>
             <if test="fbillrowflag != null"> or fbillrowflag = #{fbillrowflag} </if>
             <if test="hsl != null"> or hsl = #{hsl} </if>
             <if test="naccountastnum != null"> or naccountastnum = #{naccountastnum} </if>
             <if test="naccountgrsnum != null"> or naccountgrsnum = #{naccountgrsnum} </if>
             <if test="naccountnum != null"> or naccountnum = #{naccountnum} </if>
             <if test="nadjustastnum != null"> or nadjustastnum = #{nadjustastnum} </if>
             <if test="nadjustgrsnum != null"> or nadjustgrsnum = #{nadjustgrsnum} </if>
             <if test="nadjustnum != null"> or nadjustnum = #{nadjustnum} </if>
             <if test="nbarcodenum != null"> or nbarcodenum = #{nbarcodenum} </if>
             <if test="ncheckastnum != null"> or ncheckastnum = #{ncheckastnum} </if>
             <if test="ncheckgrsnum != null"> or ncheckgrsnum = #{ncheckgrsnum} </if>
             <if test="nchecknum != null"> or nchecknum = #{nchecknum} </if>
             <if test="nmny != null"> or nmny = #{nmny} </if>
             <if test="nperiodastnum != null"> or nperiodastnum = #{nperiodastnum} </if>
             <if test="nperiodnum != null"> or nperiodnum = #{nperiodnum} </if>
             <if test="nplannedmny != null"> or nplannedmny = #{nplannedmny} </if>
             <if test="nplannedprice != null"> or nplannedprice = #{nplannedprice} </if>
             <if test="nprice != null"> or nprice = #{nprice} </if>
             <if test="nshldtransastnum != null"> or nshldtransastnum = #{nshldtransastnum} </if>
             <if test="nshldtransgrsnum != null"> or nshldtransgrsnum = #{nshldtransgrsnum} </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="vbatchcode != null and vbatchcode != ''"> or vbatchcode = #{vbatchcode} </if>
             <if test="vfree1 != null and vfree1 != ''"> or vfree1 = #{vfree1} </if>
             <if test="vfree10 != null and vfree10 != ''"> or vfree10 = #{vfree10} </if>
             <if test="vfree2 != null and vfree2 != ''"> or vfree2 = #{vfree2} </if>
             <if test="vfree3 != null and vfree3 != ''"> or vfree3 = #{vfree3} </if>
             <if test="vfree4 != null and vfree4 != ''"> or vfree4 = #{vfree4} </if>
             <if test="vfree5 != null and vfree5 != ''"> or vfree5 = #{vfree5} </if>
             <if test="vfree6 != null and vfree6 != ''"> or vfree6 = #{vfree6} </if>
             <if test="vfree7 != null and vfree7 != ''"> or vfree7 = #{vfree7} </if>
             <if test="vfree8 != null and vfree8 != ''"> or vfree8 = #{vfree8} </if>
             <if test="vfree9 != null and vfree9 != ''"> or vfree9 = #{vfree9} </if>
             <if test="vnote != null and vnote != ''"> or vnote = #{vnote} </if>
             <if test="vsourcebillcode != null and vsourcebillcode != ''"> or vsourcebillcode = #{vsourcebillcode} </if>
             <if test="vuserdef1 != null and vuserdef1 != ''"> or vuserdef1 = #{vuserdef1} </if>
             <if test="vuserdef10 != null and vuserdef10 != ''"> or vuserdef10 = #{vuserdef10} </if>
             <if test="vuserdef11 != null and vuserdef11 != ''"> or vuserdef11 = #{vuserdef11} </if>
             <if test="vuserdef12 != null and vuserdef12 != ''"> or vuserdef12 = #{vuserdef12} </if>
             <if test="vuserdef13 != null and vuserdef13 != ''"> or vuserdef13 = #{vuserdef13} </if>
             <if test="vuserdef14 != null and vuserdef14 != ''"> or vuserdef14 = #{vuserdef14} </if>
             <if test="vuserdef15 != null and vuserdef15 != ''"> or vuserdef15 = #{vuserdef15} </if>
             <if test="vuserdef16 != null and vuserdef16 != ''"> or vuserdef16 = #{vuserdef16} </if>
             <if test="vuserdef17 != null and vuserdef17 != ''"> or vuserdef17 = #{vuserdef17} </if>
             <if test="vuserdef18 != null and vuserdef18 != ''"> or vuserdef18 = #{vuserdef18} </if>
             <if test="vuserdef19 != null and vuserdef19 != ''"> or vuserdef19 = #{vuserdef19} </if>
             <if test="vuserdef2 != null and vuserdef2 != ''"> or vuserdef2 = #{vuserdef2} </if>
             <if test="vuserdef20 != null and vuserdef20 != ''"> or vuserdef20 = #{vuserdef20} </if>
             <if test="vuserdef3 != null and vuserdef3 != ''"> or vuserdef3 = #{vuserdef3} </if>
             <if test="vuserdef4 != null and vuserdef4 != ''"> or vuserdef4 = #{vuserdef4} </if>
             <if test="vuserdef5 != null and vuserdef5 != ''"> or vuserdef5 = #{vuserdef5} </if>
             <if test="vuserdef6 != null and vuserdef6 != ''"> or vuserdef6 = #{vuserdef6} </if>
             <if test="vuserdef7 != null and vuserdef7 != ''"> or vuserdef7 = #{vuserdef7} </if>
             <if test="vuserdef8 != null and vuserdef8 != ''"> or vuserdef8 = #{vuserdef8} </if>
             <if test="vuserdef9 != null and vuserdef9 != ''"> or vuserdef9 = #{vuserdef9} </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.IcSpecialBEntity" keyProperty="cspecialbid" useGeneratedKeys="true">
    insert into ic_special_b(
  <trim suffix="" suffixOverrides=",">
       <if test="castunitid != null and castunitid != ''"> castunitid , </if>
            <if test="cfirstbillbid != null and cfirstbillbid != ''"> cfirstbillbid , </if>
            <if test="cfirstbillhid != null and cfirstbillhid != ''"> cfirstbillhid , </if>
            <if test="cfirsttype != null and cfirsttype != ''"> cfirsttype , </if>
            <if test="cinventoryid != null and cinventoryid != ''"> cinventoryid , </if>
            <if test="crowno != null and crowno != ''"> crowno , </if>
            <if test="csourcebillbid != null and csourcebillbid != ''"> csourcebillbid , </if>
            <if test="csourcebillhid != null and csourcebillhid != ''"> csourcebillhid , </if>
            <if test="csourcetype != null and csourcetype != ''"> csourcetype , </if>
            <if test="cspaceid != null and cspaceid != ''"> cspaceid , </if>
            <if test="cspecialbid != null and cspecialbid != ''"> cspecialbid , </if>
            <if test="cspecialhid != null and cspecialhid != ''"> cspecialhid , </if>
            <if test="cvendorid != null and cvendorid != ''"> cvendorid , </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> cwarehouseid , </if>
            <if test="dr != null"> dr , </if>
            <if test="dshldtransnum != null"> dshldtransnum , </if>
            <if test="dvalidate != null and dvalidate != ''"> dvalidate , </if>
            <if test="fbillrowflag != null"> fbillrowflag , </if>
            <if test="hsl != null"> hsl , </if>
            <if test="naccountastnum != null"> naccountastnum , </if>
            <if test="naccountgrsnum != null"> naccountgrsnum , </if>
            <if test="naccountnum != null"> naccountnum , </if>
            <if test="nadjustastnum != null"> nadjustastnum , </if>
            <if test="nadjustgrsnum != null"> nadjustgrsnum , </if>
            <if test="nadjustnum != null"> nadjustnum , </if>
            <if test="nbarcodenum != null"> nbarcodenum , </if>
            <if test="ncheckastnum != null"> ncheckastnum , </if>
            <if test="ncheckgrsnum != null"> ncheckgrsnum , </if>
            <if test="nchecknum != null"> nchecknum , </if>
            <if test="nmny != null"> nmny , </if>
            <if test="nperiodastnum != null"> nperiodastnum , </if>
            <if test="nperiodnum != null"> nperiodnum , </if>
            <if test="nplannedmny != null"> nplannedmny , </if>
            <if test="nplannedprice != null"> nplannedprice , </if>
            <if test="nprice != null"> nprice , </if>
            <if test="nshldtransastnum != null"> nshldtransastnum , </if>
            <if test="nshldtransgrsnum != null"> nshldtransgrsnum , </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="vbatchcode != null and vbatchcode != ''"> vbatchcode , </if>
            <if test="vfree1 != null and vfree1 != ''"> vfree1 , </if>
            <if test="vfree10 != null and vfree10 != ''"> vfree10 , </if>
            <if test="vfree2 != null and vfree2 != ''"> vfree2 , </if>
            <if test="vfree3 != null and vfree3 != ''"> vfree3 , </if>
            <if test="vfree4 != null and vfree4 != ''"> vfree4 , </if>
            <if test="vfree5 != null and vfree5 != ''"> vfree5 , </if>
            <if test="vfree6 != null and vfree6 != ''"> vfree6 , </if>
            <if test="vfree7 != null and vfree7 != ''"> vfree7 , </if>
            <if test="vfree8 != null and vfree8 != ''"> vfree8 , </if>
            <if test="vfree9 != null and vfree9 != ''"> vfree9 , </if>
            <if test="vnote != null and vnote != ''"> vnote , </if>
            <if test="vsourcebillcode != null and vsourcebillcode != ''"> vsourcebillcode , </if>
            <if test="vuserdef1 != null and vuserdef1 != ''"> vuserdef1 , </if>
            <if test="vuserdef10 != null and vuserdef10 != ''"> vuserdef10 , </if>
            <if test="vuserdef11 != null and vuserdef11 != ''"> vuserdef11 , </if>
            <if test="vuserdef12 != null and vuserdef12 != ''"> vuserdef12 , </if>
            <if test="vuserdef13 != null and vuserdef13 != ''"> vuserdef13 , </if>
            <if test="vuserdef14 != null and vuserdef14 != ''"> vuserdef14 , </if>
            <if test="vuserdef15 != null and vuserdef15 != ''"> vuserdef15 , </if>
            <if test="vuserdef16 != null and vuserdef16 != ''"> vuserdef16 , </if>
            <if test="vuserdef17 != null and vuserdef17 != ''"> vuserdef17 , </if>
            <if test="vuserdef18 != null and vuserdef18 != ''"> vuserdef18 , </if>
            <if test="vuserdef19 != null and vuserdef19 != ''"> vuserdef19 , </if>
            <if test="vuserdef2 != null and vuserdef2 != ''"> vuserdef2 , </if>
            <if test="vuserdef20 != null and vuserdef20 != ''"> vuserdef20 , </if>
            <if test="vuserdef3 != null and vuserdef3 != ''"> vuserdef3 , </if>
            <if test="vuserdef4 != null and vuserdef4 != ''"> vuserdef4 , </if>
            <if test="vuserdef5 != null and vuserdef5 != ''"> vuserdef5 , </if>
            <if test="vuserdef6 != null and vuserdef6 != ''"> vuserdef6 , </if>
            <if test="vuserdef7 != null and vuserdef7 != ''"> vuserdef7 , </if>
            <if test="vuserdef8 != null and vuserdef8 != ''"> vuserdef8 , </if>
            <if test="vuserdef9 != null and vuserdef9 != ''"> vuserdef9 , </if>
            <if test="sorts == null ">sorts,</if>
    <if test="sts == null ">sts,</if>
  </trim>
  )values(
 <trim suffix="" suffixOverrides=",">
       <if test="castunitid != null and castunitid != ''"> #{castunitid} ,</if>
            <if test="cfirstbillbid != null and cfirstbillbid != ''"> #{cfirstbillbid} ,</if>
            <if test="cfirstbillhid != null and cfirstbillhid != ''"> #{cfirstbillhid} ,</if>
            <if test="cfirsttype != null and cfirsttype != ''"> #{cfirsttype} ,</if>
            <if test="cinventoryid != null and cinventoryid != ''"> #{cinventoryid} ,</if>
            <if test="crowno != null and crowno != ''"> #{crowno} ,</if>
            <if test="csourcebillbid != null and csourcebillbid != ''"> #{csourcebillbid} ,</if>
            <if test="csourcebillhid != null and csourcebillhid != ''"> #{csourcebillhid} ,</if>
            <if test="csourcetype != null and csourcetype != ''"> #{csourcetype} ,</if>
            <if test="cspaceid != null and cspaceid != ''"> #{cspaceid} ,</if>
            <if test="cspecialbid != null and cspecialbid != ''"> #{cspecialbid} ,</if>
            <if test="cspecialhid != null and cspecialhid != ''"> #{cspecialhid} ,</if>
            <if test="cvendorid != null and cvendorid != ''"> #{cvendorid} ,</if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> #{cwarehouseid} ,</if>
            <if test="dr != null"> #{dr} ,</if>
            <if test="dshldtransnum != null"> #{dshldtransnum} ,</if>
            <if test="dvalidate != null and dvalidate != ''"> #{dvalidate} ,</if>
            <if test="fbillrowflag != null"> #{fbillrowflag} ,</if>
            <if test="hsl != null"> #{hsl} ,</if>
            <if test="naccountastnum != null"> #{naccountastnum} ,</if>
            <if test="naccountgrsnum != null"> #{naccountgrsnum} ,</if>
            <if test="naccountnum != null"> #{naccountnum} ,</if>
            <if test="nadjustastnum != null"> #{nadjustastnum} ,</if>
            <if test="nadjustgrsnum != null"> #{nadjustgrsnum} ,</if>
            <if test="nadjustnum != null"> #{nadjustnum} ,</if>
            <if test="nbarcodenum != null"> #{nbarcodenum} ,</if>
            <if test="ncheckastnum != null"> #{ncheckastnum} ,</if>
            <if test="ncheckgrsnum != null"> #{ncheckgrsnum} ,</if>
            <if test="nchecknum != null"> #{nchecknum} ,</if>
            <if test="nmny != null"> #{nmny} ,</if>
            <if test="nperiodastnum != null"> #{nperiodastnum} ,</if>
            <if test="nperiodnum != null"> #{nperiodnum} ,</if>
            <if test="nplannedmny != null"> #{nplannedmny} ,</if>
            <if test="nplannedprice != null"> #{nplannedprice} ,</if>
            <if test="nprice != null"> #{nprice} ,</if>
            <if test="nshldtransastnum != null"> #{nshldtransastnum} ,</if>
            <if test="nshldtransgrsnum != null"> #{nshldtransgrsnum} ,</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="vbatchcode != null and vbatchcode != ''"> #{vbatchcode} ,</if>
            <if test="vfree1 != null and vfree1 != ''"> #{vfree1} ,</if>
            <if test="vfree10 != null and vfree10 != ''"> #{vfree10} ,</if>
            <if test="vfree2 != null and vfree2 != ''"> #{vfree2} ,</if>
            <if test="vfree3 != null and vfree3 != ''"> #{vfree3} ,</if>
            <if test="vfree4 != null and vfree4 != ''"> #{vfree4} ,</if>
            <if test="vfree5 != null and vfree5 != ''"> #{vfree5} ,</if>
            <if test="vfree6 != null and vfree6 != ''"> #{vfree6} ,</if>
            <if test="vfree7 != null and vfree7 != ''"> #{vfree7} ,</if>
            <if test="vfree8 != null and vfree8 != ''"> #{vfree8} ,</if>
            <if test="vfree9 != null and vfree9 != ''"> #{vfree9} ,</if>
            <if test="vnote != null and vnote != ''"> #{vnote} ,</if>
            <if test="vsourcebillcode != null and vsourcebillcode != ''"> #{vsourcebillcode} ,</if>
            <if test="vuserdef1 != null and vuserdef1 != ''"> #{vuserdef1} ,</if>
            <if test="vuserdef10 != null and vuserdef10 != ''"> #{vuserdef10} ,</if>
            <if test="vuserdef11 != null and vuserdef11 != ''"> #{vuserdef11} ,</if>
            <if test="vuserdef12 != null and vuserdef12 != ''"> #{vuserdef12} ,</if>
            <if test="vuserdef13 != null and vuserdef13 != ''"> #{vuserdef13} ,</if>
            <if test="vuserdef14 != null and vuserdef14 != ''"> #{vuserdef14} ,</if>
            <if test="vuserdef15 != null and vuserdef15 != ''"> #{vuserdef15} ,</if>
            <if test="vuserdef16 != null and vuserdef16 != ''"> #{vuserdef16} ,</if>
            <if test="vuserdef17 != null and vuserdef17 != ''"> #{vuserdef17} ,</if>
            <if test="vuserdef18 != null and vuserdef18 != ''"> #{vuserdef18} ,</if>
            <if test="vuserdef19 != null and vuserdef19 != ''"> #{vuserdef19} ,</if>
            <if test="vuserdef2 != null and vuserdef2 != ''"> #{vuserdef2} ,</if>
            <if test="vuserdef20 != null and vuserdef20 != ''"> #{vuserdef20} ,</if>
            <if test="vuserdef3 != null and vuserdef3 != ''"> #{vuserdef3} ,</if>
            <if test="vuserdef4 != null and vuserdef4 != ''"> #{vuserdef4} ,</if>
            <if test="vuserdef5 != null and vuserdef5 != ''"> #{vuserdef5} ,</if>
            <if test="vuserdef6 != null and vuserdef6 != ''"> #{vuserdef6} ,</if>
            <if test="vuserdef7 != null and vuserdef7 != ''"> #{vuserdef7} ,</if>
            <if test="vuserdef8 != null and vuserdef8 != ''"> #{vuserdef8} ,</if>
            <if test="vuserdef9 != null and vuserdef9 != ''"> #{vuserdef9} ,</if>
            <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from ic_special_b a WHERE a.sts = 'Y' ),</if>
    <if test="sts == null ">'Y',</if>
  </trim>
  )  
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="cspecialbid" useGeneratedKeys="true">
  insert into ic_special_b(castunitid, cfirstbillbid, cfirstbillhid, cfirsttype, cinventoryid, crowno, csourcebillbid, csourcebillhid, csourcetype, cspaceid, cspecialhid, cvendorid, cwarehouseid, dr, dshldtransnum, dvalidate, fbillrowflag, hsl, naccountastnum, naccountgrsnum, naccountnum, nadjustastnum, nadjustgrsnum, nadjustnum, nbarcodenum, ncheckastnum, ncheckgrsnum, nchecknum, nmny, nperiodastnum, nperiodnum, nplannedmny, nplannedprice, nprice, nshldtransastnum, nshldtransgrsnum, 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, vbatchcode, vfree1, vfree10, vfree2, vfree3, vfree4, vfree5, vfree6, vfree7, vfree8, vfree9, vnote, vsourcebillcode, vuserdef1, vuserdef10, vuserdef11, vuserdef12, vuserdef13, vuserdef14, vuserdef15, vuserdef16, vuserdef17, vuserdef18, vuserdef19, vuserdef2, vuserdef20, vuserdef3, vuserdef4, vuserdef5, vuserdef6, vuserdef7, vuserdef8, vuserdef9,  sts) 
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.castunitid},#{entity.cfirstbillbid},#{entity.cfirstbillhid},#{entity.cfirsttype},#{entity.cinventoryid},#{entity.crowno},#{entity.csourcebillbid},#{entity.csourcebillhid},#{entity.csourcetype},#{entity.cspaceid},#{entity.cspecialhid},#{entity.cvendorid},#{entity.cwarehouseid},#{entity.dr},#{entity.dshldtransnum},#{entity.dvalidate},#{entity.fbillrowflag},#{entity.hsl},#{entity.naccountastnum},#{entity.naccountgrsnum},#{entity.naccountnum},#{entity.nadjustastnum},#{entity.nadjustgrsnum},#{entity.nadjustnum},#{entity.nbarcodenum},#{entity.ncheckastnum},#{entity.ncheckgrsnum},#{entity.nchecknum},#{entity.nmny},#{entity.nperiodastnum},#{entity.nperiodnum},#{entity.nplannedmny},#{entity.nplannedprice},#{entity.nprice},#{entity.nshldtransastnum},#{entity.nshldtransgrsnum},#{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.vbatchcode},#{entity.vfree1},#{entity.vfree10},#{entity.vfree2},#{entity.vfree3},#{entity.vfree4},#{entity.vfree5},#{entity.vfree6},#{entity.vfree7},#{entity.vfree8},#{entity.vfree9},#{entity.vnote},#{entity.vsourcebillcode},#{entity.vuserdef1},#{entity.vuserdef10},#{entity.vuserdef11},#{entity.vuserdef12},#{entity.vuserdef13},#{entity.vuserdef14},#{entity.vuserdef15},#{entity.vuserdef16},#{entity.vuserdef17},#{entity.vuserdef18},#{entity.vuserdef19},#{entity.vuserdef2},#{entity.vuserdef20},#{entity.vuserdef3},#{entity.vuserdef4},#{entity.vuserdef5},#{entity.vuserdef6},#{entity.vuserdef7},#{entity.vuserdef8},#{entity.vuserdef9}, 'Y')
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="cspecialbid" useGeneratedKeys="true">
    insert into ic_special_b(castunitid, cfirstbillbid, cfirstbillhid, cfirsttype, cinventoryid, crowno, csourcebillbid, csourcebillhid, csourcetype, cspaceid, cspecialhid, cvendorid, cwarehouseid, dr, dshldtransnum, dvalidate, fbillrowflag, hsl, naccountastnum, naccountgrsnum, naccountnum, nadjustastnum, nadjustgrsnum, nadjustnum, nbarcodenum, ncheckastnum, ncheckgrsnum, nchecknum, nmny, nperiodastnum, nperiodnum, nplannedmny, nplannedprice, nprice, nshldtransastnum, nshldtransgrsnum, 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, vbatchcode, vfree1, vfree10, vfree2, vfree3, vfree4, vfree5, vfree6, vfree7, vfree8, vfree9, vnote, vsourcebillcode, vuserdef1, vuserdef10, vuserdef11, vuserdef12, vuserdef13, vuserdef14, vuserdef15, vuserdef16, vuserdef17, vuserdef18, vuserdef19, vuserdef2, vuserdef20, vuserdef3, vuserdef4, vuserdef5, vuserdef6, vuserdef7, vuserdef8, vuserdef9)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.castunitid},#{entity.cfirstbillbid},#{entity.cfirstbillhid},#{entity.cfirsttype},#{entity.cinventoryid},#{entity.crowno},#{entity.csourcebillbid},#{entity.csourcebillhid},#{entity.csourcetype},#{entity.cspaceid},#{entity.cspecialhid},#{entity.cvendorid},#{entity.cwarehouseid},#{entity.dr},#{entity.dshldtransnum},#{entity.dvalidate},#{entity.fbillrowflag},#{entity.hsl},#{entity.naccountastnum},#{entity.naccountgrsnum},#{entity.naccountnum},#{entity.nadjustastnum},#{entity.nadjustgrsnum},#{entity.nadjustnum},#{entity.nbarcodenum},#{entity.ncheckastnum},#{entity.ncheckgrsnum},#{entity.nchecknum},#{entity.nmny},#{entity.nperiodastnum},#{entity.nperiodnum},#{entity.nplannedmny},#{entity.nplannedprice},#{entity.nprice},#{entity.nshldtransastnum},#{entity.nshldtransgrsnum},#{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.vbatchcode},#{entity.vfree1},#{entity.vfree10},#{entity.vfree2},#{entity.vfree3},#{entity.vfree4},#{entity.vfree5},#{entity.vfree6},#{entity.vfree7},#{entity.vfree8},#{entity.vfree9},#{entity.vnote},#{entity.vsourcebillcode},#{entity.vuserdef1},#{entity.vuserdef10},#{entity.vuserdef11},#{entity.vuserdef12},#{entity.vuserdef13},#{entity.vuserdef14},#{entity.vuserdef15},#{entity.vuserdef16},#{entity.vuserdef17},#{entity.vuserdef18},#{entity.vuserdef19},#{entity.vuserdef2},#{entity.vuserdef20},#{entity.vuserdef3},#{entity.vuserdef4},#{entity.vuserdef5},#{entity.vuserdef6},#{entity.vuserdef7},#{entity.vuserdef8},#{entity.vuserdef9})
    </foreach>
    on duplicate key update
    castunitid = values(castunitid),
    cfirstbillbid = values(cfirstbillbid),
    cfirstbillhid = values(cfirstbillhid),
    cfirsttype = values(cfirsttype),
    cinventoryid = values(cinventoryid),
    crowno = values(crowno),
    csourcebillbid = values(csourcebillbid),
    csourcebillhid = values(csourcebillhid),
    csourcetype = values(csourcetype),
    cspaceid = values(cspaceid),
    cspecialhid = values(cspecialhid),
    cvendorid = values(cvendorid),
    cwarehouseid = values(cwarehouseid),
    dr = values(dr),
    dshldtransnum = values(dshldtransnum),
    dvalidate = values(dvalidate),
    fbillrowflag = values(fbillrowflag),
    hsl = values(hsl),
    naccountastnum = values(naccountastnum),
    naccountgrsnum = values(naccountgrsnum),
    naccountnum = values(naccountnum),
    nadjustastnum = values(nadjustastnum),
    nadjustgrsnum = values(nadjustgrsnum),
    nadjustnum = values(nadjustnum),
    nbarcodenum = values(nbarcodenum),
    ncheckastnum = values(ncheckastnum),
    ncheckgrsnum = values(ncheckgrsnum),
    nchecknum = values(nchecknum),
    nmny = values(nmny),
    nperiodastnum = values(nperiodastnum),
    nperiodnum = values(nperiodnum),
    nplannedmny = values(nplannedmny),
    nplannedprice = values(nplannedprice),
    nprice = values(nprice),
    nshldtransastnum = values(nshldtransastnum),
    nshldtransgrsnum = values(nshldtransgrsnum),
    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),
    vbatchcode = values(vbatchcode),
    vfree1 = values(vfree1),
    vfree10 = values(vfree10),
    vfree2 = values(vfree2),
    vfree3 = values(vfree3),
    vfree4 = values(vfree4),
    vfree5 = values(vfree5),
    vfree6 = values(vfree6),
    vfree7 = values(vfree7),
    vfree8 = values(vfree8),
    vfree9 = values(vfree9),
    vnote = values(vnote),
    vsourcebillcode = values(vsourcebillcode),
    vuserdef1 = values(vuserdef1),
    vuserdef10 = values(vuserdef10),
    vuserdef11 = values(vuserdef11),
    vuserdef12 = values(vuserdef12),
    vuserdef13 = values(vuserdef13),
    vuserdef14 = values(vuserdef14),
    vuserdef15 = values(vuserdef15),
    vuserdef16 = values(vuserdef16),
    vuserdef17 = values(vuserdef17),
    vuserdef18 = values(vuserdef18),
    vuserdef19 = values(vuserdef19),
    vuserdef2 = values(vuserdef2),
    vuserdef20 = values(vuserdef20),
    vuserdef3 = values(vuserdef3),
    vuserdef4 = values(vuserdef4),
    vuserdef5 = values(vuserdef5),
    vuserdef6 = values(vuserdef6),
    vuserdef7 = values(vuserdef7),
    vuserdef8 = values(vuserdef8),
    vuserdef9 = values(vuserdef9)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.entity.IcSpecialBEntity" >
update ic_special_b  set
<trim suffix="" suffixOverrides=",">
  <if test="castunitid != null and castunitid != ''"> castunitid = #{castunitid},</if>
  <if test="cfirstbillbid != null and cfirstbillbid != ''"> cfirstbillbid = #{cfirstbillbid},</if>
  <if test="cfirstbillhid != null and cfirstbillhid != ''"> cfirstbillhid = #{cfirstbillhid},</if>
  <if test="cfirsttype != null and cfirsttype != ''"> cfirsttype = #{cfirsttype},</if>
  <if test="cinventoryid != null and cinventoryid != ''"> cinventoryid = #{cinventoryid},</if>
  <if test="crowno != null and crowno != ''"> crowno = #{crowno},</if>
  <if test="csourcebillbid != null and csourcebillbid != ''"> csourcebillbid = #{csourcebillbid},</if>
  <if test="csourcebillhid != null and csourcebillhid != ''"> csourcebillhid = #{csourcebillhid},</if>
  <if test="csourcetype != null and csourcetype != ''"> csourcetype = #{csourcetype},</if>
  <if test="cspaceid != null and cspaceid != ''"> cspaceid = #{cspaceid},</if>
  <if test="cspecialhid != null and cspecialhid != ''"> cspecialhid = #{cspecialhid},</if>
  <if test="cvendorid != null and cvendorid != ''"> cvendorid = #{cvendorid},</if>
  <if test="cwarehouseid != null and cwarehouseid != ''"> cwarehouseid = #{cwarehouseid},</if>
  <if test="dr != null"> dr = #{dr},</if>
  <if test="dshldtransnum != null"> dshldtransnum = #{dshldtransnum},</if>
  <if test="dvalidate != null and dvalidate != ''"> dvalidate = #{dvalidate},</if>
  <if test="fbillrowflag != null"> fbillrowflag = #{fbillrowflag},</if>
  <if test="hsl != null"> hsl = #{hsl},</if>
  <if test="naccountastnum != null"> naccountastnum = #{naccountastnum},</if>
  <if test="naccountgrsnum != null"> naccountgrsnum = #{naccountgrsnum},</if>
  <if test="naccountnum != null"> naccountnum = #{naccountnum},</if>
  <if test="nadjustastnum != null"> nadjustastnum = #{nadjustastnum},</if>
  <if test="nadjustgrsnum != null"> nadjustgrsnum = #{nadjustgrsnum},</if>
  <if test="nadjustnum != null"> nadjustnum = #{nadjustnum},</if>
  <if test="nbarcodenum != null"> nbarcodenum = #{nbarcodenum},</if>
  <if test="ncheckastnum != null"> ncheckastnum = #{ncheckastnum},</if>
  <if test="ncheckgrsnum != null"> ncheckgrsnum = #{ncheckgrsnum},</if>
  <if test="nchecknum != null"> nchecknum = #{nchecknum},</if>
  <if test="nmny != null"> nmny = #{nmny},</if>
  <if test="nperiodastnum != null"> nperiodastnum = #{nperiodastnum},</if>
  <if test="nperiodnum != null"> nperiodnum = #{nperiodnum},</if>
  <if test="nplannedmny != null"> nplannedmny = #{nplannedmny},</if>
  <if test="nplannedprice != null"> nplannedprice = #{nplannedprice},</if>
  <if test="nprice != null"> nprice = #{nprice},</if>
  <if test="nshldtransastnum != null"> nshldtransastnum = #{nshldtransastnum},</if>
  <if test="nshldtransgrsnum != null"> nshldtransgrsnum = #{nshldtransgrsnum},</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="vbatchcode != null and vbatchcode != ''"> vbatchcode = #{vbatchcode},</if>
  <if test="vfree1 != null and vfree1 != ''"> vfree1 = #{vfree1},</if>
  <if test="vfree10 != null and vfree10 != ''"> vfree10 = #{vfree10},</if>
  <if test="vfree2 != null and vfree2 != ''"> vfree2 = #{vfree2},</if>
  <if test="vfree3 != null and vfree3 != ''"> vfree3 = #{vfree3},</if>
  <if test="vfree4 != null and vfree4 != ''"> vfree4 = #{vfree4},</if>
  <if test="vfree5 != null and vfree5 != ''"> vfree5 = #{vfree5},</if>
  <if test="vfree6 != null and vfree6 != ''"> vfree6 = #{vfree6},</if>
  <if test="vfree7 != null and vfree7 != ''"> vfree7 = #{vfree7},</if>
  <if test="vfree8 != null and vfree8 != ''"> vfree8 = #{vfree8},</if>
  <if test="vfree9 != null and vfree9 != ''"> vfree9 = #{vfree9},</if>
  <if test="vnote != null and vnote != ''"> vnote = #{vnote},</if>
  <if test="vsourcebillcode != null and vsourcebillcode != ''"> vsourcebillcode = #{vsourcebillcode},</if>
  <if test="vuserdef1 != null and vuserdef1 != ''"> vuserdef1 = #{vuserdef1},</if>
  <if test="vuserdef10 != null and vuserdef10 != ''"> vuserdef10 = #{vuserdef10},</if>
  <if test="vuserdef11 != null and vuserdef11 != ''"> vuserdef11 = #{vuserdef11},</if>
  <if test="vuserdef12 != null and vuserdef12 != ''"> vuserdef12 = #{vuserdef12},</if>
  <if test="vuserdef13 != null and vuserdef13 != ''"> vuserdef13 = #{vuserdef13},</if>
  <if test="vuserdef14 != null and vuserdef14 != ''"> vuserdef14 = #{vuserdef14},</if>
  <if test="vuserdef15 != null and vuserdef15 != ''"> vuserdef15 = #{vuserdef15},</if>
  <if test="vuserdef16 != null and vuserdef16 != ''"> vuserdef16 = #{vuserdef16},</if>
  <if test="vuserdef17 != null and vuserdef17 != ''"> vuserdef17 = #{vuserdef17},</if>
  <if test="vuserdef18 != null and vuserdef18 != ''"> vuserdef18 = #{vuserdef18},</if>
  <if test="vuserdef19 != null and vuserdef19 != ''"> vuserdef19 = #{vuserdef19},</if>
  <if test="vuserdef2 != null and vuserdef2 != ''"> vuserdef2 = #{vuserdef2},</if>
  <if test="vuserdef20 != null and vuserdef20 != ''"> vuserdef20 = #{vuserdef20},</if>
  <if test="vuserdef3 != null and vuserdef3 != ''"> vuserdef3 = #{vuserdef3},</if>
  <if test="vuserdef4 != null and vuserdef4 != ''"> vuserdef4 = #{vuserdef4},</if>
  <if test="vuserdef5 != null and vuserdef5 != ''"> vuserdef5 = #{vuserdef5},</if>
  <if test="vuserdef6 != null and vuserdef6 != ''"> vuserdef6 = #{vuserdef6},</if>
  <if test="vuserdef7 != null and vuserdef7 != ''"> vuserdef7 = #{vuserdef7},</if>
  <if test="vuserdef8 != null and vuserdef8 != ''"> vuserdef8 = #{vuserdef8},</if>
  <if test="vuserdef9 != null and vuserdef9 != ''"> vuserdef9 = #{vuserdef9},</if>
</trim>
where cspecialbid = #{cspecialbid}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.entity.IcSpecialBEntity" >
update ic_special_b  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where cspecialbid = #{cspecialbid}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.entity.IcSpecialBEntity" >
update ic_special_b  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
 <trim prefix="where" prefixOverrides="and"> 
        <if test="castunitid != null and castunitid != ''"> and castunitid = #{castunitid} </if>
            <if test="cfirstbillbid != null and cfirstbillbid != ''"> and cfirstbillbid = #{cfirstbillbid} </if>
            <if test="cfirstbillhid != null and cfirstbillhid != ''"> and cfirstbillhid = #{cfirstbillhid} </if>
            <if test="cfirsttype != null and cfirsttype != ''"> and cfirsttype = #{cfirsttype} </if>
            <if test="cinventoryid != null and cinventoryid != ''"> and cinventoryid = #{cinventoryid} </if>
            <if test="crowno != null and crowno != ''"> and crowno = #{crowno} </if>
            <if test="csourcebillbid != null and csourcebillbid != ''"> and csourcebillbid = #{csourcebillbid} </if>
            <if test="csourcebillhid != null and csourcebillhid != ''"> and csourcebillhid = #{csourcebillhid} </if>
            <if test="csourcetype != null and csourcetype != ''"> and csourcetype = #{csourcetype} </if>
            <if test="cspaceid != null and cspaceid != ''"> and cspaceid = #{cspaceid} </if>
            <if test="cspecialbid != null and cspecialbid != ''"> and cspecialbid = #{cspecialbid} </if>
            <if test="cspecialhid != null and cspecialhid != ''"> and cspecialhid = #{cspecialhid} </if>
            <if test="cvendorid != null and cvendorid != ''"> and cvendorid = #{cvendorid} </if>
            <if test="cwarehouseid != null and cwarehouseid != ''"> and cwarehouseid = #{cwarehouseid} </if>
            <if test="dr != null"> and dr = #{dr} </if>
            <if test="dshldtransnum != null"> and dshldtransnum = #{dshldtransnum} </if>
            <if test="dvalidate != null and dvalidate != ''"> and dvalidate = #{dvalidate} </if>
            <if test="fbillrowflag != null"> and fbillrowflag = #{fbillrowflag} </if>
            <if test="hsl != null"> and hsl = #{hsl} </if>
            <if test="naccountastnum != null"> and naccountastnum = #{naccountastnum} </if>
            <if test="naccountgrsnum != null"> and naccountgrsnum = #{naccountgrsnum} </if>
            <if test="naccountnum != null"> and naccountnum = #{naccountnum} </if>
            <if test="nadjustastnum != null"> and nadjustastnum = #{nadjustastnum} </if>
            <if test="nadjustgrsnum != null"> and nadjustgrsnum = #{nadjustgrsnum} </if>
            <if test="nadjustnum != null"> and nadjustnum = #{nadjustnum} </if>
            <if test="nbarcodenum != null"> and nbarcodenum = #{nbarcodenum} </if>
            <if test="ncheckastnum != null"> and ncheckastnum = #{ncheckastnum} </if>
            <if test="ncheckgrsnum != null"> and ncheckgrsnum = #{ncheckgrsnum} </if>
            <if test="nchecknum != null"> and nchecknum = #{nchecknum} </if>
            <if test="nmny != null"> and nmny = #{nmny} </if>
            <if test="nperiodastnum != null"> and nperiodastnum = #{nperiodastnum} </if>
            <if test="nperiodnum != null"> and nperiodnum = #{nperiodnum} </if>
            <if test="nplannedmny != null"> and nplannedmny = #{nplannedmny} </if>
            <if test="nplannedprice != null"> and nplannedprice = #{nplannedprice} </if>
            <if test="nprice != null"> and nprice = #{nprice} </if>
            <if test="nshldtransastnum != null"> and nshldtransastnum = #{nshldtransastnum} </if>
            <if test="nshldtransgrsnum != null"> and nshldtransgrsnum = #{nshldtransgrsnum} </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="vbatchcode != null and vbatchcode != ''"> and vbatchcode = #{vbatchcode} </if>
            <if test="vfree1 != null and vfree1 != ''"> and vfree1 = #{vfree1} </if>
            <if test="vfree10 != null and vfree10 != ''"> and vfree10 = #{vfree10} </if>
            <if test="vfree2 != null and vfree2 != ''"> and vfree2 = #{vfree2} </if>
            <if test="vfree3 != null and vfree3 != ''"> and vfree3 = #{vfree3} </if>
            <if test="vfree4 != null and vfree4 != ''"> and vfree4 = #{vfree4} </if>
            <if test="vfree5 != null and vfree5 != ''"> and vfree5 = #{vfree5} </if>
            <if test="vfree6 != null and vfree6 != ''"> and vfree6 = #{vfree6} </if>
            <if test="vfree7 != null and vfree7 != ''"> and vfree7 = #{vfree7} </if>
            <if test="vfree8 != null and vfree8 != ''"> and vfree8 = #{vfree8} </if>
            <if test="vfree9 != null and vfree9 != ''"> and vfree9 = #{vfree9} </if>
            <if test="vnote != null and vnote != ''"> and vnote = #{vnote} </if>
            <if test="vsourcebillcode != null and vsourcebillcode != ''"> and vsourcebillcode = #{vsourcebillcode} </if>
            <if test="vuserdef1 != null and vuserdef1 != ''"> and vuserdef1 = #{vuserdef1} </if>
            <if test="vuserdef10 != null and vuserdef10 != ''"> and vuserdef10 = #{vuserdef10} </if>
            <if test="vuserdef11 != null and vuserdef11 != ''"> and vuserdef11 = #{vuserdef11} </if>
            <if test="vuserdef12 != null and vuserdef12 != ''"> and vuserdef12 = #{vuserdef12} </if>
            <if test="vuserdef13 != null and vuserdef13 != ''"> and vuserdef13 = #{vuserdef13} </if>
            <if test="vuserdef14 != null and vuserdef14 != ''"> and vuserdef14 = #{vuserdef14} </if>
            <if test="vuserdef15 != null and vuserdef15 != ''"> and vuserdef15 = #{vuserdef15} </if>
            <if test="vuserdef16 != null and vuserdef16 != ''"> and vuserdef16 = #{vuserdef16} </if>
            <if test="vuserdef17 != null and vuserdef17 != ''"> and vuserdef17 = #{vuserdef17} </if>
            <if test="vuserdef18 != null and vuserdef18 != ''"> and vuserdef18 = #{vuserdef18} </if>
            <if test="vuserdef19 != null and vuserdef19 != ''"> and vuserdef19 = #{vuserdef19} </if>
            <if test="vuserdef2 != null and vuserdef2 != ''"> and vuserdef2 = #{vuserdef2} </if>
            <if test="vuserdef20 != null and vuserdef20 != ''"> and vuserdef20 = #{vuserdef20} </if>
            <if test="vuserdef3 != null and vuserdef3 != ''"> and vuserdef3 = #{vuserdef3} </if>
            <if test="vuserdef4 != null and vuserdef4 != ''"> and vuserdef4 = #{vuserdef4} </if>
            <if test="vuserdef5 != null and vuserdef5 != ''"> and vuserdef5 = #{vuserdef5} </if>
            <if test="vuserdef6 != null and vuserdef6 != ''"> and vuserdef6 = #{vuserdef6} </if>
            <if test="vuserdef7 != null and vuserdef7 != ''"> and vuserdef7 = #{vuserdef7} </if>
            <if test="vuserdef8 != null and vuserdef8 != ''"> and vuserdef8 = #{vuserdef8} </if>
            <if test="vuserdef9 != null and vuserdef9 != ''"> and vuserdef9 = #{vuserdef9} </if>
            and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from ic_special_b where cspecialbid = #{cspecialbid}
</delete>

</mapper>

