<?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.ofs.dao.impl.TocofsReturngoodsDetailedDaoImpl">

    <resultMap id="get-TocofsReturngoodsDetailedEntity-result" type="com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity" >
       <result property="id" column="id" jdbcType="VARCHAR"/>
           <result property="receiptid" column="receiptId" jdbcType="VARCHAR"/>
           <result property="receiptcode" column="receiptCode" jdbcType="VARCHAR"/>
           <result property="reforderid" column="refOrderId" jdbcType="VARCHAR"/>
           <result property="reforderdetailid" column="refOrderDetailId" jdbcType="VARCHAR"/>
           <result property="sourceordercode" column="sourceOrderCode" jdbcType="VARCHAR"/>
           <result property="sourcelinenum" column="sourceLineNum" jdbcType="VARCHAR"/>
           <result property="clientcode" column="clientCode" jdbcType="VARCHAR"/>
           <result property="companycode" column="companyCode" jdbcType="VARCHAR"/>
           <result property="facilitycode" column="facilityCode" jdbcType="VARCHAR"/>
           <result property="skucode" column="skuCode" jdbcType="VARCHAR"/>
           <result property="skuname" column="skuName" jdbcType="VARCHAR"/>
           <result property="requestqty" column="requestQty" jdbcType="VARCHAR"/>
           <result property="receivedqty" column="receivedQty" jdbcType="VARCHAR"/>
           <result property="openqty" column="openQty" jdbcType="VARCHAR"/>
           <result property="quantityum" column="quantityUM" jdbcType="VARCHAR"/>
           <result property="totalweight" column="totalWeight" jdbcType="VARCHAR"/>
           <result property="totalvolume" column="totalVolume" jdbcType="VARCHAR"/>
           <result property="totalvolumeweight" column="totalVolumeWeight" jdbcType="VARCHAR"/>
           <result property="totalamount" column="totalAmount" jdbcType="VARCHAR"/>
           <result property="weightum" column="weightUM" jdbcType="VARCHAR"/>
           <result property="volumeum" column="volumeUM" jdbcType="VARCHAR"/>
           <result property="inventorysts" column="inventorySts" jdbcType="VARCHAR"/>
           <result property="intransinvid" column="inTransInvId" jdbcType="VARCHAR"/>
           <result property="closed" column="closed" jdbcType="VARCHAR"/>
           <result property="created" column="created" jdbcType="VARCHAR"/>
           <result property="createdby" column="createdBy" jdbcType="VARCHAR"/>
           <result property="lastupdated" column="lastUpdated" jdbcType="VARCHAR"/>
           <result property="lastupdatedby" column="lastUpdatedBy" jdbcType="VARCHAR"/>
           <result property="discountprice" column="discountPrice" jdbcType="VARCHAR"/>
           <result property="maintableid" column="mainTableId" jdbcType="VARCHAR"/>
           <result property="newtransmitinfo" column="newTransmitInfo" jdbcType="VARCHAR"/>
           <result property="newpushdate" column="newPushDate" jdbcType="VARCHAR"/>
           <result property="newstate" column="newState" jdbcType="VARCHAR"/>
           <result property="newsystemnumber" column="newSystemNumber" jdbcType="VARCHAR"/>
           <result property="newsystemprimary" column="newSystemPrimary" jdbcType="VARCHAR"/>
           <result property="newtransmitinfo2" column="newTransmitInfo2" jdbcType="VARCHAR"/>
           <result property="newpushdate2" column="newPushDate2" jdbcType="VARCHAR"/>
           <result property="newstate2" column="newState2" jdbcType="VARCHAR"/>
           <result property="newsystemnumber2" column="newSystemNumber2" jdbcType="VARCHAR"/>
           <result property="newsystemprimary2" column="newSystemPrimary2" jdbcType="VARCHAR"/>
           <result property="newtransmitinfo3" column="newTransmitInfo3" jdbcType="VARCHAR"/>
           <result property="newpushdate3" column="newPushDate3" jdbcType="VARCHAR"/>
           <result property="newstate3" column="newState3" jdbcType="VARCHAR"/>
           <result property="newsystemnumber3" column="newSystemNumber3" jdbcType="VARCHAR"/>
           <result property="newsystemprimary3" column="newSystemPrimary3" jdbcType="VARCHAR"/>
           <result property="newtransmitinfo4" column="newTransmitInfo4" jdbcType="VARCHAR"/>
           <result property="newpushdate4" column="newPushDate4" jdbcType="VARCHAR"/>
           <result property="newstate4" column="newState4" jdbcType="VARCHAR"/>
           <result property="newsystemnumber4" column="newSystemNumber4" jdbcType="VARCHAR"/>
           <result property="newsystemprimary4" column="newSystemPrimary4" jdbcType="VARCHAR"/>
           <result property="businessdate" column="businessDate" jdbcType="VARCHAR"/>
           <result property="refundedat" column="refundedAt" jdbcType="VARCHAR"/>
           <result property="businesstype" column="businessType" jdbcType="VARCHAR"/>
           <result property="def1" column="def1" jdbcType="VARCHAR"/>
           <result property="def2" column="def2" 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="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="def20" column="def20" jdbcType="VARCHAR"/>
           <result property="def21" column="def21" jdbcType="VARCHAR"/>
           <result property="def22" column="def22" jdbcType="VARCHAR"/>
           <result property="def23" column="def23" jdbcType="VARCHAR"/>
           <result property="def24" column="def24" jdbcType="VARCHAR"/>
           <result property="def25" column="def25" jdbcType="VARCHAR"/>
           <result property="def26" column="def26" jdbcType="VARCHAR"/>
           <result property="def27" column="def27" jdbcType="VARCHAR"/>
           <result property="def28" column="def28" jdbcType="VARCHAR"/>
           <result property="def29" column="def29" jdbcType="VARCHAR"/>
           <result property="def30" column="def30" jdbcType="VARCHAR"/>
           <result property="def31" column="def31" jdbcType="VARCHAR"/>
           <result property="def32" column="def32" jdbcType="VARCHAR"/>
           <result property="def33" column="def33" jdbcType="VARCHAR"/>
           <result property="def34" column="def34" jdbcType="VARCHAR"/>
           <result property="def35" column="def35" jdbcType="VARCHAR"/>
           <result property="def36" column="def36" jdbcType="VARCHAR"/>
           <result property="def37" column="def37" jdbcType="VARCHAR"/>
           <result property="def38" column="def38" jdbcType="VARCHAR"/>
           <result property="def39" column="def39" jdbcType="VARCHAR"/>
           <result property="def40" column="def40" jdbcType="VARCHAR"/>
        </resultMap>
    <!-- 查询的字段-->
    <sql id = "TocofsReturngoodsDetailedEntity_Base_Column_List">
        id
       ,receiptId 
        ,receiptCode 
        ,refOrderId 
        ,refOrderDetailId 
        ,sourceOrderCode 
        ,sourceLineNum 
        ,clientCode 
        ,companyCode 
        ,facilityCode 
        ,skuCode 
        ,skuName 
        ,requestQty 
        ,receivedQty 
        ,openQty 
        ,quantityUM 
        ,totalWeight 
        ,totalVolume 
        ,totalVolumeWeight 
        ,totalAmount 
        ,weightUM 
        ,volumeUM 
        ,inventorySts 
        ,inTransInvId 
        ,closed 
        ,created 
        ,createdBy 
        ,lastUpdated 
        ,lastUpdatedBy 
        ,discountPrice 
        ,mainTableId 
        ,newTransmitInfo 
        ,newPushDate 
        ,newState 
        ,newSystemNumber 
        ,newSystemPrimary 
        ,newTransmitInfo2 
        ,newPushDate2 
        ,newState2 
        ,newSystemNumber2 
        ,newSystemPrimary2 
        ,newTransmitInfo3 
        ,newPushDate3 
        ,newState3 
        ,newSystemNumber3 
        ,newSystemPrimary3 
        ,newTransmitInfo4 
        ,newPushDate4 
        ,newState4 
        ,newSystemNumber4 
        ,newSystemPrimary4 
        ,businessDate 
        ,refundedAt 
        ,businessType 
        ,def1 
        ,def2 
        ,def3 
        ,def4 
        ,def5 
        ,def6 
        ,def7 
        ,def8 
        ,def9 
        ,def10 
        ,def11 
        ,def12 
        ,def13 
        ,def14 
        ,def15 
        ,def16 
        ,def17 
        ,def18 
        ,def19 
        ,def20 
        ,def21 
        ,def22 
        ,def23 
        ,def24 
        ,def25 
        ,def26 
        ,def27 
        ,def28 
        ,def29 
        ,def30 
        ,def31 
        ,def32 
        ,def33 
        ,def34 
        ,def35 
        ,def36 
        ,def37 
        ,def38 
        ,def39 
        ,def40 
     </sql>

 <!-- 查询 采用==查询 -->
 <select id="entity_list_base" resultMap="get-TocofsReturngoodsDetailedEntity-result" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity">
    select
    <include refid="TocofsReturngoodsDetailedEntity_Base_Column_List" />
    from tocofs_returngoods_detailed
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null and id != ''"> and id = #{id} </if>
            <if test="receiptid != null and receiptid != ''"> and receiptId = #{receiptid} </if>
            <if test="receiptcode != null and receiptcode != ''"> and receiptCode = #{receiptcode} </if>
            <if test="reforderid != null and reforderid != ''"> and refOrderId = #{reforderid} </if>
            <if test="reforderdetailid != null and reforderdetailid != ''"> and refOrderDetailId = #{reforderdetailid} </if>
            <if test="sourceordercode != null and sourceordercode != ''"> and sourceOrderCode = #{sourceordercode} </if>
            <if test="sourcelinenum != null and sourcelinenum != ''"> and sourceLineNum = #{sourcelinenum} </if>
            <if test="clientcode != null and clientcode != ''"> and clientCode = #{clientcode} </if>
            <if test="companycode != null and companycode != ''"> and companyCode = #{companycode} </if>
            <if test="facilitycode != null and facilitycode != ''"> and facilityCode = #{facilitycode} </if>
            <if test="skucode != null and skucode != ''"> and skuCode = #{skucode} </if>
            <if test="skuname != null and skuname != ''"> and skuName = #{skuname} </if>
            <if test="requestqty != null and requestqty != ''"> and requestQty = #{requestqty} </if>
            <if test="receivedqty != null and receivedqty != ''"> and receivedQty = #{receivedqty} </if>
            <if test="openqty != null and openqty != ''"> and openQty = #{openqty} </if>
            <if test="quantityum != null and quantityum != ''"> and quantityUM = #{quantityum} </if>
            <if test="totalweight != null and totalweight != ''"> and totalWeight = #{totalweight} </if>
            <if test="totalvolume != null and totalvolume != ''"> and totalVolume = #{totalvolume} </if>
            <if test="totalvolumeweight != null and totalvolumeweight != ''"> and totalVolumeWeight = #{totalvolumeweight} </if>
            <if test="totalamount != null and totalamount != ''"> and totalAmount = #{totalamount} </if>
            <if test="weightum != null and weightum != ''"> and weightUM = #{weightum} </if>
            <if test="volumeum != null and volumeum != ''"> and volumeUM = #{volumeum} </if>
            <if test="inventorysts != null and inventorysts != ''"> and inventorySts = #{inventorysts} </if>
            <if test="intransinvid != null and intransinvid != ''"> and inTransInvId = #{intransinvid} </if>
            <if test="closed != null and closed != ''"> and closed = #{closed} </if>
            <if test="created != null and created != ''"> and created = #{created} </if>
            <if test="createdby != null and createdby != ''"> and createdBy = #{createdby} </if>
            <if test="lastupdated != null and lastupdated != ''"> and lastUpdated = #{lastupdated} </if>
            <if test="lastupdatedby != null and lastupdatedby != ''"> and lastUpdatedBy = #{lastupdatedby} </if>
            <if test="discountprice != null and discountprice != ''"> and discountPrice = #{discountprice} </if>
            <if test="maintableid != null and maintableid != ''"> and mainTableId = #{maintableid} </if>
            <if test="newtransmitinfo != null and newtransmitinfo != ''"> and newTransmitInfo = #{newtransmitinfo} </if>
            <if test="newpushdate != null and newpushdate != ''"> and newPushDate = #{newpushdate} </if>
            <if test="newstate != null and newstate != ''"> and newState = #{newstate} </if>
            <if test="newsystemnumber != null and newsystemnumber != ''"> and newSystemNumber = #{newsystemnumber} </if>
            <if test="newsystemprimary != null and newsystemprimary != ''"> and newSystemPrimary = #{newsystemprimary} </if>
            <if test="newtransmitinfo2 != null and newtransmitinfo2 != ''"> and newTransmitInfo2 = #{newtransmitinfo2} </if>
            <if test="newpushdate2 != null and newpushdate2 != ''"> and newPushDate2 = #{newpushdate2} </if>
            <if test="newstate2 != null and newstate2 != ''"> and newState2 = #{newstate2} </if>
            <if test="newsystemnumber2 != null and newsystemnumber2 != ''"> and newSystemNumber2 = #{newsystemnumber2} </if>
            <if test="newsystemprimary2 != null and newsystemprimary2 != ''"> and newSystemPrimary2 = #{newsystemprimary2} </if>
            <if test="newtransmitinfo3 != null and newtransmitinfo3 != ''"> and newTransmitInfo3 = #{newtransmitinfo3} </if>
            <if test="newpushdate3 != null and newpushdate3 != ''"> and newPushDate3 = #{newpushdate3} </if>
            <if test="newstate3 != null and newstate3 != ''"> and newState3 = #{newstate3} </if>
            <if test="newsystemnumber3 != null and newsystemnumber3 != ''"> and newSystemNumber3 = #{newsystemnumber3} </if>
            <if test="newsystemprimary3 != null and newsystemprimary3 != ''"> and newSystemPrimary3 = #{newsystemprimary3} </if>
            <if test="newtransmitinfo4 != null and newtransmitinfo4 != ''"> and newTransmitInfo4 = #{newtransmitinfo4} </if>
            <if test="newpushdate4 != null and newpushdate4 != ''"> and newPushDate4 = #{newpushdate4} </if>
            <if test="newstate4 != null and newstate4 != ''"> and newState4 = #{newstate4} </if>
            <if test="newsystemnumber4 != null and newsystemnumber4 != ''"> and newSystemNumber4 = #{newsystemnumber4} </if>
            <if test="newsystemprimary4 != null and newsystemprimary4 != ''"> and newSystemPrimary4 = #{newsystemprimary4} </if>
            <if test="businessdate != null and businessdate != ''"> and businessDate = #{businessdate} </if>
            <if test="refundedat != null and refundedat != ''"> and refundedAt = #{refundedat} </if>
            <if test="businesstype != null and businesstype != ''"> and businessType = #{businesstype} </if>
            <if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
            <if test="def2 != null and def2 != ''"> and def2 = #{def2} </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="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="def20 != null and def20 != ''"> and def20 = #{def20} </if>
            <if test="def21 != null and def21 != ''"> and def21 = #{def21} </if>
            <if test="def22 != null and def22 != ''"> and def22 = #{def22} </if>
            <if test="def23 != null and def23 != ''"> and def23 = #{def23} </if>
            <if test="def24 != null and def24 != ''"> and def24 = #{def24} </if>
            <if test="def25 != null and def25 != ''"> and def25 = #{def25} </if>
            <if test="def26 != null and def26 != ''"> and def26 = #{def26} </if>
            <if test="def27 != null and def27 != ''"> and def27 = #{def27} </if>
            <if test="def28 != null and def28 != ''"> and def28 = #{def28} </if>
            <if test="def29 != null and def29 != ''"> and def29 = #{def29} </if>
            <if test="def30 != null and def30 != ''"> and def30 = #{def30} </if>
            <if test="def31 != null and def31 != ''"> and def31 = #{def31} </if>
            <if test="def32 != null and def32 != ''"> and def32 = #{def32} </if>
            <if test="def33 != null and def33 != ''"> and def33 = #{def33} </if>
            <if test="def34 != null and def34 != ''"> and def34 = #{def34} </if>
            <if test="def35 != null and def35 != ''"> and def35 = #{def35} </if>
            <if test="def36 != null and def36 != ''"> and def36 = #{def36} </if>
            <if test="def37 != null and def37 != ''"> and def37 = #{def37} </if>
            <if test="def38 != null and def38 != ''"> and def38 = #{def38} </if>
            <if test="def39 != null and def39 != ''"> and def39 = #{def39} </if>
            <if test="def40 != null and def40 != ''"> and def40 = #{def40} </if>
            <if test="ids!=null and ids!=''">
                and id in (${ids})
            </if>
