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

    <resultMap id="get-BdInvmandocEntity-result" type="com.hzya.frame.plugin.lets.entity.BdInvmandocEntity" >
       <result property="abctype" column="abctype" jdbcType="VARCHAR"/>
           <result property="accflag" column="accflag" jdbcType="VARCHAR"/>
           <result property="cinvmnecode" column="cinvmnecode" jdbcType="VARCHAR"/>
           <result property="consumesettleflag" column="consumesettleflag" jdbcType="VARCHAR"/>
           <result property="coopdayfrom" column="coopdayfrom" jdbcType="VARCHAR"/>
           <result property="coopdayto" column="coopdayto" jdbcType="VARCHAR"/>
           <result property="costprice" column="costprice" jdbcType="VARCHAR"/>
           <result property="createtime" column="createtime" jdbcType="VARCHAR"/>
           <result property="creator" column="creator" jdbcType="VARCHAR"/>
           <result property="def1" column="def1" jdbcType="VARCHAR"/>
           <result property="def10" column="def10" jdbcType="VARCHAR"/>
           <result property="def11" column="def11" jdbcType="VARCHAR"/>
           <result property="def12" column="def12" jdbcType="VARCHAR"/>
           <result property="def13" column="def13" jdbcType="VARCHAR"/>
           <result property="def14" column="def14" jdbcType="VARCHAR"/>
           <result property="def15" column="def15" jdbcType="VARCHAR"/>
           <result property="def16" column="def16" jdbcType="VARCHAR"/>
           <result property="def17" column="def17" jdbcType="VARCHAR"/>
           <result property="def18" column="def18" jdbcType="VARCHAR"/>
           <result property="def19" column="def19" jdbcType="VARCHAR"/>
           <result property="def2" column="def2" jdbcType="VARCHAR"/>
           <result property="def20" column="def20" jdbcType="VARCHAR"/>
           <result property="def3" column="def3" jdbcType="VARCHAR"/>
           <result property="def4" column="def4" jdbcType="VARCHAR"/>
           <result property="def5" column="def5" jdbcType="VARCHAR"/>
           <result property="def6" column="def6" jdbcType="VARCHAR"/>
           <result property="def7" column="def7" jdbcType="VARCHAR"/>
           <result property="def8" column="def8" jdbcType="VARCHAR"/>
           <result property="def9" column="def9" jdbcType="VARCHAR"/>
           <result property="dr" column="dr" jdbcType="INTEGER"/>
           <result property="expaybacktax" column="expaybacktax" jdbcType="VARCHAR"/>
           <result property="free1" column="free1" jdbcType="VARCHAR"/>
           <result property="free2" column="free2" jdbcType="VARCHAR"/>
           <result property="free3" column="free3" jdbcType="VARCHAR"/>
           <result property="free4" column="free4" jdbcType="VARCHAR"/>
           <result property="free5" column="free5" jdbcType="VARCHAR"/>
           <result property="grade" column="grade" jdbcType="VARCHAR"/>
           <result property="invlifeperiod" column="invlifeperiod" jdbcType="INTEGER"/>
           <result property="isappendant" column="isappendant" jdbcType="VARCHAR"/>
           <result property="isautoatpcheck" column="isautoatpcheck" jdbcType="VARCHAR"/>
           <result property="iscancalculatedinvcost" column="iscancalculatedinvcost" jdbcType="VARCHAR"/>
           <result property="iscanpurchased" column="iscanpurchased" jdbcType="VARCHAR"/>
           <result property="iscansaleinvoice" column="iscansaleinvoice" jdbcType="VARCHAR"/>
           <result property="iscansold" column="iscansold" jdbcType="VARCHAR"/>
           <result property="isconfigable" column="isconfigable" jdbcType="VARCHAR"/>
           <result property="isctlprodplanprice" column="isctlprodplanprice" jdbcType="VARCHAR"/>
           <result property="isfatherofbom" column="isfatherofbom" jdbcType="VARCHAR"/>
           <result property="isinvretfreeofchk" column="isinvretfreeofchk" jdbcType="VARCHAR"/>
           <result property="isinvretinstobychk" column="isinvretinstobychk" jdbcType="VARCHAR"/>
           <result property="isinvreturned" column="isinvreturned" jdbcType="VARCHAR"/>
           <result property="isnoconallowed" column="isnoconallowed" jdbcType="VARCHAR"/>
           <result property="isprimarybarcode" column="isprimarybarcode" jdbcType="VARCHAR"/>
           <result property="isrecurrentcheck" column="isrecurrentcheck" jdbcType="VARCHAR"/>
           <result property="issalable" column="issalable" jdbcType="VARCHAR"/>
           <result property="issecondarybarcode" column="issecondarybarcode" jdbcType="VARCHAR"/>
           <result property="isselfapprsupplier" column="isselfapprsupplier" jdbcType="VARCHAR"/>
           <result property="isspecialty" column="isspecialty" jdbcType="VARCHAR"/>
           <result property="issupplierstock" column="issupplierstock" jdbcType="VARCHAR"/>
           <result property="isused" column="isused" jdbcType="VARCHAR"/>
           <result property="isvirtual" column="isvirtual" jdbcType="VARCHAR"/>
           <result property="keepwasterate" column="keepwasterate" jdbcType="VARCHAR"/>
           <result property="lowestprice" column="lowestprice" jdbcType="VARCHAR"/>
           <result property="mantaxitem" column="mantaxitem" jdbcType="VARCHAR"/>
           <result property="maxprice" column="maxprice" jdbcType="VARCHAR"/>
           <result property="memo" column="memo" jdbcType="VARCHAR"/>
           <result property="modifier" column="modifier" jdbcType="VARCHAR"/>
           <result property="modifytime" column="modifytime" jdbcType="VARCHAR"/>
           <result property="negallowed" column="negallowed" jdbcType="VARCHAR"/>
           <result property="outpriority" column="outpriority" jdbcType="INTEGER"/>
           <result property="outtrackin" column="outtrackin" jdbcType="VARCHAR"/>
           <result property="pebegin" column="pebegin" jdbcType="VARCHAR"/>
           <result property="peend" column="peend" jdbcType="VARCHAR"/>
           <result property="pkCorp" column="pk_corp" jdbcType="VARCHAR"/>
           <result property="pkCumandoc" column="pk_cumandoc" jdbcType="VARCHAR"/>
           <result property="pkDftfactory" column="pk_dftfactory" jdbcType="VARCHAR"/>
           <result property="pkInvbasdoc" column="pk_invbasdoc" jdbcType="VARCHAR"/>
           <result property="pkInvmandoc" column="pk_invmandoc" jdbcType="VARCHAR"/>
           <result property="pkSealuser" column="pk_sealuser" jdbcType="VARCHAR"/>
           <result property="planprice" column="planprice" jdbcType="VARCHAR"/>
           <result property="prodarea" column="prodarea" jdbcType="VARCHAR"/>
           <result property="purchasestge" column="purchasestge" jdbcType="VARCHAR"/>
           <result property="purwasterate" column="purwasterate" jdbcType="VARCHAR"/>
           <result property="qualitydaynum" column="qualitydaynum" jdbcType="VARCHAR"/>
           <result property="qualitymanflag" column="qualitymanflag" jdbcType="VARCHAR"/>
           <result property="qualityperiodunit" column="qualityperiodunit" jdbcType="INTEGER"/>
           <result property="recurrentchkcyc" column="recurrentchkcyc" jdbcType="INTEGER"/>
           <result property="refsaleprice" column="refsaleprice" jdbcType="VARCHAR"/>
           <result property="sealdate" column="sealdate" jdbcType="VARCHAR"/>
           <result property="sealflag" column="sealflag" jdbcType="VARCHAR"/>
           <result property="sellproxyflag" column="sellproxyflag" jdbcType="VARCHAR"/>
           <result property="serialmanaflag" column="serialmanaflag" jdbcType="VARCHAR"/>
           <result property="ts" column="ts" jdbcType="VARCHAR"/>
           <result property="wholemanaflag" column="wholemanaflag" jdbcType="VARCHAR"/>
            <!--存货编码-->
            <result property="invcode" column="invcode" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "BdInvmandocEntity_Base_Column_List">
        abctype
       ,accflag 
        ,cinvmnecode 
        ,consumesettleflag 
        ,coopdayfrom 
        ,coopdayto 
        ,costprice 
        ,createtime 
        ,creator 
        ,def1 
        ,def10 
        ,def11 
        ,def12 
        ,def13 
        ,def14 
        ,def15 
        ,def16 
        ,def17 
        ,def18 
        ,def19 
        ,def2 
        ,def20 
        ,def3 
        ,def4 
        ,def5 
        ,def6 
        ,def7 
        ,def8 
        ,def9 
        ,dr 
        ,expaybacktax 
        ,free1 
        ,free2 
        ,free3 
        ,free4 
        ,free5 
        ,grade 
        ,invlifeperiod 
        ,isappendant 
        ,isautoatpcheck 
        ,iscancalculatedinvcost 
        ,iscanpurchased 
        ,iscansaleinvoice 
        ,iscansold 
        ,isconfigable 
        ,isctlprodplanprice 
        ,isfatherofbom 
        ,isinvretfreeofchk 
        ,isinvretinstobychk 
        ,isinvreturned 
        ,isnoconallowed 
        ,isprimarybarcode 
        ,isrecurrentcheck 
        ,issalable 
        ,issecondarybarcode 
        ,isselfapprsupplier 
        ,isspecialty 
        ,issupplierstock 
        ,isused 
        ,isvirtual 
        ,keepwasterate 
        ,lowestprice 
        ,mantaxitem 
        ,maxprice 
        ,memo 
        ,modifier 
        ,modifytime 
        ,negallowed 
        ,outpriority 
        ,outtrackin 
        ,pebegin 
        ,peend 
        ,pk_corp 
        ,pk_cumandoc 
        ,pk_dftfactory 
        ,pk_invbasdoc 
        ,pk_invmandoc 
        ,pk_sealuser 
        ,planprice 
        ,prodarea 
        ,purchasestge 
        ,purwasterate 
        ,qualitydaynum 
        ,qualitymanflag 
        ,qualityperiodunit 
        ,recurrentchkcyc 
        ,refsaleprice 
        ,sealdate 
        ,sealflag 
        ,sellproxyflag 
        ,serialmanaflag 
        ,ts 
        ,wholemanaflag 
     </sql>
 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-BdInvmandocEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdInvmandocEntity">
    select
    <include refid="BdInvmandocEntity_Base_Column_List" />
    from bd_invmandoc
    <trim prefix="where" prefixOverrides="and"> 
        <if test="abctype != null and abctype != ''"> and abctype = #{abctype} </if>
            <if test="accflag != null and accflag != ''"> and accflag = #{accflag} </if>
            <if test="cinvmnecode != null and cinvmnecode != ''"> and cinvmnecode = #{cinvmnecode} </if>
            <if test="consumesettleflag != null and consumesettleflag != ''"> and consumesettleflag = #{consumesettleflag} </if>
            <if test="coopdayfrom != null and coopdayfrom != ''"> and coopdayfrom = #{coopdayfrom} </if>
            <if test="coopdayto != null and coopdayto != ''"> and coopdayto = #{coopdayto} </if>
            <if test="costprice != null and costprice != ''"> and costprice = #{costprice} </if>
            <if test="createtime != null and createtime != ''"> and createtime = #{createtime} </if>
            <if test="creator != null and creator != ''"> and creator = #{creator} </if>
            <if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
            <if test="def10 != null and def10 != ''"> and def10 = #{def10} </if>
            <if test="def11 != null and def11 != ''"> and def11 = #{def11} </if>
            <if test="def12 != null and def12 != ''"> and def12 = #{def12} </if>
            <if test="def13 != null and def13 != ''"> and def13 = #{def13} </if>
            <if test="def14 != null and def14 != ''"> and def14 = #{def14} </if>
            <if test="def15 != null and def15 != ''"> and def15 = #{def15} </if>
            <if test="def16 != null and def16 != ''"> and def16 = #{def16} </if>
            <if test="def17 != null and def17 != ''"> and def17 = #{def17} </if>
            <if test="def18 != null and def18 != ''"> and def18 = #{def18} </if>
            <if test="def19 != null and def19 != ''"> and def19 = #{def19} </if>
            <if test="def2 != null and def2 != ''"> and def2 = #{def2} </if>
            <if test="def20 != null and def20 != ''"> and def20 = #{def20} </if>
            <if test="def3 != null and def3 != ''"> and def3 = #{def3} </if>
            <if test="def4 != null and def4 != ''"> and def4 = #{def4} </if>
            <if test="def5 != null and def5 != ''"> and def5 = #{def5} </if>
            <if test="def6 != null and def6 != ''"> and def6 = #{def6} </if>
            <if test="def7 != null and def7 != ''"> and def7 = #{def7} </if>
            <if test="def8 != null and def8 != ''"> and def8 = #{def8} </if>
            <if test="def9 != null and def9 != ''"> and def9 = #{def9} </if>
            <if test="dr != null"> and dr = #{dr} </if>
            <if test="expaybacktax != null and expaybacktax != ''"> and expaybacktax = #{expaybacktax} </if>
            <if test="free1 != null and free1 != ''"> and free1 = #{free1} </if>
            <if test="free2 != null and free2 != ''"> and free2 = #{free2} </if>
            <if test="free3 != null and free3 != ''"> and free3 = #{free3} </if>
            <if test="free4 != null and free4 != ''"> and free4 = #{free4} </if>
            <if test="free5 != null and free5 != ''"> and free5 = #{free5} </if>
            <if test="grade != null and grade != ''"> and grade = #{grade} </if>
            <if test="invlifeperiod != null"> and invlifeperiod = #{invlifeperiod} </if>
            <if test="isappendant != null and isappendant != ''"> and isappendant = #{isappendant} </if>
            <if test="isautoatpcheck != null and isautoatpcheck != ''"> and isautoatpcheck = #{isautoatpcheck} </if>
            <if test="iscancalculatedinvcost != null and iscancalculatedinvcost != ''"> and iscancalculatedinvcost = #{iscancalculatedinvcost} </if>
            <if test="iscanpurchased != null and iscanpurchased != ''"> and iscanpurchased = #{iscanpurchased} </if>
            <if test="iscansaleinvoice != null and iscansaleinvoice != ''"> and iscansaleinvoice = #{iscansaleinvoice} </if>
            <if test="iscansold != null and iscansold != ''"> and iscansold = #{iscansold} </if>
            <if test="isconfigable != null and isconfigable != ''"> and isconfigable = #{isconfigable} </if>
            <if test="isctlprodplanprice != null and isctlprodplanprice != ''"> and isctlprodplanprice = #{isctlprodplanprice} </if>
            <if test="isfatherofbom != null and isfatherofbom != ''"> and isfatherofbom = #{isfatherofbom} </if>
            <if test="isinvretfreeofchk != null and isinvretfreeofchk != ''"> and isinvretfreeofchk = #{isinvretfreeofchk} </if>
            <if test="isinvretinstobychk != null and isinvretinstobychk != ''"> and isinvretinstobychk = #{isinvretinstobychk} </if>
            <if test="isinvreturned != null and isinvreturned != ''"> and isinvreturned = #{isinvreturned} </if>
            <if test="isnoconallowed != null and isnoconallowed != ''"> and isnoconallowed = #{isnoconallowed} </if>
            <if test="isprimarybarcode != null and isprimarybarcode != ''"> and isprimarybarcode = #{isprimarybarcode} </if>
            <if test="isrecurrentcheck != null and isrecurrentcheck != ''"> and isrecurrentcheck = #{isrecurrentcheck} </if>
            <if test="issalable != null and issalable != ''"> and issalable = #{issalable} </if>
            <if test="issecondarybarcode != null and issecondarybarcode != ''"> and issecondarybarcode = #{issecondarybarcode} </if>
            <if test="isselfapprsupplier != null and isselfapprsupplier != ''"> and isselfapprsupplier = #{isselfapprsupplier} </if>
            <if test="isspecialty != null and isspecialty != ''"> and isspecialty = #{isspecialty} </if>
            <if test="issupplierstock != null and issupplierstock != ''"> and issupplierstock = #{issupplierstock} </if>
            <if test="isused != null and isused != ''"> and isused = #{isused} </if>
            <if test="isvirtual != null and isvirtual != ''"> and isvirtual = #{isvirtual} </if>
            <if test="keepwasterate != null and keepwasterate != ''"> and keepwasterate = #{keepwasterate} </if>
            <if test="lowestprice != null and lowestprice != ''"> and lowestprice = #{lowestprice} </if>
            <if test="mantaxitem != null and mantaxitem != ''"> and mantaxitem = #{mantaxitem} </if>
            <if test="maxprice != null and maxprice != ''"> and maxprice = #{maxprice} </if>
            <if test="memo != null and memo != ''"> and memo = #{memo} </if>
            <if test="modifier != null and modifier != ''"> and modifier = #{modifier} </if>
            <if test="modifytime != null and modifytime != ''"> and modifytime = #{modifytime} </if>
            <if test="negallowed != null and negallowed != ''"> and negallowed = #{negallowed} </if>
            <if test="outpriority != null"> and outpriority = #{outpriority} </if>
            <if test="outtrackin != null and outtrackin != ''"> and outtrackin = #{outtrackin} </if>
            <if test="pebegin != null and pebegin != ''"> and pebegin = #{pebegin} </if>
            <if test="peend != null and peend != ''"> and peend = #{peend} </if>
            <if test="pkCorp != null and pkCorp != ''"> and pk_corp = #{pkCorp} </if>
            <if test="pkCumandoc != null and pkCumandoc != ''"> and pk_cumandoc = #{pkCumandoc} </if>
            <if test="pkDftfactory != null and pkDftfactory != ''"> and pk_dftfactory = #{pkDftfactory} </if>
            <if test="pkInvbasdoc != null and pkInvbasdoc != ''"> and pk_invbasdoc = #{pkInvbasdoc} </if>
            <if test="pkInvmandoc != null and pkInvmandoc != ''"> and pk_invmandoc = #{pkInvmandoc} </if>
            <if test="pkSealuser != null and pkSealuser != ''"> and pk_sealuser = #{pkSealuser} </if>
            <if test="planprice != null and planprice != ''"> and planprice = #{planprice} </if>
            <if test="prodarea != null and prodarea != ''"> and prodarea = #{prodarea} </if>
            <if test="purchasestge != null and purchasestge != ''"> and purchasestge = #{purchasestge} </if>
            <if test="purwasterate != null and purwasterate != ''"> and purwasterate = #{purwasterate} </if>
            <if test="qualitydaynum != null"> and qualitydaynum = #{qualitydaynum} </if>
            <if test="qualitymanflag != null and qualitymanflag != ''"> and qualitymanflag = #{qualitymanflag} </if>
            <if test="qualityperiodunit != null"> and qualityperiodunit = #{qualityperiodunit} </if>
            <if test="recurrentchkcyc != null"> and recurrentchkcyc = #{recurrentchkcyc} </if>
            <if test="refsaleprice != null and refsaleprice != ''"> and refsaleprice = #{refsaleprice} </if>
            <if test="sealdate != null and sealdate != ''"> and sealdate = #{sealdate} </if>
            <if test="sealflag != null and sealflag != ''"> and sealflag = #{sealflag} </if>
            <if test="sellproxyflag != null and sellproxyflag != ''"> and sellproxyflag = #{sellproxyflag} </if>
            <if test="serialmanaflag != null and serialmanaflag != ''"> and serialmanaflag = #{serialmanaflag} </if>
            <if test="ts != null and ts != ''"> and ts = #{ts} </if>
            <if test="wholemanaflag != null and wholemanaflag != ''"> and wholemanaflag = #{wholemanaflag} </if>
            and dr='0'
    </trim>
 </select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.lets.entity.BdInvmandocEntity">
        select  count(1)   from bd_invmandoc
    <trim prefix="where" prefixOverrides="and"> 
        <if test="abctype != null and abctype != ''"> and abctype = #{abctype} </if>
            <if test="accflag != null and accflag != ''"> and accflag = #{accflag} </if>
            <if test="cinvmnecode != null and cinvmnecode != ''"> and cinvmnecode = #{cinvmnecode} </if>
            <if test="consumesettleflag != null and consumesettleflag != ''"> and consumesettleflag = #{consumesettleflag} </if>
            <if test="coopdayfrom != null and coopdayfrom != ''"> and coopdayfrom = #{coopdayfrom} </if>
            <if test="coopdayto != null and coopdayto != ''"> and coopdayto = #{coopdayto} </if>
            <if test="costprice != null and costprice != ''"> and costprice = #{costprice} </if>
            <if test="createtime != null and createtime != ''"> and createtime = #{createtime} </if>
            <if test="creator != null and creator != ''"> and creator = #{creator} </if>
            <if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
            <if test="def10 != null and def10 != ''"> and def10 = #{def10} </if>
            <if test="def11 != null and def11 != ''"> and def11 = #{def11} </if>
            <if test="def12 != null and def12 != ''"> and def12 = #{def12} </if>
            <if test="def13 != null and def13 != ''"> and def13 = #{def13} </if>
            <if test="def14 != null and def14 != ''"> and def14 = #{def14} </if>
            <if test="def15 != null and def15 != ''"> and def15 = #{def15} </if>
            <if test="def16 != null and def16 != ''"> and def16 = #{def16} </if>
            <if test="def17 != null and def17 != ''"> and def17 = #{def17} </if>
            <if test="def18 != null and def18 != ''"> and def18 = #{def18} </if>
            <if test="def19 != null and def19 != ''"> and def19 = #{def19} </if>
            <if test="def2 != null and def2 != ''"> and def2 = #{def2} </if>
            <if test="def20 != null and def20 != ''"> and def20 = #{def20} </if>
            <if test="def3 != null and def3 != ''"> and def3 = #{def3} </if>
            <if test="def4 != null and def4 != ''"> and def4 = #{def4} </if>
            <if test="def5 != null and def5 != ''"> and def5 = #{def5} </if>
            <if test="def6 != null and def6 != ''"> and def6 = #{def6} </if>
            <if test="def7 != null and def7 != ''"> and def7 = #{def7} </if>
            <if test="def8 != null and def8 != ''"> and def8 = #{def8} </if>
            <if test="def9 != null and def9 != ''"> and def9 = #{def9} </if>
            <if test="dr != null"> and dr = #{dr} </if>
            <if test="expaybacktax != null and expaybacktax != ''"> and expaybacktax = #{expaybacktax} </if>
            <if test="free1 != null and free1 != ''"> and free1 = #{free1} </if>
            <if test="free2 != null and free2 != ''"> and free2 = #{free2} </if>
            <if test="free3 != null and free3 != ''"> and free3 = #{free3} </if>
            <if test="free4 != null and free4 != ''"> and free4 = #{free4} </if>
            <if test="free5 != null and free5 != ''"> and free5 = #{free5} </if>
            <if test="grade != null and grade != ''"> and grade = #{grade} </if>
            <if test="invlifeperiod != null"> and invlifeperiod = #{invlifeperiod} </if>
            <if test="isappendant != null and isappendant != ''"> and isappendant = #{isappendant} </if>
            <if test="isautoatpcheck != null and isautoatpcheck != ''"> and isautoatpcheck = #{isautoatpcheck} </if>
            <if test="iscancalculatedinvcost != null and iscancalculatedinvcost != ''"> and iscancalculatedinvcost = #{iscancalculatedinvcost} </if>
            <if test="iscanpurchased != null and iscanpurchased != ''"> and iscanpurchased = #{iscanpurchased} </if>
            <if test="iscansaleinvoice != null and iscansaleinvoice != ''"> and iscansaleinvoice = #{iscansaleinvoice} </if>
            <if test="iscansold != null and iscansold != ''"> and iscansold = #{iscansold} </if>
            <if test="isconfigable != null and isconfigable != ''"> and isconfigable = #{isconfigable} </if>
            <if test="isctlprodplanprice != null and isctlprodplanprice != ''"> and isctlprodplanprice = #{isctlprodplanprice} </if>
            <if test="isfatherofbom != null and isfatherofbom != ''"> and isfatherofbom = #{isfatherofbom} </if>
            <if test="isinvretfreeofchk != null and isinvretfreeofchk != ''"> and isinvretfreeofchk = #{isinvretfreeofchk} </if>
            <if test="isinvretinstobychk != null and isinvretinstobychk != ''"> and isinvretinstobychk = #{isinvretinstobychk} </if>
            <if test="isinvreturned != null and isinvreturned != ''"> and isinvreturned = #{isinvreturned} </if>
            <if test="isnoconallowed != null and isnoconallowed != ''"> and isnoconallowed = #{isnoconallowed} </if>
            <if test="isprimarybarcode != null and isprimarybarcode != ''"> and isprimarybarcode = #{isprimarybarcode} </if>
            <if test="isrecurrentcheck != null and isrecurrentcheck != ''"> and isrecurrentcheck = #{isrecurrentcheck} </if>
            <if test="issalable != null and issalable != ''"> and issalable = #{issalable} </if>
            <if test="issecondarybarcode != null and issecondarybarcode != ''"> and issecondarybarcode = #{issecondarybarcode} </if>
            <if test="isselfapprsupplier != null and isselfapprsupplier != ''"> and isselfapprsupplier = #{isselfapprsupplier} </if>
            <if test="isspecialty != null and isspecialty != ''"> and isspecialty = #{isspecialty} </if>
            <if test="issupplierstock != null and issupplierstock != ''"> and issupplierstock = #{issupplierstock} </if>
            <if test="isused != null and isused != ''"> and isused = #{isused} </if>
            <if test="isvirtual != null and isvirtual != ''"> and isvirtual = #{isvirtual} </if>
            <if test="keepwasterate != null and keepwasterate != ''"> and keepwasterate = #{keepwasterate} </if>
            <if test="lowestprice != null and lowestprice != ''"> and lowestprice = #{lowestprice} </if>
            <if test="mantaxitem != null and mantaxitem != ''"> and mantaxitem = #{mantaxitem} </if>
            <if test="maxprice != null and maxprice != ''"> and maxprice = #{maxprice} </if>
            <if test="memo != null and memo != ''"> and memo = #{memo} </if>
            <if test="modifier != null and modifier != ''"> and modifier = #{modifier} </if>
            <if test="modifytime != null and modifytime != ''"> and modifytime = #{modifytime} </if>
            <if test="negallowed != null and negallowed != ''"> and negallowed = #{negallowed} </if>
            <if test="outpriority != null"> and outpriority = #{outpriority} </if>
            <if test="outtrackin != null and outtrackin != ''"> and outtrackin = #{outtrackin} </if>
            <if test="pebegin != null and pebegin != ''"> and pebegin = #{pebegin} </if>
            <if test="peend != null and peend != ''"> and peend = #{peend} </if>
            <if test="pkCorp != null and pkCorp != ''"> and pk_corp = #{pkCorp} </if>
            <if test="pkCumandoc != null and pkCumandoc != ''"> and pk_cumandoc = #{pkCumandoc} </if>
            <if test="pkDftfactory != null and pkDftfactory != ''"> and pk_dftfactory = #{pkDftfactory} </if>
            <if test="pkInvbasdoc != null and pkInvbasdoc != ''"> and pk_invbasdoc = #{pkInvbasdoc} </if>
            <if test="pkInvmandoc != null and pkInvmandoc != ''"> and pk_invmandoc = #{pkInvmandoc} </if>
            <if test="pkSealuser != null and pkSealuser != ''"> and pk_sealuser = #{pkSealuser} </if>
            <if test="planprice != null and planprice != ''"> and planprice = #{planprice} </if>
            <if test="prodarea != null and prodarea != ''"> and prodarea = #{prodarea} </if>
            <if test="purchasestge != null and purchasestge != ''"> and purchasestge = #{purchasestge} </if>
            <if test="purwasterate != null and purwasterate != ''"> and purwasterate = #{purwasterate} </if>
            <if test="qualitydaynum != null"> and qualitydaynum = #{qualitydaynum} </if>
            <if test="qualitymanflag != null and qualitymanflag != ''"> and qualitymanflag = #{qualitymanflag} </if>
            <if test="qualityperiodunit != null"> and qualityperiodunit = #{qualityperiodunit} </if>
            <if test="recurrentchkcyc != null"> and recurrentchkcyc = #{recurrentchkcyc} </if>
            <if test="refsaleprice != null and refsaleprice != ''"> and refsaleprice = #{refsaleprice} </if>
            <if test="sealdate != null and sealdate != ''"> and sealdate = #{sealdate} </if>
            <if test="sealflag != null and sealflag != ''"> and sealflag = #{sealflag} </if>
            <if test="sellproxyflag != null and sellproxyflag != ''"> and sellproxyflag = #{sellproxyflag} </if>
            <if test="serialmanaflag != null and serialmanaflag != ''"> and serialmanaflag = #{serialmanaflag} </if>
            <if test="ts != null and ts != ''"> and ts = #{ts} </if>
            <if test="wholemanaflag != null and wholemanaflag != ''"> and wholemanaflag = #{wholemanaflag} </if>
            and sts='Y'
    </trim>
    <if test=" 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-BdInvmandocEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdInvmandocEntity">
    select
    <include refid="BdInvmandocEntity_Base_Column_List" />
    from bd_invmandoc
    <trim prefix="where" prefixOverrides="and"> 
        <if test="abctype != null and abctype != ''"> and abctype like concat('%',#{abctype},'%') </if>
            <if test="accflag != null and accflag != ''"> and accflag like concat('%',#{accflag},'%') </if>
            <if test="cinvmnecode != null and cinvmnecode != ''"> and cinvmnecode like concat('%',#{cinvmnecode},'%') </if>
            <if test="consumesettleflag != null and consumesettleflag != ''"> and consumesettleflag like concat('%',#{consumesettleflag},'%') </if>
            <if test="coopdayfrom != null and coopdayfrom != ''"> and coopdayfrom like concat('%',#{coopdayfrom},'%') </if>
            <if test="coopdayto != null and coopdayto != ''"> and coopdayto like concat('%',#{coopdayto},'%') </if>
            <if test="costprice != null and costprice != ''"> and costprice like concat('%',#{costprice},'%') </if>
            <if test="createtime != null and createtime != ''"> and createtime like concat('%',#{createtime},'%') </if>
            <if test="creator != null and creator != ''"> and creator like concat('%',#{creator},'%') </if>
            <if test="def1 != null and def1 != ''"> and def1 like concat('%',#{def1},'%') </if>
            <if test="def10 != null and def10 != ''"> and def10 like concat('%',#{def10},'%') </if>
            <if test="def11 != null and def11 != ''"> and def11 like concat('%',#{def11},'%') </if>
            <if test="def12 != null and def12 != ''"> and def12 like concat('%',#{def12},'%') </if>
            <if test="def13 != null and def13 != ''"> and def13 like concat('%',#{def13},'%') </if>
            <if test="def14 != null and def14 != ''"> and def14 like concat('%',#{def14},'%') </if>
            <if test="def15 != null and def15 != ''"> and def15 like concat('%',#{def15},'%') </if>
            <if test="def16 != null and def16 != ''"> and def16 like concat('%',#{def16},'%') </if>
            <if test="def17 != null and def17 != ''"> and def17 like concat('%',#{def17},'%') </if>
            <if test="def18 != null and def18 != ''"> and def18 like concat('%',#{def18},'%') </if>
            <if test="def19 != null and def19 != ''"> and def19 like concat('%',#{def19},'%') </if>
            <if test="def2 != null and def2 != ''"> and def2 like concat('%',#{def2},'%') </if>
            <if test="def20 != null and def20 != ''"> and def20 like concat('%',#{def20},'%') </if>
            <if test="def3 != null and def3 != ''"> and def3 like concat('%',#{def3},'%') </if>
            <if test="def4 != null and def4 != ''"> and def4 like concat('%',#{def4},'%') </if>
            <if test="def5 != null and def5 != ''"> and def5 like concat('%',#{def5},'%') </if>
            <if test="def6 != null and def6 != ''"> and def6 like concat('%',#{def6},'%') </if>
            <if test="def7 != null and def7 != ''"> and def7 like concat('%',#{def7},'%') </if>
            <if test="def8 != null and def8 != ''"> and def8 like concat('%',#{def8},'%') </if>
            <if test="def9 != null and def9 != ''"> and def9 like concat('%',#{def9},'%') </if>
            <if test="dr != null"> and dr like concat('%',#{dr},'%') </if>
            <if test="expaybacktax != null and expaybacktax != ''"> and expaybacktax like concat('%',#{expaybacktax},'%') </if>
            <if test="free1 != null and free1 != ''"> and free1 like concat('%',#{free1},'%') </if>
            <if test="free2 != null and free2 != ''"> and free2 like concat('%',#{free2},'%') </if>
            <if test="free3 != null and free3 != ''"> and free3 like concat('%',#{free3},'%') </if>
            <if test="free4 != null and free4 != ''"> and free4 like concat('%',#{free4},'%') </if>
            <if test="free5 != null and free5 != ''"> and free5 like concat('%',#{free5},'%') </if>
            <if test="grade != null and grade != ''"> and grade like concat('%',#{grade},'%') </if>
            <if test="invlifeperiod != null"> and invlifeperiod like concat('%',#{invlifeperiod},'%') </if>
            <if test="isappendant != null and isappendant != ''"> and isappendant like concat('%',#{isappendant},'%') </if>
            <if test="isautoatpcheck != null and isautoatpcheck != ''"> and isautoatpcheck like concat('%',#{isautoatpcheck},'%') </if>
            <if test="iscancalculatedinvcost != null and iscancalculatedinvcost != ''"> and iscancalculatedinvcost like concat('%',#{iscancalculatedinvcost},'%') </if>
            <if test="iscanpurchased != null and iscanpurchased != ''"> and iscanpurchased like concat('%',#{iscanpurchased},'%') </if>
            <if test="iscansaleinvoice != null and iscansaleinvoice != ''"> and iscansaleinvoice like concat('%',#{iscansaleinvoice},'%') </if>
            <if test="iscansold != null and iscansold != ''"> and iscansold like concat('%',#{iscansold},'%') </if>
            <if test="isconfigable != null and isconfigable != ''"> and isconfigable like concat('%',#{isconfigable},'%') </if>
            <if test="isctlprodplanprice != null and isctlprodplanprice != ''"> and isctlprodplanprice like concat('%',#{isctlprodplanprice},'%') </if>
            <if test="isfatherofbom != null and isfatherofbom != ''"> and isfatherofbom like concat('%',#{isfatherofbom},'%') </if>
            <if test="isinvretfreeofchk != null and isinvretfreeofchk != ''"> and isinvretfreeofchk like concat('%',#{isinvretfreeofchk},'%') </if>
            <if test="isinvretinstobychk != null and isinvretinstobychk != ''"> and isinvretinstobychk like concat('%',#{isinvretinstobychk},'%') </if>
            <if test="isinvreturned != null and isinvreturned != ''"> and isinvreturned like concat('%',#{isinvreturned},'%') </if>
            <if test="isnoconallowed != null and isnoconallowed != ''"> and isnoconallowed like concat('%',#{isnoconallowed},'%') </if>
            <if test="isprimarybarcode != null and isprimarybarcode != ''"> and isprimarybarcode like concat('%',#{isprimarybarcode},'%') </if>
            <if test="isrecurrentcheck != null and isrecurrentcheck != ''"> and isrecurrentcheck like concat('%',#{isrecurrentcheck},'%') </if>
            <if test="issalable != null and issalable != ''"> and issalable like concat('%',#{issalable},'%') </if>
            <if test="issecondarybarcode != null and issecondarybarcode != ''"> and issecondarybarcode like concat('%',#{issecondarybarcode},'%') </if>
            <if test="isselfapprsupplier != null and isselfapprsupplier != ''"> and isselfapprsupplier like concat('%',#{isselfapprsupplier},'%') </if>
            <if test="isspecialty != null and isspecialty != ''"> and isspecialty like concat('%',#{isspecialty},'%') </if>
            <if test="issupplierstock != null and issupplierstock != ''"> and issupplierstock like concat('%',#{issupplierstock},'%') </if>
            <if test="isused != null and isused != ''"> and isused like concat('%',#{isused},'%') </if>
            <if test="isvirtual != null and isvirtual != ''"> and isvirtual like concat('%',#{isvirtual},'%') </if>
            <if test="keepwasterate != null and keepwasterate != ''"> and keepwasterate like concat('%',#{keepwasterate},'%') </if>
            <if test="lowestprice != null and lowestprice != ''"> and lowestprice like concat('%',#{lowestprice},'%') </if>
            <if test="mantaxitem != null and mantaxitem != ''"> and mantaxitem like concat('%',#{mantaxitem},'%') </if>
            <if test="maxprice != null and maxprice != ''"> and maxprice like concat('%',#{maxprice},'%') </if>
            <if test="memo != null and memo != ''"> and memo like concat('%',#{memo},'%') </if>
            <if test="modifier != null and modifier != ''"> and modifier like concat('%',#{modifier},'%') </if>
            <if test="modifytime != null and modifytime != ''"> and modifytime like concat('%',#{modifytime},'%') </if>
            <if test="negallowed != null and negallowed != ''"> and negallowed like concat('%',#{negallowed},'%') </if>
            <if test="outpriority != null"> and outpriority like concat('%',#{outpriority},'%') </if>
            <if test="outtrackin != null and outtrackin != ''"> and outtrackin like concat('%',#{outtrackin},'%') </if>
            <if test="pebegin != null and pebegin != ''"> and pebegin like concat('%',#{pebegin},'%') </if>
            <if test="peend != null and peend != ''"> and peend like concat('%',#{peend},'%') </if>
            <if test="pkCorp != null and pkCorp != ''"> and pk_corp like concat('%',#{pkCorp},'%') </if>
            <if test="pkCumandoc != null and pkCumandoc != ''"> and pk_cumandoc like concat('%',#{pkCumandoc},'%') </if>
            <if test="pkDftfactory != null and pkDftfactory != ''"> and pk_dftfactory like concat('%',#{pkDftfactory},'%') </if>
            <if test="pkInvbasdoc != null and pkInvbasdoc != ''"> and pk_invbasdoc like concat('%',#{pkInvbasdoc},'%') </if>
            <if test="pkInvmandoc != null and pkInvmandoc != ''"> and pk_invmandoc like concat('%',#{pkInvmandoc},'%') </if>
            <if test="pkSealuser != null and pkSealuser != ''"> and pk_sealuser like concat('%',#{pkSealuser},'%') </if>
            <if test="planprice != null and planprice != ''"> and planprice like concat('%',#{planprice},'%') </if>
            <if test="prodarea != null and prodarea != ''"> and prodarea like concat('%',#{prodarea},'%') </if>
            <if test="purchasestge != null and purchasestge != ''"> and purchasestge like concat('%',#{purchasestge},'%') </if>
            <if test="purwasterate != null and purwasterate != ''"> and purwasterate like concat('%',#{purwasterate},'%') </if>
            <if test="qualitydaynum != null"> and qualitydaynum like concat('%',#{qualitydaynum},'%') </if>
            <if test="qualitymanflag != null and qualitymanflag != ''"> and qualitymanflag like concat('%',#{qualitymanflag},'%') </if>
            <if test="qualityperiodunit != null"> and qualityperiodunit like concat('%',#{qualityperiodunit},'%') </if>
            <if test="recurrentchkcyc != null"> and recurrentchkcyc like concat('%',#{recurrentchkcyc},'%') </if>
            <if test="refsaleprice != null and refsaleprice != ''"> and refsaleprice like concat('%',#{refsaleprice},'%') </if>
            <if test="sealdate != null and sealdate != ''"> and sealdate like concat('%',#{sealdate},'%') </if>
            <if test="sealflag != null and sealflag != ''"> and sealflag like concat('%',#{sealflag},'%') </if>
            <if test="sellproxyflag != null and sellproxyflag != ''"> and sellproxyflag like concat('%',#{sellproxyflag},'%') </if>
            <if test="serialmanaflag != null and serialmanaflag != ''"> and serialmanaflag like concat('%',#{serialmanaflag},'%') </if>
            <if test="ts != null and ts != ''"> and ts like concat('%',#{ts},'%') </if>
            <if test="wholemanaflag != null and wholemanaflag != ''"> and wholemanaflag like concat('%',#{wholemanaflag},'%') </if>
            and sts='Y'
    </trim>
    <if test=" 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="BdInvmandocentity_list_or" resultMap="get-BdInvmandocEntity-result" parameterType = "com.hzya.frame.plugin.lets.entity.BdInvmandocEntity">
    select
    <include refid="BdInvmandocEntity_Base_Column_List" />
    from bd_invmandoc
    <trim prefix="where" prefixOverrides="and"> 
         <if test="abctype != null and abctype != ''"> or abctype = #{abctype} </if>
             <if test="accflag != null and accflag != ''"> or accflag = #{accflag} </if>
             <if test="cinvmnecode != null and cinvmnecode != ''"> or cinvmnecode = #{cinvmnecode} </if>
             <if test="consumesettleflag != null and consumesettleflag != ''"> or consumesettleflag = #{consumesettleflag} </if>
             <if test="coopdayfrom != null and coopdayfrom != ''"> or coopdayfrom = #{coopdayfrom} </if>
             <if test="coopdayto != null and coopdayto != ''"> or coopdayto = #{coopdayto} </if>
             <if test="costprice != null and costprice != ''"> or costprice = #{costprice} </if>
             <if test="createtime != null and createtime != ''"> or createtime = #{createtime} </if>
             <if test="creator != null and creator != ''"> or creator = #{creator} </if>
             <if test="def1 != null and def1 != ''"> or def1 = #{def1} </if>
             <if test="def10 != null and def10 != ''"> or def10 = #{def10} </if>
             <if test="def11 != null and def11 != ''"> or def11 = #{def11} </if>
             <if test="def12 != null and def12 != ''"> or def12 = #{def12} </if>
             <if test="def13 != null and def13 != ''"> or def13 = #{def13} </if>
             <if test="def14 != null and def14 != ''"> or def14 = #{def14} </if>
             <if test="def15 != null and def15 != ''"> or def15 = #{def15} </if>
             <if test="def16 != null and def16 != ''"> or def16 = #{def16} </if>
             <if test="def17 != null and def17 != ''"> or def17 = #{def17} </if>
             <if test="def18 != null and def18 != ''"> or def18 = #{def18} </if>
             <if test="def19 != null and def19 != ''"> or def19 = #{def19} </if>
             <if test="def2 != null and def2 != ''"> or def2 = #{def2} </if>
             <if test="def20 != null and def20 != ''"> or def20 = #{def20} </if>
             <if test="def3 != null and def3 != ''"> or def3 = #{def3} </if>
             <if test="def4 != null and def4 != ''"> or def4 = #{def4} </if>
             <if test="def5 != null and def5 != ''"> or def5 = #{def5} </if>
             <if test="def6 != null and def6 != ''"> or def6 = #{def6} </if>
             <if test="def7 != null and def7 != ''"> or def7 = #{def7} </if>
             <if test="def8 != null and def8 != ''"> or def8 = #{def8} </if>
             <if test="def9 != null and def9 != ''"> or def9 = #{def9} </if>
             <if test="dr != null"> or dr = #{dr} </if>
             <if test="expaybacktax != null and expaybacktax != ''"> or expaybacktax = #{expaybacktax} </if>
             <if test="free1 != null and free1 != ''"> or free1 = #{free1} </if>
             <if test="free2 != null and free2 != ''"> or free2 = #{free2} </if>
             <if test="free3 != null and free3 != ''"> or free3 = #{free3} </if>
             <if test="free4 != null and free4 != ''"> or free4 = #{free4} </if>
             <if test="free5 != null and free5 != ''"> or free5 = #{free5} </if>
             <if test="grade != null and grade != ''"> or grade = #{grade} </if>
             <if test="invlifeperiod != null"> or invlifeperiod = #{invlifeperiod} </if>
             <if test="isappendant != null and isappendant != ''"> or isappendant = #{isappendant} </if>
             <if test="isautoatpcheck != null and isautoatpcheck != ''"> or isautoatpcheck = #{isautoatpcheck} </if>
             <if test="iscancalculatedinvcost != null and iscancalculatedinvcost != ''"> or iscancalculatedinvcost = #{iscancalculatedinvcost} </if>
             <if test="iscanpurchased != null and iscanpurchased != ''"> or iscanpurchased = #{iscanpurchased} </if>
             <if test="iscansaleinvoice != null and iscansaleinvoice != ''"> or iscansaleinvoice = #{iscansaleinvoice} </if>
             <if test="iscansold != null and iscansold != ''"> or iscansold = #{iscansold} </if>
             <if test="isconfigable != null and isconfigable != ''"> or isconfigable = #{isconfigable} </if>
             <if test="isctlprodplanprice != null and isctlprodplanprice != ''"> or isctlprodplanprice = #{isctlprodplanprice} </if>
             <if test="isfatherofbom != null and isfatherofbom != ''"> or isfatherofbom = #{isfatherofbom} </if>
             <if test="isinvretfreeofchk != null and isinvretfreeofchk != ''"> or isinvretfreeofchk = #{isinvretfreeofchk} </if>
             <if test="isinvretinstobychk != null and isinvretinstobychk != ''"> or isinvretinstobychk = #{isinvretinstobychk} </if>
             <if test="isinvreturned != null and isinvreturned != ''"> or isinvreturned = #{isinvreturned} </if>
             <if test="isnoconallowed != null and isnoconallowed != ''"> or isnoconallowed = #{isnoconallowed} </if>
             <if test="isprimarybarcode != null and isprimarybarcode != ''"> or isprimarybarcode = #{isprimarybarcode} </if>
             <if test="isrecurrentcheck != null and isrecurrentcheck != ''"> or isrecurrentcheck = #{isrecurrentcheck} </if>
             <if test="issalable != null and issalable != ''"> or issalable = #{issalable} </if>
             <if test="issecondarybarcode != null and issecondarybarcode != ''"> or issecondarybarcode = #{issecondarybarcode} </if>
             <if test="isselfapprsupplier != null and isselfapprsupplier != ''"> or isselfapprsupplier = #{isselfapprsupplier} </if>
             <if test="isspecialty != null and isspecialty != ''"> or isspecialty = #{isspecialty} </if>
             <if test="issupplierstock != null and issupplierstock != ''"> or issupplierstock = #{issupplierstock} </if>
             <if test="isused != null and isused != ''"> or isused = #{isused} </if>
             <if test="isvirtual != null and isvirtual != ''"> or isvirtual = #{isvirtual} </if>
             <if test="keepwasterate != null and keepwasterate != ''"> or keepwasterate = #{keepwasterate} </if>
             <if test="lowestprice != null and lowestprice != ''"> or lowestprice = #{lowestprice} </if>
             <if test="mantaxitem != null and mantaxitem != ''"> or mantaxitem = #{mantaxitem} </if>
             <if test="maxprice != null and maxprice != ''"> or maxprice = #{maxprice} </if>
             <if test="memo != null and memo != ''"> or memo = #{memo} </if>
             <if test="modifier != null and modifier != ''"> or modifier = #{modifier} </if>
             <if test="modifytime != null and modifytime != ''"> or modifytime = #{modifytime} </if>
             <if test="negallowed != null and negallowed != ''"> or negallowed = #{negallowed} </if>
             <if test="outpriority != null"> or outpriority = #{outpriority} </if>
             <if test="outtrackin != null and outtrackin != ''"> or outtrackin = #{outtrackin} </if>
             <if test="pebegin != null and pebegin != ''"> or pebegin = #{pebegin} </if>
             <if test="peend != null and peend != ''"> or peend = #{peend} </if>
             <if test="pkCorp != null and pkCorp != ''"> or pk_corp = #{pkCorp} </if>
             <if test="pkCumandoc != null and pkCumandoc != ''"> or pk_cumandoc = #{pkCumandoc} </if>
             <if test="pkDftfactory != null and pkDftfactory != ''"> or pk_dftfactory = #{pkDftfactory} </if>
             <if test="pkInvbasdoc != null and pkInvbasdoc != ''"> or pk_invbasdoc = #{pkInvbasdoc} </if>
             <if test="pkInvmandoc != null and pkInvmandoc != ''"> or pk_invmandoc = #{pkInvmandoc} </if>
             <if test="pkSealuser != null and pkSealuser != ''"> or pk_sealuser = #{pkSealuser} </if>
             <if test="planprice != null and planprice != ''"> or planprice = #{planprice} </if>
             <if test="prodarea != null and prodarea != ''"> or prodarea = #{prodarea} </if>
             <if test="purchasestge != null and purchasestge != ''"> or purchasestge = #{purchasestge} </if>
             <if test="purwasterate != null and purwasterate != ''"> or purwasterate = #{purwasterate} </if>
             <if test="qualitydaynum != null"> or qualitydaynum = #{qualitydaynum} </if>
             <if test="qualitymanflag != null and qualitymanflag != ''"> or qualitymanflag = #{qualitymanflag} </if>
             <if test="qualityperiodunit != null"> or qualityperiodunit = #{qualityperiodunit} </if>
             <if test="recurrentchkcyc != null"> or recurrentchkcyc = #{recurrentchkcyc} </if>
             <if test="refsaleprice != null and refsaleprice != ''"> or refsaleprice = #{refsaleprice} </if>
             <if test="sealdate != null and sealdate != ''"> or sealdate = #{sealdate} </if>
             <if test="sealflag != null and sealflag != ''"> or sealflag = #{sealflag} </if>
             <if test="sellproxyflag != null and sellproxyflag != ''"> or sellproxyflag = #{sellproxyflag} </if>
             <if test="serialmanaflag != null and serialmanaflag != ''"> or serialmanaflag = #{serialmanaflag} </if>
             <if test="ts != null and ts != ''"> or ts = #{ts} </if>
             <if test="wholemanaflag != null and wholemanaflag != ''"> or wholemanaflag = #{wholemanaflag} </if>
            and sts='Y'
    </trim>
    <if test=" 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.BdInvmandocEntity" keyProperty="pkInvmandoc" useGeneratedKeys="true">
    insert into bd_invmandoc(
  <trim suffix="" suffixOverrides=",">
       <if test="abctype != null and abctype != ''"> abctype , </if>
            <if test="accflag != null and accflag != ''"> accflag , </if>
            <if test="cinvmnecode != null and cinvmnecode != ''"> cinvmnecode , </if>
            <if test="consumesettleflag != null and consumesettleflag != ''"> consumesettleflag , </if>
            <if test="coopdayfrom != null and coopdayfrom != ''"> coopdayfrom , </if>
            <if test="coopdayto != null and coopdayto != ''"> coopdayto , </if>
            <if test="costprice != null and costprice != ''"> costprice , </if>
            <if test="createtime != null and createtime != ''"> createtime , </if>
            <if test="creator != null and creator != ''"> creator , </if>
            <if test="def1 != null and def1 != ''"> def1 , </if>
            <if test="def10 != null and def10 != ''"> def10 , </if>
            <if test="def11 != null and def11 != ''"> def11 , </if>
            <if test="def12 != null and def12 != ''"> def12 , </if>
            <if test="def13 != null and def13 != ''"> def13 , </if>
            <if test="def14 != null and def14 != ''"> def14 , </if>
            <if test="def15 != null and def15 != ''"> def15 , </if>
            <if test="def16 != null and def16 != ''"> def16 , </if>
            <if test="def17 != null and def17 != ''"> def17 , </if>
            <if test="def18 != null and def18 != ''"> def18 , </if>
            <if test="def19 != null and def19 != ''"> def19 , </if>
            <if test="def2 != null and def2 != ''"> def2 , </if>
            <if test="def20 != null and def20 != ''"> def20 , </if>
            <if test="def3 != null and def3 != ''"> def3 , </if>
            <if test="def4 != null and def4 != ''"> def4 , </if>
            <if test="def5 != null and def5 != ''"> def5 , </if>
            <if test="def6 != null and def6 != ''"> def6 , </if>
            <if test="def7 != null and def7 != ''"> def7 , </if>
            <if test="def8 != null and def8 != ''"> def8 , </if>
            <if test="def9 != null and def9 != ''"> def9 , </if>
            <if test="dr != null"> dr , </if>
            <if test="expaybacktax != null and expaybacktax != ''"> expaybacktax , </if>
            <if test="free1 != null and free1 != ''"> free1 , </if>
            <if test="free2 != null and free2 != ''"> free2 , </if>
            <if test="free3 != null and free3 != ''"> free3 , </if>
            <if test="free4 != null and free4 != ''"> free4 , </if>
            <if test="free5 != null and free5 != ''"> free5 , </if>
            <if test="grade != null and grade != ''"> grade , </if>
            <if test="invlifeperiod != null"> invlifeperiod , </if>
            <if test="isappendant != null and isappendant != ''"> isappendant , </if>
            <if test="isautoatpcheck != null and isautoatpcheck != ''"> isautoatpcheck , </if>
            <if test="iscancalculatedinvcost != null and iscancalculatedinvcost != ''"> iscancalculatedinvcost , </if>
            <if test="iscanpurchased != null and iscanpurchased != ''"> iscanpurchased , </if>
            <if test="iscansaleinvoice != null and iscansaleinvoice != ''"> iscansaleinvoice , </if>
            <if test="iscansold != null and iscansold != ''"> iscansold , </if>
            <if test="isconfigable != null and isconfigable != ''"> isconfigable , </if>
            <if test="isctlprodplanprice != null and isctlprodplanprice != ''"> isctlprodplanprice , </if>
            <if test="isfatherofbom != null and isfatherofbom != ''"> isfatherofbom , </if>
            <if test="isinvretfreeofchk != null and isinvretfreeofchk != ''"> isinvretfreeofchk , </if>
            <if test="isinvretinstobychk != null and isinvretinstobychk != ''"> isinvretinstobychk , </if>
            <if test="isinvreturned != null and isinvreturned != ''"> isinvreturned , </if>
            <if test="isnoconallowed != null and isnoconallowed != ''"> isnoconallowed , </if>
            <if test="isprimarybarcode != null and isprimarybarcode != ''"> isprimarybarcode , </if>
            <if test="isrecurrentcheck != null and isrecurrentcheck != ''"> isrecurrentcheck , </if>
            <if test="issalable != null and issalable != ''"> issalable , </if>
            <if test="issecondarybarcode != null and issecondarybarcode != ''"> issecondarybarcode , </if>
            <if test="isselfapprsupplier != null and isselfapprsupplier != ''"> isselfapprsupplier , </if>
            <if test="isspecialty != null and isspecialty != ''"> isspecialty , </if>
            <if test="issupplierstock != null and issupplierstock != ''"> issupplierstock , </if>
            <if test="isused != null and isused != ''"> isused , </if>
            <if test="isvirtual != null and isvirtual != ''"> isvirtual , </if>
            <if test="keepwasterate != null and keepwasterate != ''"> keepwasterate , </if>
            <if test="lowestprice != null and lowestprice != ''"> lowestprice , </if>
            <if test="mantaxitem != null and mantaxitem != ''"> mantaxitem , </if>
            <if test="maxprice != null and maxprice != ''"> maxprice , </if>
            <if test="memo != null and memo != ''"> memo , </if>
            <if test="modifier != null and modifier != ''"> modifier , </if>
            <if test="modifytime != null and modifytime != ''"> modifytime , </if>
            <if test="negallowed != null and negallowed != ''"> negallowed , </if>
            <if test="outpriority != null"> outpriority , </if>
            <if test="outtrackin != null and outtrackin != ''"> outtrackin , </if>
            <if test="pebegin != null and pebegin != ''"> pebegin , </if>
            <if test="peend != null and peend != ''"> peend , </if>
            <if test="pkCorp != null and pkCorp != ''"> pk_corp , </if>
            <if test="pkCumandoc != null and pkCumandoc != ''"> pk_cumandoc , </if>
            <if test="pkDftfactory != null and pkDftfactory != ''"> pk_dftfactory , </if>
            <if test="pkInvbasdoc != null and pkInvbasdoc != ''"> pk_invbasdoc , </if>
            <if test="pkInvmandoc != null and pkInvmandoc != ''"> pk_invmandoc , </if>
            <if test="pkSealuser != null and pkSealuser != ''"> pk_sealuser , </if>
            <if test="planprice != null and planprice != ''"> planprice , </if>
            <if test="prodarea != null and prodarea != ''"> prodarea , </if>
            <if test="purchasestge != null and purchasestge != ''"> purchasestge , </if>
            <if test="purwasterate != null and purwasterate != ''"> purwasterate , </if>
            <if test="qualitydaynum != null"> qualitydaynum , </if>
            <if test="qualitymanflag != null and qualitymanflag != ''"> qualitymanflag , </if>
            <if test="qualityperiodunit != null"> qualityperiodunit , </if>
            <if test="recurrentchkcyc != null"> recurrentchkcyc , </if>
            <if test="refsaleprice != null and refsaleprice != ''"> refsaleprice , </if>
            <if test="sealdate != null and sealdate != ''"> sealdate , </if>
            <if test="sealflag != null and sealflag != ''"> sealflag , </if>
            <if test="sellproxyflag != null and sellproxyflag != ''"> sellproxyflag , </if>
            <if test="serialmanaflag != null and serialmanaflag != ''"> serialmanaflag , </if>
            <if test="ts != null and ts != ''"> ts , </if>
            <if test="wholemanaflag != null and wholemanaflag != ''"> wholemanaflag , </if>
            <if test="sorts == null ">sorts,</if>
    <if test="sts == null ">sts,</if>
  </trim>
  )values(
 <trim suffix="" suffixOverrides=",">
       <if test="abctype != null and abctype != ''"> #{abctype} ,</if>
            <if test="accflag != null and accflag != ''"> #{accflag} ,</if>
            <if test="cinvmnecode != null and cinvmnecode != ''"> #{cinvmnecode} ,</if>
            <if test="consumesettleflag != null and consumesettleflag != ''"> #{consumesettleflag} ,</if>
            <if test="coopdayfrom != null and coopdayfrom != ''"> #{coopdayfrom} ,</if>
            <if test="coopdayto != null and coopdayto != ''"> #{coopdayto} ,</if>
            <if test="costprice != null and costprice != ''"> #{costprice} ,</if>
            <if test="createtime != null and createtime != ''"> #{createtime} ,</if>
            <if test="creator != null and creator != ''"> #{creator} ,</if>
            <if test="def1 != null and def1 != ''"> #{def1} ,</if>
            <if test="def10 != null and def10 != ''"> #{def10} ,</if>
            <if test="def11 != null and def11 != ''"> #{def11} ,</if>
            <if test="def12 != null and def12 != ''"> #{def12} ,</if>
            <if test="def13 != null and def13 != ''"> #{def13} ,</if>
            <if test="def14 != null and def14 != ''"> #{def14} ,</if>
            <if test="def15 != null and def15 != ''"> #{def15} ,</if>
            <if test="def16 != null and def16 != ''"> #{def16} ,</if>
            <if test="def17 != null and def17 != ''"> #{def17} ,</if>
            <if test="def18 != null and def18 != ''"> #{def18} ,</if>
            <if test="def19 != null and def19 != ''"> #{def19} ,</if>
            <if test="def2 != null and def2 != ''"> #{def2} ,</if>
            <if test="def20 != null and def20 != ''"> #{def20} ,</if>
            <if test="def3 != null and def3 != ''"> #{def3} ,</if>
            <if test="def4 != null and def4 != ''"> #{def4} ,</if>
            <if test="def5 != null and def5 != ''"> #{def5} ,</if>
            <if test="def6 != null and def6 != ''"> #{def6} ,</if>
            <if test="def7 != null and def7 != ''"> #{def7} ,</if>
            <if test="def8 != null and def8 != ''"> #{def8} ,</if>
            <if test="def9 != null and def9 != ''"> #{def9} ,</if>
            <if test="dr != null"> #{dr} ,</if>
            <if test="expaybacktax != null and expaybacktax != ''"> #{expaybacktax} ,</if>
            <if test="free1 != null and free1 != ''"> #{free1} ,</if>
            <if test="free2 != null and free2 != ''"> #{free2} ,</if>
            <if test="free3 != null and free3 != ''"> #{free3} ,</if>
            <if test="free4 != null and free4 != ''"> #{free4} ,</if>
            <if test="free5 != null and free5 != ''"> #{free5} ,</if>
            <if test="grade != null and grade != ''"> #{grade} ,</if>
            <if test="invlifeperiod != null"> #{invlifeperiod} ,</if>
            <if test="isappendant != null and isappendant != ''"> #{isappendant} ,</if>
            <if test="isautoatpcheck != null and isautoatpcheck != ''"> #{isautoatpcheck} ,</if>
            <if test="iscancalculatedinvcost != null and iscancalculatedinvcost != ''"> #{iscancalculatedinvcost} ,</if>
            <if test="iscanpurchased != null and iscanpurchased != ''"> #{iscanpurchased} ,</if>
            <if test="iscansaleinvoice != null and iscansaleinvoice != ''"> #{iscansaleinvoice} ,</if>
            <if test="iscansold != null and iscansold != ''"> #{iscansold} ,</if>
            <if test="isconfigable != null and isconfigable != ''"> #{isconfigable} ,</if>
            <if test="isctlprodplanprice != null and isctlprodplanprice != ''"> #{isctlprodplanprice} ,</if>
            <if test="isfatherofbom != null and isfatherofbom != ''"> #{isfatherofbom} ,</if>
            <if test="isinvretfreeofchk != null and isinvretfreeofchk != ''"> #{isinvretfreeofchk} ,</if>
            <if test="isinvretinstobychk != null and isinvretinstobychk != ''"> #{isinvretinstobychk} ,</if>
            <if test="isinvreturned != null and isinvreturned != ''"> #{isinvreturned} ,</if>
            <if test="isnoconallowed != null and isnoconallowed != ''"> #{isnoconallowed} ,</if>
            <if test="isprimarybarcode != null and isprimarybarcode != ''"> #{isprimarybarcode} ,</if>
            <if test="isrecurrentcheck != null and isrecurrentcheck != ''"> #{isrecurrentcheck} ,</if>
            <if test="issalable != null and issalable != ''"> #{issalable} ,</if>
            <if test="issecondarybarcode != null and issecondarybarcode != ''"> #{issecondarybarcode} ,</if>
            <if test="isselfapprsupplier != null and isselfapprsupplier != ''"> #{isselfapprsupplier} ,</if>
            <if test="isspecialty != null and isspecialty != ''"> #{isspecialty} ,</if>
            <if test="issupplierstock != null and issupplierstock != ''"> #{issupplierstock} ,</if>
            <if test="isused != null and isused != ''"> #{isused} ,</if>
            <if test="isvirtual != null and isvirtual != ''"> #{isvirtual} ,</if>
            <if test="keepwasterate != null and keepwasterate != ''"> #{keepwasterate} ,</if>
            <if test="lowestprice != null and lowestprice != ''"> #{lowestprice} ,</if>
            <if test="mantaxitem != null and mantaxitem != ''"> #{mantaxitem} ,</if>
            <if test="maxprice != null and maxprice != ''"> #{maxprice} ,</if>
            <if test="memo != null and memo != ''"> #{memo} ,</if>
            <if test="modifier != null and modifier != ''"> #{modifier} ,</if>
            <if test="modifytime != null and modifytime != ''"> #{modifytime} ,</if>
            <if test="negallowed != null and negallowed != ''"> #{negallowed} ,</if>
            <if test="outpriority != null"> #{outpriority} ,</if>
            <if test="outtrackin != null and outtrackin != ''"> #{outtrackin} ,</if>
            <if test="pebegin != null and pebegin != ''"> #{pebegin} ,</if>
            <if test="peend != null and peend != ''"> #{peend} ,</if>
            <if test="pkCorp != null and pkCorp != ''"> #{pkCorp} ,</if>
            <if test="pkCumandoc != null and pkCumandoc != ''"> #{pkCumandoc} ,</if>
            <if test="pkDftfactory != null and pkDftfactory != ''"> #{pkDftfactory} ,</if>
            <if test="pkInvbasdoc != null and pkInvbasdoc != ''"> #{pkInvbasdoc} ,</if>
            <if test="pkInvmandoc != null and pkInvmandoc != ''"> #{pkInvmandoc} ,</if>
            <if test="pkSealuser != null and pkSealuser != ''"> #{pkSealuser} ,</if>
            <if test="planprice != null and planprice != ''"> #{planprice} ,</if>
            <if test="prodarea != null and prodarea != ''"> #{prodarea} ,</if>
            <if test="purchasestge != null and purchasestge != ''"> #{purchasestge} ,</if>
            <if test="purwasterate != null and purwasterate != ''"> #{purwasterate} ,</if>
            <if test="qualitydaynum != null"> #{qualitydaynum} ,</if>
            <if test="qualitymanflag != null and qualitymanflag != ''"> #{qualitymanflag} ,</if>
            <if test="qualityperiodunit != null"> #{qualityperiodunit} ,</if>
            <if test="recurrentchkcyc != null"> #{recurrentchkcyc} ,</if>
            <if test="refsaleprice != null and refsaleprice != ''"> #{refsaleprice} ,</if>
            <if test="sealdate != null and sealdate != ''"> #{sealdate} ,</if>
            <if test="sealflag != null and sealflag != ''"> #{sealflag} ,</if>
            <if test="sellproxyflag != null and sellproxyflag != ''"> #{sellproxyflag} ,</if>
            <if test="serialmanaflag != null and serialmanaflag != ''"> #{serialmanaflag} ,</if>
            <if test="ts != null and ts != ''"> #{ts} ,</if>
            <if test="wholemanaflag != null and wholemanaflag != ''"> #{wholemanaflag} ,</if>
            <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from bd_invmandoc a WHERE a.sts = 'Y' ),</if>
    <if test="sts == null ">'Y',</if>
  </trim>
  )  
</insert>
<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="pkInvmandoc" useGeneratedKeys="true">
  insert into bd_invmandoc(abctype, accflag, cinvmnecode, consumesettleflag, coopdayfrom, coopdayto, costprice, createtime, creator, def1, def10, def11, def12, def13, def14, def15, def16, def17, def18, def19, def2, def20, def3, def4, def5, def6, def7, def8, def9, dr, expaybacktax, free1, free2, free3, free4, free5, grade, invlifeperiod, isappendant, isautoatpcheck, iscancalculatedinvcost, iscanpurchased, iscansaleinvoice, iscansold, isconfigable, isctlprodplanprice, isfatherofbom, isinvretfreeofchk, isinvretinstobychk, isinvreturned, isnoconallowed, isprimarybarcode, isrecurrentcheck, issalable, issecondarybarcode, isselfapprsupplier, isspecialty, issupplierstock, isused, isvirtual, keepwasterate, lowestprice, mantaxitem, maxprice, memo, modifier, modifytime, negallowed, outpriority, outtrackin, pebegin, peend, pk_corp, pk_cumandoc, pk_dftfactory, pk_invbasdoc, pk_sealuser, planprice, prodarea, purchasestge, purwasterate, qualitydaynum, qualitymanflag, qualityperiodunit, recurrentchkcyc, refsaleprice, sealdate, sealflag, sellproxyflag, serialmanaflag, ts, wholemanaflag,  sts) 
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.abctype},#{entity.accflag},#{entity.cinvmnecode},#{entity.consumesettleflag},#{entity.coopdayfrom},#{entity.coopdayto},#{entity.costprice},#{entity.createtime},#{entity.creator},#{entity.def1},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def13},#{entity.def14},#{entity.def15},#{entity.def16},#{entity.def17},#{entity.def18},#{entity.def19},#{entity.def2},#{entity.def20},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.dr},#{entity.expaybacktax},#{entity.free1},#{entity.free2},#{entity.free3},#{entity.free4},#{entity.free5},#{entity.grade},#{entity.invlifeperiod},#{entity.isappendant},#{entity.isautoatpcheck},#{entity.iscancalculatedinvcost},#{entity.iscanpurchased},#{entity.iscansaleinvoice},#{entity.iscansold},#{entity.isconfigable},#{entity.isctlprodplanprice},#{entity.isfatherofbom},#{entity.isinvretfreeofchk},#{entity.isinvretinstobychk},#{entity.isinvreturned},#{entity.isnoconallowed},#{entity.isprimarybarcode},#{entity.isrecurrentcheck},#{entity.issalable},#{entity.issecondarybarcode},#{entity.isselfapprsupplier},#{entity.isspecialty},#{entity.issupplierstock},#{entity.isused},#{entity.isvirtual},#{entity.keepwasterate},#{entity.lowestprice},#{entity.mantaxitem},#{entity.maxprice},#{entity.memo},#{entity.modifier},#{entity.modifytime},#{entity.negallowed},#{entity.outpriority},#{entity.outtrackin},#{entity.pebegin},#{entity.peend},#{entity.pkCorp},#{entity.pkCumandoc},#{entity.pkDftfactory},#{entity.pkInvbasdoc},#{entity.pkSealuser},#{entity.planprice},#{entity.prodarea},#{entity.purchasestge},#{entity.purwasterate},#{entity.qualitydaynum},#{entity.qualitymanflag},#{entity.qualityperiodunit},#{entity.recurrentchkcyc},#{entity.refsaleprice},#{entity.sealdate},#{entity.sealflag},#{entity.sellproxyflag},#{entity.serialmanaflag},#{entity.ts},#{entity.wholemanaflag}, 'Y')
    </foreach>
</insert>
<!-- 批量新增或者修改-->
<insert id="entityInsertOrUpdateBatch" keyProperty="pkInvmandoc" useGeneratedKeys="true">
    insert into bd_invmandoc(abctype, accflag, cinvmnecode, consumesettleflag, coopdayfrom, coopdayto, costprice, createtime, creator, def1, def10, def11, def12, def13, def14, def15, def16, def17, def18, def19, def2, def20, def3, def4, def5, def6, def7, def8, def9, dr, expaybacktax, free1, free2, free3, free4, free5, grade, invlifeperiod, isappendant, isautoatpcheck, iscancalculatedinvcost, iscanpurchased, iscansaleinvoice, iscansold, isconfigable, isctlprodplanprice, isfatherofbom, isinvretfreeofchk, isinvretinstobychk, isinvreturned, isnoconallowed, isprimarybarcode, isrecurrentcheck, issalable, issecondarybarcode, isselfapprsupplier, isspecialty, issupplierstock, isused, isvirtual, keepwasterate, lowestprice, mantaxitem, maxprice, memo, modifier, modifytime, negallowed, outpriority, outtrackin, pebegin, peend, pk_corp, pk_cumandoc, pk_dftfactory, pk_invbasdoc, pk_sealuser, planprice, prodarea, purchasestge, purwasterate, qualitydaynum, qualitymanflag, qualityperiodunit, recurrentchkcyc, refsaleprice, sealdate, sealflag, sellproxyflag, serialmanaflag, ts, wholemanaflag)
    values
    <foreach collection="entities" item="entity" separator=",">
    (#{entity.abctype},#{entity.accflag},#{entity.cinvmnecode},#{entity.consumesettleflag},#{entity.coopdayfrom},#{entity.coopdayto},#{entity.costprice},#{entity.createtime},#{entity.creator},#{entity.def1},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def13},#{entity.def14},#{entity.def15},#{entity.def16},#{entity.def17},#{entity.def18},#{entity.def19},#{entity.def2},#{entity.def20},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.dr},#{entity.expaybacktax},#{entity.free1},#{entity.free2},#{entity.free3},#{entity.free4},#{entity.free5},#{entity.grade},#{entity.invlifeperiod},#{entity.isappendant},#{entity.isautoatpcheck},#{entity.iscancalculatedinvcost},#{entity.iscanpurchased},#{entity.iscansaleinvoice},#{entity.iscansold},#{entity.isconfigable},#{entity.isctlprodplanprice},#{entity.isfatherofbom},#{entity.isinvretfreeofchk},#{entity.isinvretinstobychk},#{entity.isinvreturned},#{entity.isnoconallowed},#{entity.isprimarybarcode},#{entity.isrecurrentcheck},#{entity.issalable},#{entity.issecondarybarcode},#{entity.isselfapprsupplier},#{entity.isspecialty},#{entity.issupplierstock},#{entity.isused},#{entity.isvirtual},#{entity.keepwasterate},#{entity.lowestprice},#{entity.mantaxitem},#{entity.maxprice},#{entity.memo},#{entity.modifier},#{entity.modifytime},#{entity.negallowed},#{entity.outpriority},#{entity.outtrackin},#{entity.pebegin},#{entity.peend},#{entity.pkCorp},#{entity.pkCumandoc},#{entity.pkDftfactory},#{entity.pkInvbasdoc},#{entity.pkSealuser},#{entity.planprice},#{entity.prodarea},#{entity.purchasestge},#{entity.purwasterate},#{entity.qualitydaynum},#{entity.qualitymanflag},#{entity.qualityperiodunit},#{entity.recurrentchkcyc},#{entity.refsaleprice},#{entity.sealdate},#{entity.sealflag},#{entity.sellproxyflag},#{entity.serialmanaflag},#{entity.ts},#{entity.wholemanaflag})
    </foreach>
    on duplicate key update
    abctype = values(abctype),
    accflag = values(accflag),
    cinvmnecode = values(cinvmnecode),
    consumesettleflag = values(consumesettleflag),
    coopdayfrom = values(coopdayfrom),
    coopdayto = values(coopdayto),
    costprice = values(costprice),
    createtime = values(createtime),
    creator = values(creator),
    def1 = values(def1),
    def10 = values(def10),
    def11 = values(def11),
    def12 = values(def12),
    def13 = values(def13),
    def14 = values(def14),
    def15 = values(def15),
    def16 = values(def16),
    def17 = values(def17),
    def18 = values(def18),
    def19 = values(def19),
    def2 = values(def2),
    def20 = values(def20),
    def3 = values(def3),
    def4 = values(def4),
    def5 = values(def5),
    def6 = values(def6),
    def7 = values(def7),
    def8 = values(def8),
    def9 = values(def9),
    dr = values(dr),
    expaybacktax = values(expaybacktax),
    free1 = values(free1),
    free2 = values(free2),
    free3 = values(free3),
    free4 = values(free4),
    free5 = values(free5),
    grade = values(grade),
    invlifeperiod = values(invlifeperiod),
    isappendant = values(isappendant),
    isautoatpcheck = values(isautoatpcheck),
    iscancalculatedinvcost = values(iscancalculatedinvcost),
    iscanpurchased = values(iscanpurchased),
    iscansaleinvoice = values(iscansaleinvoice),
    iscansold = values(iscansold),
    isconfigable = values(isconfigable),
    isctlprodplanprice = values(isctlprodplanprice),
    isfatherofbom = values(isfatherofbom),
    isinvretfreeofchk = values(isinvretfreeofchk),
    isinvretinstobychk = values(isinvretinstobychk),
    isinvreturned = values(isinvreturned),
    isnoconallowed = values(isnoconallowed),
    isprimarybarcode = values(isprimarybarcode),
    isrecurrentcheck = values(isrecurrentcheck),
    issalable = values(issalable),
    issecondarybarcode = values(issecondarybarcode),
    isselfapprsupplier = values(isselfapprsupplier),
    isspecialty = values(isspecialty),
    issupplierstock = values(issupplierstock),
    isused = values(isused),
    isvirtual = values(isvirtual),
    keepwasterate = values(keepwasterate),
    lowestprice = values(lowestprice),
    mantaxitem = values(mantaxitem),
    maxprice = values(maxprice),
    memo = values(memo),
    modifier = values(modifier),
    modifytime = values(modifytime),
    negallowed = values(negallowed),
    outpriority = values(outpriority),
    outtrackin = values(outtrackin),
    pebegin = values(pebegin),
    peend = values(peend),
    pk_corp = values(pk_corp),
    pk_cumandoc = values(pk_cumandoc),
    pk_dftfactory = values(pk_dftfactory),
    pk_invbasdoc = values(pk_invbasdoc),
    pk_sealuser = values(pk_sealuser),
    planprice = values(planprice),
    prodarea = values(prodarea),
    purchasestge = values(purchasestge),
    purwasterate = values(purwasterate),
    qualitydaynum = values(qualitydaynum),
    qualitymanflag = values(qualitymanflag),
    qualityperiodunit = values(qualityperiodunit),
    recurrentchkcyc = values(recurrentchkcyc),
    refsaleprice = values(refsaleprice),
    sealdate = values(sealdate),
    sealflag = values(sealflag),
    sellproxyflag = values(sellproxyflag),
    serialmanaflag = values(serialmanaflag),
    ts = values(ts),
    wholemanaflag = values(wholemanaflag)</insert>
<!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.entity.BdInvmandocEntity" >
update bd_invmandoc  set
<trim suffix="" suffixOverrides=",">
  <if test="abctype != null and abctype != ''"> abctype = #{abctype},</if>
  <if test="accflag != null and accflag != ''"> accflag = #{accflag},</if>
  <if test="cinvmnecode != null and cinvmnecode != ''"> cinvmnecode = #{cinvmnecode},</if>
  <if test="consumesettleflag != null and consumesettleflag != ''"> consumesettleflag = #{consumesettleflag},</if>
  <if test="coopdayfrom != null and coopdayfrom != ''"> coopdayfrom = #{coopdayfrom},</if>
  <if test="coopdayto != null and coopdayto != ''"> coopdayto = #{coopdayto},</if>
  <if test="costprice != null and costprice != ''"> costprice = #{costprice},</if>
  <if test="createtime != null and createtime != ''"> createtime = #{createtime},</if>
  <if test="creator != null and creator != ''"> creator = #{creator},</if>
  <if test="def1 != null and def1 != ''"> def1 = #{def1},</if>
  <if test="def10 != null and def10 != ''"> def10 = #{def10},</if>
  <if test="def11 != null and def11 != ''"> def11 = #{def11},</if>
  <if test="def12 != null and def12 != ''"> def12 = #{def12},</if>
  <if test="def13 != null and def13 != ''"> def13 = #{def13},</if>
  <if test="def14 != null and def14 != ''"> def14 = #{def14},</if>
  <if test="def15 != null and def15 != ''"> def15 = #{def15},</if>
  <if test="def16 != null and def16 != ''"> def16 = #{def16},</if>
  <if test="def17 != null and def17 != ''"> def17 = #{def17},</if>
  <if test="def18 != null and def18 != ''"> def18 = #{def18},</if>
  <if test="def19 != null and def19 != ''"> def19 = #{def19},</if>
  <if test="def2 != null and def2 != ''"> def2 = #{def2},</if>
  <if test="def20 != null and def20 != ''"> def20 = #{def20},</if>
  <if test="def3 != null and def3 != ''"> def3 = #{def3},</if>
  <if test="def4 != null and def4 != ''"> def4 = #{def4},</if>
  <if test="def5 != null and def5 != ''"> def5 = #{def5},</if>
  <if test="def6 != null and def6 != ''"> def6 = #{def6},</if>
  <if test="def7 != null and def7 != ''"> def7 = #{def7},</if>
  <if test="def8 != null and def8 != ''"> def8 = #{def8},</if>
  <if test="def9 != null and def9 != ''"> def9 = #{def9},</if>
  <if test="dr != null"> dr = #{dr},</if>
  <if test="expaybacktax != null and expaybacktax != ''"> expaybacktax = #{expaybacktax},</if>
  <if test="free1 != null and free1 != ''"> free1 = #{free1},</if>
  <if test="free2 != null and free2 != ''"> free2 = #{free2},</if>
  <if test="free3 != null and free3 != ''"> free3 = #{free3},</if>
  <if test="free4 != null and free4 != ''"> free4 = #{free4},</if>
  <if test="free5 != null and free5 != ''"> free5 = #{free5},</if>
  <if test="grade != null and grade != ''"> grade = #{grade},</if>
  <if test="invlifeperiod != null"> invlifeperiod = #{invlifeperiod},</if>
  <if test="isappendant != null and isappendant != ''"> isappendant = #{isappendant},</if>
  <if test="isautoatpcheck != null and isautoatpcheck != ''"> isautoatpcheck = #{isautoatpcheck},</if>
  <if test="iscancalculatedinvcost != null and iscancalculatedinvcost != ''"> iscancalculatedinvcost = #{iscancalculatedinvcost},</if>
  <if test="iscanpurchased != null and iscanpurchased != ''"> iscanpurchased = #{iscanpurchased},</if>
  <if test="iscansaleinvoice != null and iscansaleinvoice != ''"> iscansaleinvoice = #{iscansaleinvoice},</if>
  <if test="iscansold != null and iscansold != ''"> iscansold = #{iscansold},</if>
  <if test="isconfigable != null and isconfigable != ''"> isconfigable = #{isconfigable},</if>
  <if test="isctlprodplanprice != null and isctlprodplanprice != ''"> isctlprodplanprice = #{isctlprodplanprice},</if>
  <if test="isfatherofbom != null and isfatherofbom != ''"> isfatherofbom = #{isfatherofbom},</if>
  <if test="isinvretfreeofchk != null and isinvretfreeofchk != ''"> isinvretfreeofchk = #{isinvretfreeofchk},</if>
  <if test="isinvretinstobychk != null and isinvretinstobychk != ''"> isinvretinstobychk = #{isinvretinstobychk},</if>
  <if test="isinvreturned != null and isinvreturned != ''"> isinvreturned = #{isinvreturned},</if>
  <if test="isnoconallowed != null and isnoconallowed != ''"> isnoconallowed = #{isnoconallowed},</if>
  <if test="isprimarybarcode != null and isprimarybarcode != ''"> isprimarybarcode = #{isprimarybarcode},</if>
  <if test="isrecurrentcheck != null and isrecurrentcheck != ''"> isrecurrentcheck = #{isrecurrentcheck},</if>
  <if test="issalable != null and issalable != ''"> issalable = #{issalable},</if>
  <if test="issecondarybarcode != null and issecondarybarcode != ''"> issecondarybarcode = #{issecondarybarcode},</if>
  <if test="isselfapprsupplier != null and isselfapprsupplier != ''"> isselfapprsupplier = #{isselfapprsupplier},</if>
  <if test="isspecialty != null and isspecialty != ''"> isspecialty = #{isspecialty},</if>
  <if test="issupplierstock != null and issupplierstock != ''"> issupplierstock = #{issupplierstock},</if>
  <if test="isused != null and isused != ''"> isused = #{isused},</if>
  <if test="isvirtual != null and isvirtual != ''"> isvirtual = #{isvirtual},</if>
  <if test="keepwasterate != null and keepwasterate != ''"> keepwasterate = #{keepwasterate},</if>
  <if test="lowestprice != null and lowestprice != ''"> lowestprice = #{lowestprice},</if>
  <if test="mantaxitem != null and mantaxitem != ''"> mantaxitem = #{mantaxitem},</if>
  <if test="maxprice != null and maxprice != ''"> maxprice = #{maxprice},</if>
  <if test="memo != null and memo != ''"> memo = #{memo},</if>
  <if test="modifier != null and modifier != ''"> modifier = #{modifier},</if>
  <if test="modifytime != null and modifytime != ''"> modifytime = #{modifytime},</if>
  <if test="negallowed != null and negallowed != ''"> negallowed = #{negallowed},</if>
  <if test="outpriority != null"> outpriority = #{outpriority},</if>
  <if test="outtrackin != null and outtrackin != ''"> outtrackin = #{outtrackin},</if>
  <if test="pebegin != null and pebegin != ''"> pebegin = #{pebegin},</if>
  <if test="peend != null and peend != ''"> peend = #{peend},</if>
  <if test="pkCorp != null and pkCorp != ''"> pk_corp = #{pkCorp},</if>
  <if test="pkCumandoc != null and pkCumandoc != ''"> pk_cumandoc = #{pkCumandoc},</if>
  <if test="pkDftfactory != null and pkDftfactory != ''"> pk_dftfactory = #{pkDftfactory},</if>
  <if test="pkInvbasdoc != null and pkInvbasdoc != ''"> pk_invbasdoc = #{pkInvbasdoc},</if>
  <if test="pkSealuser != null and pkSealuser != ''"> pk_sealuser = #{pkSealuser},</if>
  <if test="planprice != null and planprice != ''"> planprice = #{planprice},</if>
  <if test="prodarea != null and prodarea != ''"> prodarea = #{prodarea},</if>
  <if test="purchasestge != null and purchasestge != ''"> purchasestge = #{purchasestge},</if>
  <if test="purwasterate != null and purwasterate != ''"> purwasterate = #{purwasterate},</if>
  <if test="qualitydaynum != null"> qualitydaynum = #{qualitydaynum},</if>
  <if test="qualitymanflag != null and qualitymanflag != ''"> qualitymanflag = #{qualitymanflag},</if>
  <if test="qualityperiodunit != null"> qualityperiodunit = #{qualityperiodunit},</if>
  <if test="recurrentchkcyc != null"> recurrentchkcyc = #{recurrentchkcyc},</if>
  <if test="refsaleprice != null and refsaleprice != ''"> refsaleprice = #{refsaleprice},</if>
  <if test="sealdate != null and sealdate != ''"> sealdate = #{sealdate},</if>
  <if test="sealflag != null and sealflag != ''"> sealflag = #{sealflag},</if>
  <if test="sellproxyflag != null and sellproxyflag != ''"> sellproxyflag = #{sellproxyflag},</if>
  <if test="serialmanaflag != null and serialmanaflag != ''"> serialmanaflag = #{serialmanaflag},</if>
  <if test="ts != null and ts != ''"> ts = #{ts},</if>
  <if test="wholemanaflag != null and wholemanaflag != ''"> wholemanaflag = #{wholemanaflag},</if>
</trim>
where pk_invmandoc = #{pkInvmandoc}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.entity.BdInvmandocEntity" >
update bd_invmandoc  set sts= 'N'
where pk_invmandoc = #{pkInvmandoc}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.entity.BdInvmandocEntity" >
update bd_invmandoc  set sts= 'N' 
 <trim prefix="where" prefixOverrides="and"> 
        <if test="abctype != null and abctype != ''"> and abctype = #{abctype} </if>
            <if test="accflag != null and accflag != ''"> and accflag = #{accflag} </if>
            <if test="cinvmnecode != null and cinvmnecode != ''"> and cinvmnecode = #{cinvmnecode} </if>
            <if test="consumesettleflag != null and consumesettleflag != ''"> and consumesettleflag = #{consumesettleflag} </if>
            <if test="coopdayfrom != null and coopdayfrom != ''"> and coopdayfrom = #{coopdayfrom} </if>
            <if test="coopdayto != null and coopdayto != ''"> and coopdayto = #{coopdayto} </if>
            <if test="costprice != null and costprice != ''"> and costprice = #{costprice} </if>
            <if test="createtime != null and createtime != ''"> and createtime = #{createtime} </if>
            <if test="creator != null and creator != ''"> and creator = #{creator} </if>
            <if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
            <if test="def10 != null and def10 != ''"> and def10 = #{def10} </if>
            <if test="def11 != null and def11 != ''"> and def11 = #{def11} </if>
            <if test="def12 != null and def12 != ''"> and def12 = #{def12} </if>
            <if test="def13 != null and def13 != ''"> and def13 = #{def13} </if>
            <if test="def14 != null and def14 != ''"> and def14 = #{def14} </if>
            <if test="def15 != null and def15 != ''"> and def15 = #{def15} </if>
            <if test="def16 != null and def16 != ''"> and def16 = #{def16} </if>
            <if test="def17 != null and def17 != ''"> and def17 = #{def17} </if>
            <if test="def18 != null and def18 != ''"> and def18 = #{def18} </if>
            <if test="def19 != null and def19 != ''"> and def19 = #{def19} </if>
            <if test="def2 != null and def2 != ''"> and def2 = #{def2} </if>
            <if test="def20 != null and def20 != ''"> and def20 = #{def20} </if>
            <if test="def3 != null and def3 != ''"> and def3 = #{def3} </if>
            <if test="def4 != null and def4 != ''"> and def4 = #{def4} </if>
            <if test="def5 != null and def5 != ''"> and def5 = #{def5} </if>
            <if test="def6 != null and def6 != ''"> and def6 = #{def6} </if>
            <if test="def7 != null and def7 != ''"> and def7 = #{def7} </if>
            <if test="def8 != null and def8 != ''"> and def8 = #{def8} </if>
            <if test="def9 != null and def9 != ''"> and def9 = #{def9} </if>
            <if test="dr != null"> and dr = #{dr} </if>
            <if test="expaybacktax != null and expaybacktax != ''"> and expaybacktax = #{expaybacktax} </if>
            <if test="free1 != null and free1 != ''"> and free1 = #{free1} </if>
            <if test="free2 != null and free2 != ''"> and free2 = #{free2} </if>
            <if test="free3 != null and free3 != ''"> and free3 = #{free3} </if>
            <if test="free4 != null and free4 != ''"> and free4 = #{free4} </if>
            <if test="free5 != null and free5 != ''"> and free5 = #{free5} </if>
            <if test="grade != null and grade != ''"> and grade = #{grade} </if>
            <if test="invlifeperiod != null"> and invlifeperiod = #{invlifeperiod} </if>
            <if test="isappendant != null and isappendant != ''"> and isappendant = #{isappendant} </if>
            <if test="isautoatpcheck != null and isautoatpcheck != ''"> and isautoatpcheck = #{isautoatpcheck} </if>
            <if test="iscancalculatedinvcost != null and iscancalculatedinvcost != ''"> and iscancalculatedinvcost = #{iscancalculatedinvcost} </if>
            <if test="iscanpurchased != null and iscanpurchased != ''"> and iscanpurchased = #{iscanpurchased} </if>
            <if test="iscansaleinvoice != null and iscansaleinvoice != ''"> and iscansaleinvoice = #{iscansaleinvoice} </if>
            <if test="iscansold != null and iscansold != ''"> and iscansold = #{iscansold} </if>
            <if test="isconfigable != null and isconfigable != ''"> and isconfigable = #{isconfigable} </if>
            <if test="isctlprodplanprice != null and isctlprodplanprice != ''"> and isctlprodplanprice = #{isctlprodplanprice} </if>
            <if test="isfatherofbom != null and isfatherofbom != ''"> and isfatherofbom = #{isfatherofbom} </if>
            <if test="isinvretfreeofchk != null and isinvretfreeofchk != ''"> and isinvretfreeofchk = #{isinvretfreeofchk} </if>
            <if test="isinvretinstobychk != null and isinvretinstobychk != ''"> and isinvretinstobychk = #{isinvretinstobychk} </if>
            <if test="isinvreturned != null and isinvreturned != ''"> and isinvreturned = #{isinvreturned} </if>
            <if test="isnoconallowed != null and isnoconallowed != ''"> and isnoconallowed = #{isnoconallowed} </if>
            <if test="isprimarybarcode != null and isprimarybarcode != ''"> and isprimarybarcode = #{isprimarybarcode} </if>
            <if test="isrecurrentcheck != null and isrecurrentcheck != ''"> and isrecurrentcheck = #{isrecurrentcheck} </if>
            <if test="issalable != null and issalable != ''"> and issalable = #{issalable} </if>
            <if test="issecondarybarcode != null and issecondarybarcode != ''"> and issecondarybarcode = #{issecondarybarcode} </if>
            <if test="isselfapprsupplier != null and isselfapprsupplier != ''"> and isselfapprsupplier = #{isselfapprsupplier} </if>
            <if test="isspecialty != null and isspecialty != ''"> and isspecialty = #{isspecialty} </if>
            <if test="issupplierstock != null and issupplierstock != ''"> and issupplierstock = #{issupplierstock} </if>
            <if test="isused != null and isused != ''"> and isused = #{isused} </if>
            <if test="isvirtual != null and isvirtual != ''"> and isvirtual = #{isvirtual} </if>
            <if test="keepwasterate != null and keepwasterate != ''"> and keepwasterate = #{keepwasterate} </if>
            <if test="lowestprice != null and lowestprice != ''"> and lowestprice = #{lowestprice} </if>
            <if test="mantaxitem != null and mantaxitem != ''"> and mantaxitem = #{mantaxitem} </if>
            <if test="maxprice != null and maxprice != ''"> and maxprice = #{maxprice} </if>
            <if test="memo != null and memo != ''"> and memo = #{memo} </if>
            <if test="modifier != null and modifier != ''"> and modifier = #{modifier} </if>
            <if test="modifytime != null and modifytime != ''"> and modifytime = #{modifytime} </if>
            <if test="negallowed != null and negallowed != ''"> and negallowed = #{negallowed} </if>
            <if test="outpriority != null"> and outpriority = #{outpriority} </if>
            <if test="outtrackin != null and outtrackin != ''"> and outtrackin = #{outtrackin} </if>
            <if test="pebegin != null and pebegin != ''"> and pebegin = #{pebegin} </if>
            <if test="peend != null and peend != ''"> and peend = #{peend} </if>
            <if test="pkCorp != null and pkCorp != ''"> and pk_corp = #{pkCorp} </if>
            <if test="pkCumandoc != null and pkCumandoc != ''"> and pk_cumandoc = #{pkCumandoc} </if>
            <if test="pkDftfactory != null and pkDftfactory != ''"> and pk_dftfactory = #{pkDftfactory} </if>
            <if test="pkInvbasdoc != null and pkInvbasdoc != ''"> and pk_invbasdoc = #{pkInvbasdoc} </if>
            <if test="pkInvmandoc != null and pkInvmandoc != ''"> and pk_invmandoc = #{pkInvmandoc} </if>
            <if test="pkSealuser != null and pkSealuser != ''"> and pk_sealuser = #{pkSealuser} </if>
            <if test="planprice != null and planprice != ''"> and planprice = #{planprice} </if>
            <if test="prodarea != null and prodarea != ''"> and prodarea = #{prodarea} </if>
            <if test="purchasestge != null and purchasestge != ''"> and purchasestge = #{purchasestge} </if>
            <if test="purwasterate != null and purwasterate != ''"> and purwasterate = #{purwasterate} </if>
            <if test="qualitydaynum != null"> and qualitydaynum = #{qualitydaynum} </if>
            <if test="qualitymanflag != null and qualitymanflag != ''"> and qualitymanflag = #{qualitymanflag} </if>
            <if test="qualityperiodunit != null"> and qualityperiodunit = #{qualityperiodunit} </if>
            <if test="recurrentchkcyc != null"> and recurrentchkcyc = #{recurrentchkcyc} </if>
            <if test="refsaleprice != null and refsaleprice != ''"> and refsaleprice = #{refsaleprice} </if>
            <if test="sealdate != null and sealdate != ''"> and sealdate = #{sealdate} </if>
            <if test="sealflag != null and sealflag != ''"> and sealflag = #{sealflag} </if>
            <if test="sellproxyflag != null and sellproxyflag != ''"> and sellproxyflag = #{sellproxyflag} </if>
            <if test="serialmanaflag != null and serialmanaflag != ''"> and serialmanaflag = #{serialmanaflag} </if>
            <if test="ts != null and ts != ''"> and ts = #{ts} </if>
            <if test="wholemanaflag != null and wholemanaflag != ''"> and wholemanaflag = #{wholemanaflag} </if>
            and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from bd_invmandoc where pk_invmandoc = #{pkInvmandoc}
</delete>


<select id="queryBdInvmandocByInvcode" parameterType="com.hzya.frame.plugin.lets.entity.BdInvmandocEntity" resultMap="get-BdInvmandocEntity-result">
    select
    bd_invmandoc.abctype
    ,bd_invmandoc.accflag
    ,bd_invmandoc.cinvmnecode
    ,bd_invmandoc.consumesettleflag
    ,bd_invmandoc.coopdayfrom
    ,bd_invmandoc.coopdayto
    ,bd_invmandoc.costprice
    ,bd_invmandoc.createtime
    ,bd_invmandoc.creator
    ,bd_invmandoc.def1
    ,bd_invmandoc.def10
    ,bd_invmandoc.def11
    ,bd_invmandoc.def12
    ,bd_invmandoc.def13
    ,bd_invmandoc.def14
    ,bd_invmandoc.def15
    ,bd_invmandoc.def16
    ,bd_invmandoc.def17
    ,bd_invmandoc.def18
    ,bd_invmandoc.def19
    ,bd_invmandoc.def2
    ,bd_invmandoc.def20
    ,bd_invmandoc.def3
    ,bd_invmandoc.def4
    ,bd_invmandoc.def5
    ,bd_invmandoc.def6
    ,bd_invmandoc.def7
    ,bd_invmandoc.def8
    ,bd_invmandoc.def9
    ,bd_invmandoc.dr
    ,bd_invmandoc.expaybacktax
    ,bd_invmandoc.free1
    ,bd_invmandoc.free2
    ,bd_invmandoc.free3
    ,bd_invmandoc.free4
    ,bd_invmandoc.free5
    ,bd_invmandoc.grade
    ,bd_invmandoc.invlifeperiod
    ,bd_invmandoc.isappendant
    ,bd_invmandoc.isautoatpcheck
    ,bd_invmandoc.iscancalculatedinvcost
    ,bd_invmandoc.iscanpurchased
    ,bd_invmandoc.iscansaleinvoice
    ,bd_invmandoc.iscansold
    ,bd_invmandoc.isconfigable
    ,bd_invmandoc.isctlprodplanprice
    ,bd_invmandoc.isfatherofbom
    ,bd_invmandoc.isinvretfreeofchk
    ,bd_invmandoc.isinvretinstobychk
    ,bd_invmandoc.isinvreturned
    ,bd_invmandoc.isnoconallowed
    ,bd_invmandoc.isprimarybarcode
    ,bd_invmandoc.isrecurrentcheck
    ,bd_invmandoc.issalable
    ,bd_invmandoc.issecondarybarcode
    ,bd_invmandoc.isselfapprsupplier
    ,bd_invmandoc.isspecialty
    ,bd_invmandoc.issupplierstock
    ,bd_invmandoc.isused
    ,bd_invmandoc.isvirtual
    ,bd_invmandoc.keepwasterate
    ,bd_invmandoc.lowestprice
    ,bd_invmandoc.mantaxitem
    ,bd_invmandoc.maxprice
    ,bd_invmandoc.memo
    ,bd_invmandoc.modifier
    ,bd_invmandoc.modifytime
    ,bd_invmandoc.negallowed
    ,bd_invmandoc.outpriority
    ,bd_invmandoc.outtrackin
    ,bd_invmandoc.pebegin
    ,bd_invmandoc.peend
    ,bd_invmandoc.pk_corp
    ,bd_invmandoc.pk_cumandoc
    ,bd_invmandoc.pk_dftfactory
    ,bd_invmandoc.pk_invbasdoc
    ,bd_invmandoc.pk_invmandoc
    ,bd_invmandoc.pk_sealuser
    ,bd_invmandoc.planprice
    ,bd_invmandoc.prodarea
    ,bd_invmandoc.purchasestge
    ,bd_invmandoc.purwasterate
    ,bd_invmandoc.qualitydaynum
    ,bd_invmandoc.qualitymanflag
    ,bd_invmandoc.qualityperiodunit
    ,bd_invmandoc.recurrentchkcyc
    ,bd_invmandoc.refsaleprice
    ,bd_invmandoc.sealdate
    ,bd_invmandoc.sealflag
    ,bd_invmandoc.sellproxyflag
    ,bd_invmandoc.serialmanaflag
    ,bd_invmandoc.ts
    ,bd_invmandoc.wholemanaflag
    ,bd_invbasdoc.invcode
    from bd_invmandoc left join bd_invbasdoc on bd_invbasdoc.pk_invbasdoc = bd_invmandoc.pk_invbasdoc
    where bd_invmandoc.pk_invbasdoc in (
        select pk_invbasdoc from bd_invbasdoc bib
        where bib.dr = 0
        <if test="invcode!=null and invcode!=''">
            and bib.invcode = #{invcode}
        </if>
        <if test="invcodes!=null and invcodes!=''">
            and bib.invcode in (${invcodes})
        </if>
        <if test="invmnecode!=null and invmnecode!=''">
            and bib.invmnecode = #{invmnecode}
        </if>
    ) and bd_invmandoc.dr = 0
    <if test="pkCorp!=null and pkCorp!=''">
        and bd_invmandoc.pk_corp = #{pkCorp}
    </if>
</select>

</mapper>