--             and sts='Y'
    </trim>
<!--    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>-->
<!--    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>-->
</select>
    
<!-- 查询符合条件的数量 -->
<select id="entity_count" resultType="Integer" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity">
        select  count(1)   from tocofs_returngoods_detailed
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null and id != ''"> and id = #{id} </if>
            <if test="receiptid != null and receiptid != ''"> and receiptId = #{receiptid} </if>
            <if test="receiptcode != null and receiptcode != ''"> and receiptCode = #{receiptcode} </if>
            <if test="reforderid != null and reforderid != ''"> and refOrderId = #{reforderid} </if>
            <if test="reforderdetailid != null and reforderdetailid != ''"> and refOrderDetailId = #{reforderdetailid} </if>
            <if test="sourceordercode != null and sourceordercode != ''"> and sourceOrderCode = #{sourceordercode} </if>
            <if test="sourcelinenum != null and sourcelinenum != ''"> and sourceLineNum = #{sourcelinenum} </if>
            <if test="clientcode != null and clientcode != ''"> and clientCode = #{clientcode} </if>
            <if test="companycode != null and companycode != ''"> and companyCode = #{companycode} </if>
            <if test="facilitycode != null and facilitycode != ''"> and facilityCode = #{facilitycode} </if>
            <if test="skucode != null and skucode != ''"> and skuCode = #{skucode} </if>
            <if test="skuname != null and skuname != ''"> and skuName = #{skuname} </if>
            <if test="requestqty != null and requestqty != ''"> and requestQty = #{requestqty} </if>
            <if test="receivedqty != null and receivedqty != ''"> and receivedQty = #{receivedqty} </if>
            <if test="openqty != null and openqty != ''"> and openQty = #{openqty} </if>
            <if test="quantityum != null and quantityum != ''"> and quantityUM = #{quantityum} </if>
            <if test="totalweight != null and totalweight != ''"> and totalWeight = #{totalweight} </if>
            <if test="totalvolume != null and totalvolume != ''"> and totalVolume = #{totalvolume} </if>
            <if test="totalvolumeweight != null and totalvolumeweight != ''"> and totalVolumeWeight = #{totalvolumeweight} </if>
            <if test="totalamount != null and totalamount != ''"> and totalAmount = #{totalamount} </if>
            <if test="weightum != null and weightum != ''"> and weightUM = #{weightum} </if>
            <if test="volumeum != null and volumeum != ''"> and volumeUM = #{volumeum} </if>
            <if test="inventorysts != null and inventorysts != ''"> and inventorySts = #{inventorysts} </if>
            <if test="intransinvid != null and intransinvid != ''"> and inTransInvId = #{intransinvid} </if>
            <if test="closed != null and closed != ''"> and closed = #{closed} </if>
            <if test="created != null and created != ''"> and created = #{created} </if>
            <if test="createdby != null and createdby != ''"> and createdBy = #{createdby} </if>
            <if test="lastupdated != null and lastupdated != ''"> and lastUpdated = #{lastupdated} </if>
            <if test="lastupdatedby != null and lastupdatedby != ''"> and lastUpdatedBy = #{lastupdatedby} </if>
            <if test="discountprice != null and discountprice != ''"> and discountPrice = #{discountprice} </if>
            <if test="maintableid != null and maintableid != ''"> and mainTableId = #{maintableid} </if>
            <if test="newtransmitinfo != null and newtransmitinfo != ''"> and newTransmitInfo = #{newtransmitinfo} </if>
            <if test="newpushdate != null and newpushdate != ''"> and newPushDate = #{newpushdate} </if>
            <if test="newstate != null and newstate != ''"> and newState = #{newstate} </if>
            <if test="newsystemnumber != null and newsystemnumber != ''"> and newSystemNumber = #{newsystemnumber} </if>
            <if test="newsystemprimary != null and newsystemprimary != ''"> and newSystemPrimary = #{newsystemprimary} </if>
            <if test="newtransmitinfo2 != null and newtransmitinfo2 != ''"> and newTransmitInfo2 = #{newtransmitinfo2} </if>
            <if test="newpushdate2 != null and newpushdate2 != ''"> and newPushDate2 = #{newpushdate2} </if>
            <if test="newstate2 != null and newstate2 != ''"> and newState2 = #{newstate2} </if>
            <if test="newsystemnumber2 != null and newsystemnumber2 != ''"> and newSystemNumber2 = #{newsystemnumber2} </if>
            <if test="newsystemprimary2 != null and newsystemprimary2 != ''"> and newSystemPrimary2 = #{newsystemprimary2} </if>
            <if test="newtransmitinfo3 != null and newtransmitinfo3 != ''"> and newTransmitInfo3 = #{newtransmitinfo3} </if>
            <if test="newpushdate3 != null and newpushdate3 != ''"> and newPushDate3 = #{newpushdate3} </if>
            <if test="newstate3 != null and newstate3 != ''"> and newState3 = #{newstate3} </if>
            <if test="newsystemnumber3 != null and newsystemnumber3 != ''"> and newSystemNumber3 = #{newsystemnumber3} </if>
            <if test="newsystemprimary3 != null and newsystemprimary3 != ''"> and newSystemPrimary3 = #{newsystemprimary3} </if>
            <if test="newtransmitinfo4 != null and newtransmitinfo4 != ''"> and newTransmitInfo4 = #{newtransmitinfo4} </if>
            <if test="newpushdate4 != null and newpushdate4 != ''"> and newPushDate4 = #{newpushdate4} </if>
            <if test="newstate4 != null and newstate4 != ''"> and newState4 = #{newstate4} </if>
            <if test="newsystemnumber4 != null and newsystemnumber4 != ''"> and newSystemNumber4 = #{newsystemnumber4} </if>
            <if test="newsystemprimary4 != null and newsystemprimary4 != ''"> and newSystemPrimary4 = #{newsystemprimary4} </if>
            <if test="businessdate != null and businessdate != ''"> and businessDate = #{businessdate} </if>
            <if test="refundedat != null and refundedat != ''"> and refundedAt = #{refundedat} </if>
            <if test="businesstype != null and businesstype != ''"> and businessType = #{businesstype} </if>
            <if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
            <if test="def2 != null and def2 != ''"> and def2 = #{def2} </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="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="def20 != null and def20 != ''"> and def20 = #{def20} </if>
            <if test="def21 != null and def21 != ''"> and def21 = #{def21} </if>
            <if test="def22 != null and def22 != ''"> and def22 = #{def22} </if>
            <if test="def23 != null and def23 != ''"> and def23 = #{def23} </if>
            <if test="def24 != null and def24 != ''"> and def24 = #{def24} </if>
            <if test="def25 != null and def25 != ''"> and def25 = #{def25} </if>
            <if test="def26 != null and def26 != ''"> and def26 = #{def26} </if>
            <if test="def27 != null and def27 != ''"> and def27 = #{def27} </if>
            <if test="def28 != null and def28 != ''"> and def28 = #{def28} </if>
            <if test="def29 != null and def29 != ''"> and def29 = #{def29} </if>
            <if test="def30 != null and def30 != ''"> and def30 = #{def30} </if>
            <if test="def31 != null and def31 != ''"> and def31 = #{def31} </if>
            <if test="def32 != null and def32 != ''"> and def32 = #{def32} </if>
            <if test="def33 != null and def33 != ''"> and def33 = #{def33} </if>
            <if test="def34 != null and def34 != ''"> and def34 = #{def34} </if>
            <if test="def35 != null and def35 != ''"> and def35 = #{def35} </if>
            <if test="def36 != null and def36 != ''"> and def36 = #{def36} </if>
            <if test="def37 != null and def37 != ''"> and def37 = #{def37} </if>
            <if test="def38 != null and def38 != ''"> and def38 = #{def38} </if>
            <if test="def39 != null and def39 != ''"> and def39 = #{def39} </if>
            <if test="def40 != null and def40 != ''"> and def40 = #{def40} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null "> order by ${sort} ${order}</if>
    </select>

    <!-- 分页查询列表 采用like格式 -->
<select id="entity_list_like" resultMap="get-TocofsReturngoodsDetailedEntity-result" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity">
    select
    <include refid="TocofsReturngoodsDetailedEntity_Base_Column_List" />
    from tocofs_returngoods_detailed
    <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null and id != ''"> and id like concat('%',#{id},'%') </if>
            <if test="receiptid != null and receiptid != ''"> and receiptId like concat('%',#{receiptid},'%') </if>
            <if test="receiptcode != null and receiptcode != ''"> and receiptCode like concat('%',#{receiptcode},'%') </if>
            <if test="reforderid != null and reforderid != ''"> and refOrderId like concat('%',#{reforderid},'%') </if>
            <if test="reforderdetailid != null and reforderdetailid != ''"> and refOrderDetailId like concat('%',#{reforderdetailid},'%') </if>
            <if test="sourceordercode != null and sourceordercode != ''"> and sourceOrderCode like concat('%',#{sourceordercode},'%') </if>
            <if test="sourcelinenum != null and sourcelinenum != ''"> and sourceLineNum like concat('%',#{sourcelinenum},'%') </if>
            <if test="clientcode != null and clientcode != ''"> and clientCode like concat('%',#{clientcode},'%') </if>
            <if test="companycode != null and companycode != ''"> and companyCode like concat('%',#{companycode},'%') </if>
            <if test="facilitycode != null and facilitycode != ''"> and facilityCode like concat('%',#{facilitycode},'%') </if>
            <if test="skucode != null and skucode != ''"> and skuCode like concat('%',#{skucode},'%') </if>
            <if test="skuname != null and skuname != ''"> and skuName like concat('%',#{skuname},'%') </if>
            <if test="requestqty != null and requestqty != ''"> and requestQty like concat('%',#{requestqty},'%') </if>
            <if test="receivedqty != null and receivedqty != ''"> and receivedQty like concat('%',#{receivedqty},'%') </if>
            <if test="openqty != null and openqty != ''"> and openQty like concat('%',#{openqty},'%') </if>
            <if test="quantityum != null and quantityum != ''"> and quantityUM like concat('%',#{quantityum},'%') </if>
            <if test="totalweight != null and totalweight != ''"> and totalWeight like concat('%',#{totalweight},'%') </if>
            <if test="totalvolume != null and totalvolume != ''"> and totalVolume like concat('%',#{totalvolume},'%') </if>
            <if test="totalvolumeweight != null and totalvolumeweight != ''"> and totalVolumeWeight like concat('%',#{totalvolumeweight},'%') </if>
            <if test="totalamount != null and totalamount != ''"> and totalAmount like concat('%',#{totalamount},'%') </if>
            <if test="weightum != null and weightum != ''"> and weightUM like concat('%',#{weightum},'%') </if>
            <if test="volumeum != null and volumeum != ''"> and volumeUM like concat('%',#{volumeum},'%') </if>
            <if test="inventorysts != null and inventorysts != ''"> and inventorySts like concat('%',#{inventorysts},'%') </if>
            <if test="intransinvid != null and intransinvid != ''"> and inTransInvId like concat('%',#{intransinvid},'%') </if>
            <if test="closed != null and closed != ''"> and closed like concat('%',#{closed},'%') </if>
            <if test="created != null and created != ''"> and created like concat('%',#{created},'%') </if>
            <if test="createdby != null and createdby != ''"> and createdBy like concat('%',#{createdby},'%') </if>
            <if test="lastupdated != null and lastupdated != ''"> and lastUpdated like concat('%',#{lastupdated},'%') </if>
            <if test="lastupdatedby != null and lastupdatedby != ''"> and lastUpdatedBy like concat('%',#{lastupdatedby},'%') </if>
            <if test="discountprice != null and discountprice != ''"> and discountPrice like concat('%',#{discountprice},'%') </if>
            <if test="maintableid != null and maintableid != ''"> and mainTableId like concat('%',#{maintableid},'%') </if>
            <if test="newtransmitinfo != null and newtransmitinfo != ''"> and newTransmitInfo like concat('%',#{newtransmitinfo},'%') </if>
            <if test="newpushdate != null and newpushdate != ''"> and newPushDate like concat('%',#{newpushdate},'%') </if>
            <if test="newstate != null and newstate != ''"> and newState like concat('%',#{newstate},'%') </if>
            <if test="newsystemnumber != null and newsystemnumber != ''"> and newSystemNumber like concat('%',#{newsystemnumber},'%') </if>
            <if test="newsystemprimary != null and newsystemprimary != ''"> and newSystemPrimary like concat('%',#{newsystemprimary},'%') </if>
            <if test="newtransmitinfo2 != null and newtransmitinfo2 != ''"> and newTransmitInfo2 like concat('%',#{newtransmitinfo2},'%') </if>
            <if test="newpushdate2 != null and newpushdate2 != ''"> and newPushDate2 like concat('%',#{newpushdate2},'%') </if>
            <if test="newstate2 != null and newstate2 != ''"> and newState2 like concat('%',#{newstate2},'%') </if>
            <if test="newsystemnumber2 != null and newsystemnumber2 != ''"> and newSystemNumber2 like concat('%',#{newsystemnumber2},'%') </if>
            <if test="newsystemprimary2 != null and newsystemprimary2 != ''"> and newSystemPrimary2 like concat('%',#{newsystemprimary2},'%') </if>
            <if test="newtransmitinfo3 != null and newtransmitinfo3 != ''"> and newTransmitInfo3 like concat('%',#{newtransmitinfo3},'%') </if>
            <if test="newpushdate3 != null and newpushdate3 != ''"> and newPushDate3 like concat('%',#{newpushdate3},'%') </if>
            <if test="newstate3 != null and newstate3 != ''"> and newState3 like concat('%',#{newstate3},'%') </if>
            <if test="newsystemnumber3 != null and newsystemnumber3 != ''"> and newSystemNumber3 like concat('%',#{newsystemnumber3},'%') </if>
            <if test="newsystemprimary3 != null and newsystemprimary3 != ''"> and newSystemPrimary3 like concat('%',#{newsystemprimary3},'%') </if>
            <if test="newtransmitinfo4 != null and newtransmitinfo4 != ''"> and newTransmitInfo4 like concat('%',#{newtransmitinfo4},'%') </if>
            <if test="newpushdate4 != null and newpushdate4 != ''"> and newPushDate4 like concat('%',#{newpushdate4},'%') </if>
            <if test="newstate4 != null and newstate4 != ''"> and newState4 like concat('%',#{newstate4},'%') </if>
            <if test="newsystemnumber4 != null and newsystemnumber4 != ''"> and newSystemNumber4 like concat('%',#{newsystemnumber4},'%') </if>
            <if test="newsystemprimary4 != null and newsystemprimary4 != ''"> and newSystemPrimary4 like concat('%',#{newsystemprimary4},'%') </if>
            <if test="businessdate != null and businessdate != ''"> and businessDate like concat('%',#{businessdate},'%') </if>
            <if test="refundedat != null and refundedat != ''"> and refundedAt like concat('%',#{refundedat},'%') </if>
            <if test="businesstype != null and businesstype != ''"> and businessType like concat('%',#{businesstype},'%') </if>
            <if test="def1 != null and def1 != ''"> and def1 like concat('%',#{def1},'%') </if>
            <if test="def2 != null and def2 != ''"> and def2 like concat('%',#{def2},'%') </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="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="def20 != null and def20 != ''"> and def20 like concat('%',#{def20},'%') </if>
            <if test="def21 != null and def21 != ''"> and def21 like concat('%',#{def21},'%') </if>
            <if test="def22 != null and def22 != ''"> and def22 like concat('%',#{def22},'%') </if>
            <if test="def23 != null and def23 != ''"> and def23 like concat('%',#{def23},'%') </if>
            <if test="def24 != null and def24 != ''"> and def24 like concat('%',#{def24},'%') </if>
            <if test="def25 != null and def25 != ''"> and def25 like concat('%',#{def25},'%') </if>
            <if test="def26 != null and def26 != ''"> and def26 like concat('%',#{def26},'%') </if>
            <if test="def27 != null and def27 != ''"> and def27 like concat('%',#{def27},'%') </if>
            <if test="def28 != null and def28 != ''"> and def28 like concat('%',#{def28},'%') </if>
            <if test="def29 != null and def29 != ''"> and def29 like concat('%',#{def29},'%') </if>
            <if test="def30 != null and def30 != ''"> and def30 like concat('%',#{def30},'%') </if>
            <if test="def31 != null and def31 != ''"> and def31 like concat('%',#{def31},'%') </if>
            <if test="def32 != null and def32 != ''"> and def32 like concat('%',#{def32},'%') </if>
            <if test="def33 != null and def33 != ''"> and def33 like concat('%',#{def33},'%') </if>
            <if test="def34 != null and def34 != ''"> and def34 like concat('%',#{def34},'%') </if>
            <if test="def35 != null and def35 != ''"> and def35 like concat('%',#{def35},'%') </if>
            <if test="def36 != null and def36 != ''"> and def36 like concat('%',#{def36},'%') </if>
            <if test="def37 != null and def37 != ''"> and def37 like concat('%',#{def37},'%') </if>
            <if test="def38 != null and def38 != ''"> and def38 like concat('%',#{def38},'%') </if>
            <if test="def39 != null and def39 != ''"> and def39 like concat('%',#{def39},'%') </if>
            <if test="def40 != null and def40 != ''"> and def40 like concat('%',#{def40},'%') </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString() "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!-- 查询列表 字段采用or格式 -->
<select id="TocofsReturngoodsDetailedentity_list_or" resultMap="get-TocofsReturngoodsDetailedEntity-result" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity">
    select
    <include refid="TocofsReturngoodsDetailedEntity_Base_Column_List" />
    from tocofs_returngoods_detailed
    <trim prefix="where" prefixOverrides="and"> 
         <if test="id != null and id != ''"> or id = #{id} </if>
             <if test="receiptid != null and receiptid != ''"> or receiptId = #{receiptid} </if>
             <if test="receiptcode != null and receiptcode != ''"> or receiptCode = #{receiptcode} </if>
             <if test="reforderid != null and reforderid != ''"> or refOrderId = #{reforderid} </if>
             <if test="reforderdetailid != null and reforderdetailid != ''"> or refOrderDetailId = #{reforderdetailid} </if>
             <if test="sourceordercode != null and sourceordercode != ''"> or sourceOrderCode = #{sourceordercode} </if>
             <if test="sourcelinenum != null and sourcelinenum != ''"> or sourceLineNum = #{sourcelinenum} </if>
             <if test="clientcode != null and clientcode != ''"> or clientCode = #{clientcode} </if>
             <if test="companycode != null and companycode != ''"> or companyCode = #{companycode} </if>
             <if test="facilitycode != null and facilitycode != ''"> or facilityCode = #{facilitycode} </if>
             <if test="skucode != null and skucode != ''"> or skuCode = #{skucode} </if>
             <if test="skuname != null and skuname != ''"> or skuName = #{skuname} </if>
             <if test="requestqty != null and requestqty != ''"> or requestQty = #{requestqty} </if>
             <if test="receivedqty != null and receivedqty != ''"> or receivedQty = #{receivedqty} </if>
             <if test="openqty != null and openqty != ''"> or openQty = #{openqty} </if>
             <if test="quantityum != null and quantityum != ''"> or quantityUM = #{quantityum} </if>
             <if test="totalweight != null and totalweight != ''"> or totalWeight = #{totalweight} </if>
             <if test="totalvolume != null and totalvolume != ''"> or totalVolume = #{totalvolume} </if>
             <if test="totalvolumeweight != null and totalvolumeweight != ''"> or totalVolumeWeight = #{totalvolumeweight} </if>
             <if test="totalamount != null and totalamount != ''"> or totalAmount = #{totalamount} </if>
             <if test="weightum != null and weightum != ''"> or weightUM = #{weightum} </if>
             <if test="volumeum != null and volumeum != ''"> or volumeUM = #{volumeum} </if>
             <if test="inventorysts != null and inventorysts != ''"> or inventorySts = #{inventorysts} </if>
             <if test="intransinvid != null and intransinvid != ''"> or inTransInvId = #{intransinvid} </if>
             <if test="closed != null and closed != ''"> or closed = #{closed} </if>
             <if test="created != null and created != ''"> or created = #{created} </if>
             <if test="createdby != null and createdby != ''"> or createdBy = #{createdby} </if>
             <if test="lastupdated != null and lastupdated != ''"> or lastUpdated = #{lastupdated} </if>
             <if test="lastupdatedby != null and lastupdatedby != ''"> or lastUpdatedBy = #{lastupdatedby} </if>
             <if test="discountprice != null and discountprice != ''"> or discountPrice = #{discountprice} </if>
             <if test="maintableid != null and maintableid != ''"> or mainTableId = #{maintableid} </if>
             <if test="newtransmitinfo != null and newtransmitinfo != ''"> or newTransmitInfo = #{newtransmitinfo} </if>
             <if test="newpushdate != null and newpushdate != ''"> or newPushDate = #{newpushdate} </if>
             <if test="newstate != null and newstate != ''"> or newState = #{newstate} </if>
             <if test="newsystemnumber != null and newsystemnumber != ''"> or newSystemNumber = #{newsystemnumber} </if>
             <if test="newsystemprimary != null and newsystemprimary != ''"> or newSystemPrimary = #{newsystemprimary} </if>
             <if test="newtransmitinfo2 != null and newtransmitinfo2 != ''"> or newTransmitInfo2 = #{newtransmitinfo2} </if>
             <if test="newpushdate2 != null and newpushdate2 != ''"> or newPushDate2 = #{newpushdate2} </if>
             <if test="newstate2 != null and newstate2 != ''"> or newState2 = #{newstate2} </if>
             <if test="newsystemnumber2 != null and newsystemnumber2 != ''"> or newSystemNumber2 = #{newsystemnumber2} </if>
             <if test="newsystemprimary2 != null and newsystemprimary2 != ''"> or newSystemPrimary2 = #{newsystemprimary2} </if>
             <if test="newtransmitinfo3 != null and newtransmitinfo3 != ''"> or newTransmitInfo3 = #{newtransmitinfo3} </if>
             <if test="newpushdate3 != null and newpushdate3 != ''"> or newPushDate3 = #{newpushdate3} </if>
             <if test="newstate3 != null and newstate3 != ''"> or newState3 = #{newstate3} </if>
             <if test="newsystemnumber3 != null and newsystemnumber3 != ''"> or newSystemNumber3 = #{newsystemnumber3} </if>
             <if test="newsystemprimary3 != null and newsystemprimary3 != ''"> or newSystemPrimary3 = #{newsystemprimary3} </if>
             <if test="newtransmitinfo4 != null and newtransmitinfo4 != ''"> or newTransmitInfo4 = #{newtransmitinfo4} </if>
             <if test="newpushdate4 != null and newpushdate4 != ''"> or newPushDate4 = #{newpushdate4} </if>
             <if test="newstate4 != null and newstate4 != ''"> or newState4 = #{newstate4} </if>
             <if test="newsystemnumber4 != null and newsystemnumber4 != ''"> or newSystemNumber4 = #{newsystemnumber4} </if>
             <if test="newsystemprimary4 != null and newsystemprimary4 != ''"> or newSystemPrimary4 = #{newsystemprimary4} </if>
             <if test="businessdate != null and businessdate != ''"> or businessDate = #{businessdate} </if>
             <if test="refundedat != null and refundedat != ''"> or refundedAt = #{refundedat} </if>
             <if test="businesstype != null and businesstype != ''"> or businessType = #{businesstype} </if>
             <if test="def1 != null and def1 != ''"> or def1 = #{def1} </if>
             <if test="def2 != null and def2 != ''"> or def2 = #{def2} </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="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="def20 != null and def20 != ''"> or def20 = #{def20} </if>
             <if test="def21 != null and def21 != ''"> or def21 = #{def21} </if>
             <if test="def22 != null and def22 != ''"> or def22 = #{def22} </if>
             <if test="def23 != null and def23 != ''"> or def23 = #{def23} </if>
             <if test="def24 != null and def24 != ''"> or def24 = #{def24} </if>
             <if test="def25 != null and def25 != ''"> or def25 = #{def25} </if>
             <if test="def26 != null and def26 != ''"> or def26 = #{def26} </if>
             <if test="def27 != null and def27 != ''"> or def27 = #{def27} </if>
             <if test="def28 != null and def28 != ''"> or def28 = #{def28} </if>
             <if test="def29 != null and def29 != ''"> or def29 = #{def29} </if>
             <if test="def30 != null and def30 != ''"> or def30 = #{def30} </if>
             <if test="def31 != null and def31 != ''"> or def31 = #{def31} </if>
             <if test="def32 != null and def32 != ''"> or def32 = #{def32} </if>
             <if test="def33 != null and def33 != ''"> or def33 = #{def33} </if>
             <if test="def34 != null and def34 != ''"> or def34 = #{def34} </if>
             <if test="def35 != null and def35 != ''"> or def35 = #{def35} </if>
             <if test="def36 != null and def36 != ''"> or def36 = #{def36} </if>
             <if test="def37 != null and def37 != ''"> or def37 = #{def37} </if>
             <if test="def38 != null and def38 != ''"> or def38 = #{def38} </if>
             <if test="def39 != null and def39 != ''"> or def39 = #{def39} </if>
             <if test="def40 != null and def40 != ''"> or def40 = #{def40} </if>
            and sts='Y'
    </trim>
    <if test=" sort == null or sort == ''.toString()  "> order by sorts asc</if>
    <if test=" sort !='' and sort!=null and order !='' and order!=null ">order by ${sort} ${order}</if>
</select>

<!--新增所有列-->
<insert id="entity_insert" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity" keyProperty="id" useGeneratedKeys="true">
    insert into tocofs_returngoods_detailed(
  <trim suffix="" suffixOverrides=",">
       <if test="id != null and id != ''"> id , </if>
            <if test="receiptid != null and receiptid != ''"> receiptId , </if>
            <if test="receiptcode != null and receiptcode != ''"> receiptCode , </if>
            <if test="reforderid != null and reforderid != ''"> refOrderId , </if>
            <if test="reforderdetailid != null and reforderdetailid != ''"> refOrderDetailId , </if>
            <if test="sourceordercode != null and sourceordercode != ''"> sourceOrderCode , </if>
            <if test="sourcelinenum != null and sourcelinenum != ''"> sourceLineNum , </if>
            <if test="clientcode != null and clientcode != ''"> clientCode , </if>
            <if test="companycode != null and companycode != ''"> companyCode , </if>
            <if test="facilitycode != null and facilitycode != ''"> facilityCode , </if>
            <if test="skucode != null and skucode != ''"> skuCode , </if>
            <if test="skuname != null and skuname != ''"> skuName , </if>
            <if test="requestqty != null and requestqty != ''"> requestQty , </if>
            <if test="receivedqty != null and receivedqty != ''"> receivedQty , </if>
            <if test="openqty != null and openqty != ''"> openQty , </if>
            <if test="quantityum != null and quantityum != ''"> quantityUM , </if>
            <if test="totalweight != null and totalweight != ''"> totalWeight , </if>
            <if test="totalvolume != null and totalvolume != ''"> totalVolume , </if>
            <if test="totalvolumeweight != null and totalvolumeweight != ''"> totalVolumeWeight , </if>
            <if test="totalamount != null and totalamount != ''"> totalAmount , </if>
            <if test="weightum != null and weightum != ''"> weightUM , </if>
            <if test="volumeum != null and volumeum != ''"> volumeUM , </if>
            <if test="inventorysts != null and inventorysts != ''"> inventorySts , </if>
            <if test="intransinvid != null and intransinvid != ''"> inTransInvId , </if>
            <if test="closed != null and closed != ''"> closed , </if>
            <if test="created != null and created != ''"> created , </if>
            <if test="createdby != null and createdby != ''"> createdBy , </if>
            <if test="lastupdated != null and lastupdated != ''"> lastUpdated , </if>
            <if test="lastupdatedby != null and lastupdatedby != ''"> lastUpdatedBy , </if>
            <if test="discountprice != null and discountprice != ''"> discountPrice , </if>
            <if test="maintableid != null and maintableid != ''"> mainTableId , </if>
            <if test="newtransmitinfo != null and newtransmitinfo != ''"> newTransmitInfo , </if>
            <if test="newpushdate != null and newpushdate != ''"> newPushDate , </if>
            <if test="newstate != null and newstate != ''"> newState , </if>
            <if test="newsystemnumber != null and newsystemnumber != ''"> newSystemNumber , </if>
            <if test="newsystemprimary != null and newsystemprimary != ''"> newSystemPrimary , </if>
            <if test="newtransmitinfo2 != null and newtransmitinfo2 != ''"> newTransmitInfo2 , </if>
            <if test="newpushdate2 != null and newpushdate2 != ''"> newPushDate2 , </if>
            <if test="newstate2 != null and newstate2 != ''"> newState2 , </if>
            <if test="newsystemnumber2 != null and newsystemnumber2 != ''"> newSystemNumber2 , </if>
            <if test="newsystemprimary2 != null and newsystemprimary2 != ''"> newSystemPrimary2 , </if>
            <if test="newtransmitinfo3 != null and newtransmitinfo3 != ''"> newTransmitInfo3 , </if>
            <if test="newpushdate3 != null and newpushdate3 != ''"> newPushDate3 , </if>
            <if test="newstate3 != null and newstate3 != ''"> newState3 , </if>
            <if test="newsystemnumber3 != null and newsystemnumber3 != ''"> newSystemNumber3 , </if>
            <if test="newsystemprimary3 != null and newsystemprimary3 != ''"> newSystemPrimary3 , </if>
            <if test="newtransmitinfo4 != null and newtransmitinfo4 != ''"> newTransmitInfo4 , </if>
            <if test="newpushdate4 != null and newpushdate4 != ''"> newPushDate4 , </if>
            <if test="newstate4 != null and newstate4 != ''"> newState4 , </if>
            <if test="newsystemnumber4 != null and newsystemnumber4 != ''"> newSystemNumber4 , </if>
            <if test="newsystemprimary4 != null and newsystemprimary4 != ''"> newSystemPrimary4 , </if>
            <if test="businessdate != null and businessdate != ''"> businessDate , </if>
            <if test="refundedat != null and refundedat != ''"> refundedAt , </if>
            <if test="businesstype != null and businesstype != ''"> businessType , </if>
            <if test="def1 != null and def1 != ''"> def1 , </if>
            <if test="def2 != null and def2 != ''"> def2 , </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="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="def20 != null and def20 != ''"> def20 , </if>
            <if test="def21 != null and def21 != ''"> def21 , </if>
            <if test="def22 != null and def22 != ''"> def22 , </if>
            <if test="def23 != null and def23 != ''"> def23 , </if>
            <if test="def24 != null and def24 != ''"> def24 , </if>
            <if test="def25 != null and def25 != ''"> def25 , </if>
            <if test="def26 != null and def26 != ''"> def26 , </if>
            <if test="def27 != null and def27 != ''"> def27 , </if>
            <if test="def28 != null and def28 != ''"> def28 , </if>
            <if test="def29 != null and def29 != ''"> def29 , </if>
            <if test="def30 != null and def30 != ''"> def30 , </if>
            <if test="def31 != null and def31 != ''"> def31 , </if>
            <if test="def32 != null and def32 != ''"> def32 , </if>
            <if test="def33 != null and def33 != ''"> def33 , </if>
            <if test="def34 != null and def34 != ''"> def34 , </if>
            <if test="def35 != null and def35 != ''"> def35 , </if>
            <if test="def36 != null and def36 != ''"> def36 , </if>
            <if test="def37 != null and def37 != ''"> def37 , </if>
            <if test="def38 != null and def38 != ''"> def38 , </if>
            <if test="def39 != null and def39 != ''"> def39 , </if>
            <if test="def40 != null and def40 != ''"> def40 , </if>
            <if test="sorts == null ">sorts,</if>
    <if test="sts == null ">sts,</if>
  </trim>
  )values(
 <trim suffix="" suffixOverrides=",">
       <if test="id != null and id != ''"> #{id} ,</if>
            <if test="receiptid != null and receiptid != ''"> #{receiptid} ,</if>
            <if test="receiptcode != null and receiptcode != ''"> #{receiptcode} ,</if>
            <if test="reforderid != null and reforderid != ''"> #{reforderid} ,</if>
            <if test="reforderdetailid != null and reforderdetailid != ''"> #{reforderdetailid} ,</if>
            <if test="sourceordercode != null and sourceordercode != ''"> #{sourceordercode} ,</if>
            <if test="sourcelinenum != null and sourcelinenum != ''"> #{sourcelinenum} ,</if>
            <if test="clientcode != null and clientcode != ''"> #{clientcode} ,</if>
            <if test="companycode != null and companycode != ''"> #{companycode} ,</if>
            <if test="facilitycode != null and facilitycode != ''"> #{facilitycode} ,</if>
            <if test="skucode != null and skucode != ''"> #{skucode} ,</if>
            <if test="skuname != null and skuname != ''"> #{skuname} ,</if>
            <if test="requestqty != null and requestqty != ''"> #{requestqty} ,</if>
            <if test="receivedqty != null and receivedqty != ''"> #{receivedqty} ,</if>
            <if test="openqty != null and openqty != ''"> #{openqty} ,</if>
            <if test="quantityum != null and quantityum != ''"> #{quantityum} ,</if>
            <if test="totalweight != null and totalweight != ''"> #{totalweight} ,</if>
            <if test="totalvolume != null and totalvolume != ''"> #{totalvolume} ,</if>
            <if test="totalvolumeweight != null and totalvolumeweight != ''"> #{totalvolumeweight} ,</if>
            <if test="totalamount != null and totalamount != ''"> #{totalamount} ,</if>
            <if test="weightum != null and weightum != ''"> #{weightum} ,</if>
            <if test="volumeum != null and volumeum != ''"> #{volumeum} ,</if>
            <if test="inventorysts != null and inventorysts != ''"> #{inventorysts} ,</if>
            <if test="intransinvid != null and intransinvid != ''"> #{intransinvid} ,</if>
            <if test="closed != null and closed != ''"> #{closed} ,</if>
            <if test="created != null and created != ''"> #{created} ,</if>
            <if test="createdby != null and createdby != ''"> #{createdby} ,</if>
            <if test="lastupdated != null and lastupdated != ''"> #{lastupdated} ,</if>
            <if test="lastupdatedby != null and lastupdatedby != ''"> #{lastupdatedby} ,</if>
            <if test="discountprice != null and discountprice != ''"> #{discountprice} ,</if>
            <if test="maintableid != null and maintableid != ''"> #{maintableid} ,</if>
            <if test="newtransmitinfo != null and newtransmitinfo != ''"> #{newtransmitinfo} ,</if>
            <if test="newpushdate != null and newpushdate != ''"> #{newpushdate} ,</if>
            <if test="newstate != null and newstate != ''"> #{newstate} ,</if>
            <if test="newsystemnumber != null and newsystemnumber != ''"> #{newsystemnumber} ,</if>
            <if test="newsystemprimary != null and newsystemprimary != ''"> #{newsystemprimary} ,</if>
            <if test="newtransmitinfo2 != null and newtransmitinfo2 != ''"> #{newtransmitinfo2} ,</if>
            <if test="newpushdate2 != null and newpushdate2 != ''"> #{newpushdate2} ,</if>
            <if test="newstate2 != null and newstate2 != ''"> #{newstate2} ,</if>
            <if test="newsystemnumber2 != null and newsystemnumber2 != ''"> #{newsystemnumber2} ,</if>
            <if test="newsystemprimary2 != null and newsystemprimary2 != ''"> #{newsystemprimary2} ,</if>
            <if test="newtransmitinfo3 != null and newtransmitinfo3 != ''"> #{newtransmitinfo3} ,</if>
            <if test="newpushdate3 != null and newpushdate3 != ''"> #{newpushdate3} ,</if>
            <if test="newstate3 != null and newstate3 != ''"> #{newstate3} ,</if>
            <if test="newsystemnumber3 != null and newsystemnumber3 != ''"> #{newsystemnumber3} ,</if>
            <if test="newsystemprimary3 != null and newsystemprimary3 != ''"> #{newsystemprimary3} ,</if>
            <if test="newtransmitinfo4 != null and newtransmitinfo4 != ''"> #{newtransmitinfo4} ,</if>
            <if test="newpushdate4 != null and newpushdate4 != ''"> #{newpushdate4} ,</if>
            <if test="newstate4 != null and newstate4 != ''"> #{newstate4} ,</if>
            <if test="newsystemnumber4 != null and newsystemnumber4 != ''"> #{newsystemnumber4} ,</if>
            <if test="newsystemprimary4 != null and newsystemprimary4 != ''"> #{newsystemprimary4} ,</if>
            <if test="businessdate != null and businessdate != ''"> #{businessdate} ,</if>
            <if test="refundedat != null and refundedat != ''"> #{refundedat} ,</if>
            <if test="businesstype != null and businesstype != ''"> #{businesstype} ,</if>
            <if test="def1 != null and def1 != ''"> #{def1} ,</if>
            <if test="def2 != null and def2 != ''"> #{def2} ,</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="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="def20 != null and def20 != ''"> #{def20} ,</if>
            <if test="def21 != null and def21 != ''"> #{def21} ,</if>
            <if test="def22 != null and def22 != ''"> #{def22} ,</if>
            <if test="def23 != null and def23 != ''"> #{def23} ,</if>
            <if test="def24 != null and def24 != ''"> #{def24} ,</if>
            <if test="def25 != null and def25 != ''"> #{def25} ,</if>
            <if test="def26 != null and def26 != ''"> #{def26} ,</if>
            <if test="def27 != null and def27 != ''"> #{def27} ,</if>
            <if test="def28 != null and def28 != ''"> #{def28} ,</if>
            <if test="def29 != null and def29 != ''"> #{def29} ,</if>
            <if test="def30 != null and def30 != ''"> #{def30} ,</if>
            <if test="def31 != null and def31 != ''"> #{def31} ,</if>
            <if test="def32 != null and def32 != ''"> #{def32} ,</if>
            <if test="def33 != null and def33 != ''"> #{def33} ,</if>
            <if test="def34 != null and def34 != ''"> #{def34} ,</if>
            <if test="def35 != null and def35 != ''"> #{def35} ,</if>
            <if test="def36 != null and def36 != ''"> #{def36} ,</if>
            <if test="def37 != null and def37 != ''"> #{def37} ,</if>
            <if test="def38 != null and def38 != ''"> #{def38} ,</if>
            <if test="def39 != null and def39 != ''"> #{def39} ,</if>
            <if test="def40 != null and def40 != ''"> #{def40} ,</if>
            <if test="sorts == null ">(select (max(IFNULL( a.sorts, 0 )) + 1) as sort from tocofs_returngoods_detailed a WHERE a.sts = 'Y' ),</if>
    <if test="sts == null ">'Y',</if>
  </trim>
  )  
</insert>

<!-- 批量新增 -->
<insert id="entityInsertBatch" keyProperty="id" useGeneratedKeys="true">
  insert into tocofs_returngoods_detailed(receiptId, receiptCode, refOrderId, refOrderDetailId, sourceOrderCode, sourceLineNum, clientCode, companyCode, facilityCode, skuCode, skuName, requestQty, receivedQty, openQty, quantityUM, totalWeight, totalVolume, totalVolumeWeight, totalAmount, weightUM, volumeUM, inventorySts, inTransInvId, closed, created, createdBy, lastUpdated, lastUpdatedBy, discountPrice, mainTableId, newTransmitInfo, newPushDate, newState, newSystemNumber, newSystemPrimary, newTransmitInfo2, newPushDate2, newState2, newSystemNumber2, newSystemPrimary2, newTransmitInfo3, newPushDate3, newState3, newSystemNumber3, newSystemPrimary3, newTransmitInfo4, newPushDate4, newState4, newSystemNumber4, newSystemPrimary4, businessDate, refundedAt, businessType, def1, def2, def3, def4, def5, def6, def7, def8, def9, def10, def11, def12, def13, def14, def15, def16, def17, def18, def19, def20, def21, def22, def23, def24, def25, def26, def27, def28, def29, def30, def31, def32, def33, def34, def35, def36, def37, def38, def39, def40)
    values
    <foreach collection="list" item="entity" separator=",">
    (#{entity.receiptid},#{entity.receiptcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.sourceordercode},#{entity.sourcelinenum},#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.skucode},#{entity.skuname},#{entity.requestqty},#{entity.receivedqty},#{entity.openqty},#{entity.quantityum},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalamount},#{entity.weightum},#{entity.volumeum},#{entity.inventorysts},#{entity.intransinvid},#{entity.closed},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.discountprice},#{entity.maintableid},#{entity.newtransmitinfo},#{entity.newpushdate},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary},#{entity.newtransmitinfo2},#{entity.newpushdate2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2},#{entity.newtransmitinfo3},#{entity.newpushdate3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3},#{entity.newtransmitinfo4},#{entity.newpushdate4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4},#{entity.businessdate},#{entity.refundedat},#{entity.businesstype},#{entity.def1},#{entity.def2},#{entity.def3},#{entity.def4},#{entity.def5},#{entity.def6},#{entity.def7},#{entity.def8},#{entity.def9},#{entity.def10},#{entity.def11},#{entity.def12},#{entity.def13},#{entity.def14},#{entity.def15},#{entity.def16},#{entity.def17},#{entity.def18},#{entity.def19},#{entity.def20},#{entity.def21},#{entity.def22},#{entity.def23},#{entity.def24},#{entity.def25},#{entity.def26},#{entity.def27},#{entity.def28},#{entity.def29},#{entity.def30},#{entity.def31},#{entity.def32},#{entity.def33},#{entity.def34},#{entity.def35},#{entity.def36},#{entity.def37},#{entity.def38},#{entity.def39},#{entity.def40})
    </foreach>
</insert>

<!-- 批量新增或者修改，TOC、TOB 退货-同步基本底表数据-->
<insert id="entityInsertOrUpdateBatch" keyProperty="id" useGeneratedKeys="true">
    insert into tocofs_returngoods_detailed(id,receiptId, receiptCode, refOrderId, refOrderDetailId, sourceOrderCode, sourceLineNum, clientCode, companyCode, facilityCode, skuCode, skuName, requestQty, receivedQty, openQty, quantityUM, totalWeight, totalVolume, totalVolumeWeight, totalAmount, weightUM, volumeUM, inventorySts, inTransInvId, closed, created, createdBy, lastUpdated, lastUpdatedBy, discountPrice, mainTableId, businessDate, refundedAt, businessType)
    values
    <foreach collection="list" item="entity" separator=",">
    (#{entity.id},#{entity.receiptid},#{entity.receiptcode},#{entity.reforderid},#{entity.reforderdetailid},#{entity.sourceordercode},#{entity.sourcelinenum},#{entity.clientcode},#{entity.companycode},#{entity.facilitycode},#{entity.skucode},#{entity.skuname},#{entity.requestqty},#{entity.receivedqty},#{entity.openqty},#{entity.quantityum},#{entity.totalweight},#{entity.totalvolume},#{entity.totalvolumeweight},#{entity.totalamount},#{entity.weightum},#{entity.volumeum},#{entity.inventorysts},#{entity.intransinvid},#{entity.closed},#{entity.created},#{entity.createdby},#{entity.lastupdated},#{entity.lastupdatedby},#{entity.discountprice},#{entity.maintableid},#{entity.businessdate},#{entity.refundedat},#{entity.businesstype})
    </foreach>
    on duplicate key update
    id = values(id),
    receiptId = values(receiptId),
    receiptCode = values(receiptCode),
    refOrderId = values(refOrderId),
    refOrderDetailId = values(refOrderDetailId),
    sourceOrderCode = values(sourceOrderCode),
    sourceLineNum = values(sourceLineNum),
    clientCode = values(clientCode),
    companyCode = values(companyCode),
    facilityCode = values(facilityCode),
    skuCode = values(skuCode),
    skuName = values(skuName),
    requestQty = values(requestQty),
    receivedQty = values(receivedQty),
    openQty = values(openQty),
    quantityUM = values(quantityUM),
    totalWeight = values(totalWeight),
    totalVolume = values(totalVolume),
    totalVolumeWeight = values(totalVolumeWeight),
    totalAmount = values(totalAmount),
    weightUM = values(weightUM),
    volumeUM = values(volumeUM),
    inventorySts = values(inventorySts),
    inTransInvId = values(inTransInvId),
    closed = values(closed),
    created = values(created),
    createdBy = values(createdBy),
    lastUpdated = values(lastUpdated),
    lastUpdatedBy = values(lastUpdatedBy),
    discountPrice = values(discountPrice),
    mainTableId = values(mainTableId),
    businessDate = values(businessDate),
    refundedAt = values(refundedAt),
    businessType = values(businessType)
</insert>

<!-- 批量新增或者修改，TOC退货-库存-->
<insert id="entityInsertOrUpdateBatchByTocRerturnStock" keyProperty="id" useGeneratedKeys="true">
    insert into tocofs_returngoods_detailed(id,newPushDate3,newTransmitInfo3,newState3,newSystemNumber3,newSystemPrimary3)
    values
    <foreach collection="list" item="entity" separator=",">
        (#{entity.id},#{entity.newpushdate3},#{entity.newtransmitinfo3},#{entity.newstate3},#{entity.newsystemnumber3},#{entity.newsystemprimary3})
    </foreach>
    on duplicate key update
    id = values(id),
    newPushDate3 = values(newPushDate3),
    newTransmitInfo3 = values(newTransmitInfo3),
    newState3 = values(newState3),
    newSystemNumber3 = values(newSystemNumber3),
    newSystemPrimary3 = values(newSystemPrimary3)
</insert>

<!-- 批量新增或者修改，TOC退货-确认收入-->
<insert id="entityInsertOrUpdateBatchByTocRerturnTran" keyProperty="id" useGeneratedKeys="true">
    insert into tocofs_returngoods_detailed(id,newPushDate4,newTransmitInfo4,newState4,newSystemNumber4,newSystemPrimary4)
    values
    <foreach collection="list" item="entity" separator=",">
        (#{entity.id},#{entity.newpushdate4},#{entity.newtransmitinfo4},#{entity.newstate4},#{entity.newsystemnumber4},#{entity.newsystemprimary4})
    </foreach>
    on duplicate key update
    id = values(id),
    newPushDate4 = values(newPushDate4),
    newTransmitInfo4 = values(newTransmitInfo4),
    newState4 = values(newState4),
    newSystemNumber4 = values(newSystemNumber4),
    newSystemPrimary4 = values(newSystemPrimary4)
</insert>

<!-- 批量新增或者修改，TOB退货-库存-->
<insert id="entityInsertOrUpdateBatchByTobRerturnStock" keyProperty="id" useGeneratedKeys="true">
    insert into tocofs_returngoods_detailed(id,newPushDate,newTransmitInfo,newState,newSystemNumber,newSystemPrimary)
    values
    <foreach collection="list" item="entity" separator=",">
        (#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate},#{entity.newsystemnumber},#{entity.newsystemprimary})
    </foreach>
    on duplicate key update
    id = values(id),
    newPushDate = values(newPushDate),
    newTransmitInfo = values(newTransmitInfo),
    newState = values(newState),
    newSystemNumber = values(newSystemNumber),
    newSystemPrimary = values(newSystemPrimary)
</insert>

<!-- 批量新增或者修改，TOB退货-库存-->
<insert id="entityInsertOrUpdateBatchByTobRerturnStockV2" keyProperty="id" useGeneratedKeys="true">
    insert into tocofs_returngoods_detailed(id,newPushDate,newTransmitInfo,newState)
    values
    <foreach collection="list" item="entity" separator=",">
        (#{entity.id},#{entity.newpushdate},#{entity.newtransmitinfo},#{entity.newstate})
    </foreach>
    on duplicate key update
    id = values(id),
    newPushDate = values(newPushDate),
    newTransmitInfo = values(newTransmitInfo),
    newState = values(newState)
</insert>

<!-- 批量新增或者修改，TOB退货-确认收入-->
<insert id="entityInsertOrUpdateBatchByTobRerturnTran" keyProperty="id" useGeneratedKeys="true">
    insert into tocofs_returngoods_detailed(id,newPushDate2,newTransmitInfo2,newState2,newSystemNumber2,newSystemPrimary2)
    values
    <foreach collection="list" item="entity" separator=",">
        (#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2},#{entity.newsystemnumber2},#{entity.newsystemprimary2})
    </foreach>
    on duplicate key update
    id = values(id),
    newPushDate2 = values(newPushDate2),
    newTransmitInfo2 = values(newTransmitInfo2),
    newState2 = values(newState2),
    newSystemNumber2 = values(newSystemNumber2),
    newSystemPrimary2 = values(newSystemPrimary2)
</insert>

<!-- 批量新增或者修改，TOB退货-确认收入-->
<insert id="entityInsertOrUpdateBatchByTobRerturnTranV2" keyProperty="id" useGeneratedKeys="true">
    insert into tocofs_returngoods_detailed(id,newPushDate2,newTransmitInfo2,newState2)
    values
    <foreach collection="list" item="entity" separator=",">
        (#{entity.id},#{entity.newpushdate2},#{entity.newtransmitinfo2},#{entity.newstate2})
    </foreach>
    on duplicate key update
    id = values(id),
    newPushDate2 = values(newPushDate2),
    newTransmitInfo2 = values(newTransmitInfo2),
    newState2 = values(newState2)
</insert>


    <!--通过主键修改方法-->
<update id="entity_update" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity" >
update tocofs_returngoods_detailed  set
<trim suffix="" suffixOverrides=",">
  <if test="receiptid != null and receiptid != ''"> receiptId = #{receiptid},</if>
  <if test="receiptcode != null and receiptcode != ''"> receiptCode = #{receiptcode},</if>
  <if test="reforderid != null and reforderid != ''"> refOrderId = #{reforderid},</if>
  <if test="reforderdetailid != null and reforderdetailid != ''"> refOrderDetailId = #{reforderdetailid},</if>
  <if test="sourceordercode != null and sourceordercode != ''"> sourceOrderCode = #{sourceordercode},</if>
  <if test="sourcelinenum != null and sourcelinenum != ''"> sourceLineNum = #{sourcelinenum},</if>
  <if test="clientcode != null and clientcode != ''"> clientCode = #{clientcode},</if>
  <if test="companycode != null and companycode != ''"> companyCode = #{companycode},</if>
  <if test="facilitycode != null and facilitycode != ''"> facilityCode = #{facilitycode},</if>
  <if test="skucode != null and skucode != ''"> skuCode = #{skucode},</if>
  <if test="skuname != null and skuname != ''"> skuName = #{skuname},</if>
  <if test="requestqty != null and requestqty != ''"> requestQty = #{requestqty},</if>
  <if test="receivedqty != null and receivedqty != ''"> receivedQty = #{receivedqty},</if>
  <if test="openqty != null and openqty != ''"> openQty = #{openqty},</if>
  <if test="quantityum != null and quantityum != ''"> quantityUM = #{quantityum},</if>
  <if test="totalweight != null and totalweight != ''"> totalWeight = #{totalweight},</if>
  <if test="totalvolume != null and totalvolume != ''"> totalVolume = #{totalvolume},</if>
  <if test="totalvolumeweight != null and totalvolumeweight != ''"> totalVolumeWeight = #{totalvolumeweight},</if>
  <if test="totalamount != null and totalamount != ''"> totalAmount = #{totalamount},</if>
  <if test="weightum != null and weightum != ''"> weightUM = #{weightum},</if>
  <if test="volumeum != null and volumeum != ''"> volumeUM = #{volumeum},</if>
  <if test="inventorysts != null and inventorysts != ''"> inventorySts = #{inventorysts},</if>
  <if test="intransinvid != null and intransinvid != ''"> inTransInvId = #{intransinvid},</if>
  <if test="closed != null and closed != ''"> closed = #{closed},</if>
  <if test="created != null and created != ''"> created = #{created},</if>
  <if test="createdby != null and createdby != ''"> createdBy = #{createdby},</if>
  <if test="lastupdated != null and lastupdated != ''"> lastUpdated = #{lastupdated},</if>
  <if test="lastupdatedby != null and lastupdatedby != ''"> lastUpdatedBy = #{lastupdatedby},</if>
  <if test="discountprice != null and discountprice != ''"> discountPrice = #{discountprice},</if>
  <if test="maintableid != null and maintableid != ''"> mainTableId = #{maintableid},</if>
  <if test="newtransmitinfo != null and newtransmitinfo != ''"> newTransmitInfo = #{newtransmitinfo},</if>
  <if test="newpushdate != null and newpushdate != ''"> newPushDate = #{newpushdate},</if>
  <if test="newstate != null and newstate != ''"> newState = #{newstate},</if>
  <if test="newsystemnumber != null and newsystemnumber != ''"> newSystemNumber = #{newsystemnumber},</if>
  <if test="newsystemprimary != null and newsystemprimary != ''"> newSystemPrimary = #{newsystemprimary},</if>
  <if test="newtransmitinfo2 != null and newtransmitinfo2 != ''"> newTransmitInfo2 = #{newtransmitinfo2},</if>
  <if test="newpushdate2 != null and newpushdate2 != ''"> newPushDate2 = #{newpushdate2},</if>
  <if test="newstate2 != null and newstate2 != ''"> newState2 = #{newstate2},</if>
  <if test="newsystemnumber2 != null and newsystemnumber2 != ''"> newSystemNumber2 = #{newsystemnumber2},</if>
  <if test="newsystemprimary2 != null and newsystemprimary2 != ''"> newSystemPrimary2 = #{newsystemprimary2},</if>
  <if test="newtransmitinfo3 != null and newtransmitinfo3 != ''"> newTransmitInfo3 = #{newtransmitinfo3},</if>
  <if test="newpushdate3 != null and newpushdate3 != ''"> newPushDate3 = #{newpushdate3},</if>
  <if test="newstate3 != null and newstate3 != ''"> newState3 = #{newstate3},</if>
  <if test="newsystemnumber3 != null and newsystemnumber3 != ''"> newSystemNumber3 = #{newsystemnumber3},</if>
  <if test="newsystemprimary3 != null and newsystemprimary3 != ''"> newSystemPrimary3 = #{newsystemprimary3},</if>
  <if test="newtransmitinfo4 != null and newtransmitinfo4 != ''"> newTransmitInfo4 = #{newtransmitinfo4},</if>
  <if test="newpushdate4 != null and newpushdate4 != ''"> newPushDate4 = #{newpushdate4},</if>
  <if test="newstate4 != null and newstate4 != ''"> newState4 = #{newstate4},</if>
  <if test="newsystemnumber4 != null and newsystemnumber4 != ''"> newSystemNumber4 = #{newsystemnumber4},</if>
  <if test="newsystemprimary4 != null and newsystemprimary4 != ''"> newSystemPrimary4 = #{newsystemprimary4},</if>
  <if test="businessdate != null and businessdate != ''"> businessDate = #{businessdate},</if>
  <if test="refundedat != null and refundedat != ''"> refundedAt = #{refundedat},</if>
  <if test="businesstype != null and businesstype != ''"> businessType = #{businesstype},</if>
  <if test="def1 != null and def1 != ''"> def1 = #{def1},</if>
  <if test="def2 != null and def2 != ''"> def2 = #{def2},</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="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="def20 != null and def20 != ''"> def20 = #{def20},</if>
  <if test="def21 != null and def21 != ''"> def21 = #{def21},</if>
  <if test="def22 != null and def22 != ''"> def22 = #{def22},</if>
  <if test="def23 != null and def23 != ''"> def23 = #{def23},</if>
  <if test="def24 != null and def24 != ''"> def24 = #{def24},</if>
  <if test="def25 != null and def25 != ''"> def25 = #{def25},</if>
  <if test="def26 != null and def26 != ''"> def26 = #{def26},</if>
  <if test="def27 != null and def27 != ''"> def27 = #{def27},</if>
  <if test="def28 != null and def28 != ''"> def28 = #{def28},</if>
  <if test="def29 != null and def29 != ''"> def29 = #{def29},</if>
  <if test="def30 != null and def30 != ''"> def30 = #{def30},</if>
  <if test="def31 != null and def31 != ''"> def31 = #{def31},</if>
  <if test="def32 != null and def32 != ''"> def32 = #{def32},</if>
  <if test="def33 != null and def33 != ''"> def33 = #{def33},</if>
  <if test="def34 != null and def34 != ''"> def34 = #{def34},</if>
  <if test="def35 != null and def35 != ''"> def35 = #{def35},</if>
  <if test="def36 != null and def36 != ''"> def36 = #{def36},</if>
  <if test="def37 != null and def37 != ''"> def37 = #{def37},</if>
  <if test="def38 != null and def38 != ''"> def38 = #{def38},</if>
  <if test="def39 != null and def39 != ''"> def39 = #{def39},</if>
  <if test="def40 != null and def40 != ''"> def40 = #{def40},</if>
</trim>
where id = #{id}
</update>
<!-- 逻辑删除 -->
<update id="entity_logicDelete" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity" >
update tocofs_returngoods_detailed  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
where id = #{id}
</update>
<!-- 多条件逻辑删除 -->
<update id="entity_logicDelete_Multi_Condition" parameterType = "com.hzya.frame.plugin.lets.ofs.entity.TocofsReturngoodsDetailedEntity" >
update tocofs_returngoods_detailed  set sts= 'N' ,modify_time = #{modify_time},modify_user_id = #{modify_user_id}
 <trim prefix="where" prefixOverrides="and"> 
        <if test="id != null and id != ''"> and id = #{id} </if>
            <if test="receiptid != null and receiptid != ''"> and receiptId = #{receiptid} </if>
            <if test="receiptcode != null and receiptcode != ''"> and receiptCode = #{receiptcode} </if>
            <if test="reforderid != null and reforderid != ''"> and refOrderId = #{reforderid} </if>
            <if test="reforderdetailid != null and reforderdetailid != ''"> and refOrderDetailId = #{reforderdetailid} </if>
            <if test="sourceordercode != null and sourceordercode != ''"> and sourceOrderCode = #{sourceordercode} </if>
            <if test="sourcelinenum != null and sourcelinenum != ''"> and sourceLineNum = #{sourcelinenum} </if>
            <if test="clientcode != null and clientcode != ''"> and clientCode = #{clientcode} </if>
            <if test="companycode != null and companycode != ''"> and companyCode = #{companycode} </if>
            <if test="facilitycode != null and facilitycode != ''"> and facilityCode = #{facilitycode} </if>
            <if test="skucode != null and skucode != ''"> and skuCode = #{skucode} </if>
            <if test="skuname != null and skuname != ''"> and skuName = #{skuname} </if>
            <if test="requestqty != null and requestqty != ''"> and requestQty = #{requestqty} </if>
            <if test="receivedqty != null and receivedqty != ''"> and receivedQty = #{receivedqty} </if>
            <if test="openqty != null and openqty != ''"> and openQty = #{openqty} </if>
            <if test="quantityum != null and quantityum != ''"> and quantityUM = #{quantityum} </if>
            <if test="totalweight != null and totalweight != ''"> and totalWeight = #{totalweight} </if>
            <if test="totalvolume != null and totalvolume != ''"> and totalVolume = #{totalvolume} </if>
            <if test="totalvolumeweight != null and totalvolumeweight != ''"> and totalVolumeWeight = #{totalvolumeweight} </if>
            <if test="totalamount != null and totalamount != ''"> and totalAmount = #{totalamount} </if>
            <if test="weightum != null and weightum != ''"> and weightUM = #{weightum} </if>
            <if test="volumeum != null and volumeum != ''"> and volumeUM = #{volumeum} </if>
            <if test="inventorysts != null and inventorysts != ''"> and inventorySts = #{inventorysts} </if>
            <if test="intransinvid != null and intransinvid != ''"> and inTransInvId = #{intransinvid} </if>
            <if test="closed != null and closed != ''"> and closed = #{closed} </if>
            <if test="created != null and created != ''"> and created = #{created} </if>
            <if test="createdby != null and createdby != ''"> and createdBy = #{createdby} </if>
            <if test="lastupdated != null and lastupdated != ''"> and lastUpdated = #{lastupdated} </if>
            <if test="lastupdatedby != null and lastupdatedby != ''"> and lastUpdatedBy = #{lastupdatedby} </if>
            <if test="discountprice != null and discountprice != ''"> and discountPrice = #{discountprice} </if>
            <if test="maintableid != null and maintableid != ''"> and mainTableId = #{maintableid} </if>
            <if test="newtransmitinfo != null and newtransmitinfo != ''"> and newTransmitInfo = #{newtransmitinfo} </if>
            <if test="newpushdate != null and newpushdate != ''"> and newPushDate = #{newpushdate} </if>
            <if test="newstate != null and newstate != ''"> and newState = #{newstate} </if>
            <if test="newsystemnumber != null and newsystemnumber != ''"> and newSystemNumber = #{newsystemnumber} </if>
            <if test="newsystemprimary != null and newsystemprimary != ''"> and newSystemPrimary = #{newsystemprimary} </if>
            <if test="newtransmitinfo2 != null and newtransmitinfo2 != ''"> and newTransmitInfo2 = #{newtransmitinfo2} </if>
            <if test="newpushdate2 != null and newpushdate2 != ''"> and newPushDate2 = #{newpushdate2} </if>
            <if test="newstate2 != null and newstate2 != ''"> and newState2 = #{newstate2} </if>
            <if test="newsystemnumber2 != null and newsystemnumber2 != ''"> and newSystemNumber2 = #{newsystemnumber2} </if>
            <if test="newsystemprimary2 != null and newsystemprimary2 != ''"> and newSystemPrimary2 = #{newsystemprimary2} </if>
            <if test="newtransmitinfo3 != null and newtransmitinfo3 != ''"> and newTransmitInfo3 = #{newtransmitinfo3} </if>
            <if test="newpushdate3 != null and newpushdate3 != ''"> and newPushDate3 = #{newpushdate3} </if>
            <if test="newstate3 != null and newstate3 != ''"> and newState3 = #{newstate3} </if>
            <if test="newsystemnumber3 != null and newsystemnumber3 != ''"> and newSystemNumber3 = #{newsystemnumber3} </if>
            <if test="newsystemprimary3 != null and newsystemprimary3 != ''"> and newSystemPrimary3 = #{newsystemprimary3} </if>
            <if test="newtransmitinfo4 != null and newtransmitinfo4 != ''"> and newTransmitInfo4 = #{newtransmitinfo4} </if>
            <if test="newpushdate4 != null and newpushdate4 != ''"> and newPushDate4 = #{newpushdate4} </if>
            <if test="newstate4 != null and newstate4 != ''"> and newState4 = #{newstate4} </if>
            <if test="newsystemnumber4 != null and newsystemnumber4 != ''"> and newSystemNumber4 = #{newsystemnumber4} </if>
            <if test="newsystemprimary4 != null and newsystemprimary4 != ''"> and newSystemPrimary4 = #{newsystemprimary4} </if>
            <if test="businessdate != null and businessdate != ''"> and businessDate = #{businessdate} </if>
            <if test="refundedat != null and refundedat != ''"> and refundedAt = #{refundedat} </if>
            <if test="businesstype != null and businesstype != ''"> and businessType = #{businesstype} </if>
            <if test="def1 != null and def1 != ''"> and def1 = #{def1} </if>
            <if test="def2 != null and def2 != ''"> and def2 = #{def2} </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="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="def20 != null and def20 != ''"> and def20 = #{def20} </if>
            <if test="def21 != null and def21 != ''"> and def21 = #{def21} </if>
            <if test="def22 != null and def22 != ''"> and def22 = #{def22} </if>
            <if test="def23 != null and def23 != ''"> and def23 = #{def23} </if>
            <if test="def24 != null and def24 != ''"> and def24 = #{def24} </if>
            <if test="def25 != null and def25 != ''"> and def25 = #{def25} </if>
            <if test="def26 != null and def26 != ''"> and def26 = #{def26} </if>
            <if test="def27 != null and def27 != ''"> and def27 = #{def27} </if>
            <if test="def28 != null and def28 != ''"> and def28 = #{def28} </if>
            <if test="def29 != null and def29 != ''"> and def29 = #{def29} </if>
            <if test="def30 != null and def30 != ''"> and def30 = #{def30} </if>
            <if test="def31 != null and def31 != ''"> and def31 = #{def31} </if>
            <if test="def32 != null and def32 != ''"> and def32 = #{def32} </if>
            <if test="def33 != null and def33 != ''"> and def33 = #{def33} </if>
            <if test="def34 != null and def34 != ''"> and def34 = #{def34} </if>
            <if test="def35 != null and def35 != ''"> and def35 = #{def35} </if>
            <if test="def36 != null and def36 != ''"> and def36 = #{def36} </if>
            <if test="def37 != null and def37 != ''"> and def37 = #{def37} </if>
            <if test="def38 != null and def38 != ''"> and def38 = #{def38} </if>
            <if test="def39 != null and def39 != ''"> and def39 = #{def39} </if>
            <if test="def40 != null and def40 != ''"> and def40 = #{def40} </if>
            and sts='Y'
    </trim>
</update>
<!--通过主键删除-->
<delete id="entity_delete">
    delete from tocofs_returngoods_detailed where id = #{id}
</delete>

</mapper>

