1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863 |
- <?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.caimei.modules.order.dao.NewShopOrderDao">
- <sql id="shopOrderColumns">
- co.rebateFee as rebateFee,
- co.userBeans as userBeans,
- a.shopOrderID AS shopOrderID,
- a.shopStatus AS status,
- a.shopPostFlag AS shopPostFlag,
- a.orderID AS orderID,
- a.organizeID AS organizeID,
- a.shopOrderNo AS shopOrderNo,
- a.orderNo AS orderNo,
- a.userID AS userID,
- a.shopID AS shopID,
- a.isColdChina AS isColdChina,
- a.itemCount AS itemCount,
- a.townID AS townID,
- a.productAmount AS productAmount,
- a.discountAmount AS discountAmount,
- a.accountAmount AS accountAmount,
- a.totalAmount AS totalAmount,
- a.payFlag AS payFlag,
- a.payTime AS payTime,
- a.finishTime AS finishTime,
- a.refundStatus AS refundStatus,
- a.needPayAmount AS needPayAmount,
- a.splitCode,
- ifnull(a.realPay, a.needPayAmount) AS realPay,
- a.eachDiscount AS eachDiscount,
- IFNULL((SELECT SUM(cror.associateAmount)
- FROM cm_receipt_order_relation cror
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- WHERE cror.shopOrderId = a.shopOrderId
- AND cror.relationType = '2'
- AND cdr.receiptType = 1
- AND cdr.delFlag = 0
- AND cror.delFlag = 0
- AND cdr.receiptStatus IN (2, 3)
- AND cdr.payWay != 3)
- , 0) AS receiptAmount,
- (ifnull(a.realPay,a.needPayAmount) - ifnull(a.receiptAmount,0)) as restAmount,
- a.receiptStatus as shopReceiptStatus,
- a.receiptStatus as ReceiptStatus,
- a.canRefundAmount AS canRefundAmount,
- a.refundAmount AS refundAmount,
- a.clubID AS clubID,
- a.spID AS spID,
- a.mainSpID AS mainSpID,
- a.orderBeanAmount AS orderBeanAmount,
- a.useBeanAmount AS useBeanAmount,
- a.useBeanFlag AS useBeanFlag,
- a.canRefundFlag AS canRefundFlag,
- a.useBalanceFlag AS useBalanceFlag,
- a.canRefundBeans AS canRefundBeans,
- a.freePostageFee AS freePostageFee,
- a.freePostageTicketID AS freePostageTicketID,
- a.brokerage AS brokerage,
- a.delFlag AS delFlag,
- a.refundsAmount AS refundsAmount,
- a.orderStatusFlag AS orderStatusFlag,
- a.buyStatus AS buyStatus,
- a.orderSubmitType AS orderSubmitType,
- a.orderType AS orderType,
- a.orderTime AS orderTime,
- a.deliveryTimeMills AS deliveryTimeMills,
- a.presentNum AS presentNum,
- a.preferential AS preferential,
- a.outStoreNum AS outStoreNum,
- IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
- a.splitFlag AS splitFlag,
- a.autoReceiveTimeMills AS autoReceiveTimeMills,
- a.autoOverTimeMills AS autoOverTimeMills,
- a.receiveGoodsTime AS receiveGoodsTime,
- a.totalAddedValueTax AS totalAddedValueTax,
- a.note AS note,
- a.payStatus AS payStatus,
- a.sendOutStatus AS sendOutStatus,
- a.shopProductAmount AS shopProductAmount,
- ifnull(a.shopPostFee, 0) AS shopPostFee,
- ifnull(a.shopTaxFee,0) AS shopTaxFee,
- a.shouldPayShopAmount AS shouldPayShopAmount,
- a.payedShopAmount AS payedShopAmount,
- ifnull(a.shopOtherFee, 0) AS shopOtherFee,
- a.paying AS paying,
- a.costType AS costType,
- a.settleStatus AS settleStatus,
- a.modifyShouldPayNote AS modifyShouldPayNote,
- a.orderPromotionsId AS orderPromotionsId,
- a.differenceType AS differenceType,
- a.differencePrice AS differencePrice,
- a.proportional AS proportional,
- ifnull(a.promotionFullReduction, 0) As promotionFullReduction,
- ifnull(a.couponAmount, 0) As couponAmount,
- a.zeroCostFlag AS zeroCostFlag
- </sql>
- <select id="get" resultType="NewShopOrder" useCache="false" flushCache="true">
- select
- <include refid="shopOrderColumns"/>
- from cm_shop_order a
- left join cm_order co on co.orderID = a.orderID
- where a.shopOrderID = #{shopOrderID}
- </select>
- <delete id="deleteByOrderID">
- DELETE
- FROM cm_shop_order
- WHERE orderID = #{orderID}
- </delete>
- <insert id="insert" parameterType="NewShopOrder" keyProperty="shopOrderID" useGeneratedKeys="true">
- INSERT INTO cm_shop_order(orderID,
- shopOrderNo,
- orderNo,
- userID,
- shopID,
- itemCount,
- townID,
- productAmount,
- discountAmount,
- accountAmount,
- totalAmount,
- payFlag,
- payTime,
- finishTime,
- refundStatus,
- needPayAmount,
- canRefundAmount,
- refundAmount,
- clubID,
- spID,
- mainSpID,
- orderBeanAmount,
- useBeanAmount,
- useBeanFlag,
- canRefundFlag,
- useBalanceFlag,
- canRefundBeans,
- freePostageFee,
- freePostageTicketID,
- brokerage,
- delFlag,
- refundsAmount,
- orderStatusFlag,
- buyStatus,
- orderSubmitType,
- orderType,
- orderTime,
- deliveryTimeMills,
- presentNum,
- preferential,
- splitFlag,
- autoReceiveTimeMills,
- autoOverTimeMills,
- totalAddedValueTax,
- receiveGoodsTime,
- sendOutStatus,
- payStatus,
- costType,
- orderPromotionsId,
- promotionFullReduction,
- zeroCostFlag,
- svipShopReduction,
- realPay,
- eachDiscount,
- receiptStatus,
- receiptAmount,
- splitCode)
- VALUES (#{orderID},
- #{shopOrderNo},
- #{orderNo},
- #{userID},
- #{shopID},
- #{itemCount},
- #{townID},
- #{productAmount},
- #{discountAmount},
- #{accountAmount},
- #{totalAmount},
- #{payFlag},
- #{payTime},
- #{finishTime},
- #{refundStatus},
- #{needPayAmount},
- #{canRefundAmount},
- #{refundAmount},
- #{clubID},
- #{spID},
- #{mainSpID},
- #{orderBeanAmount},
- #{useBeanAmount},
- #{useBeanFlag},
- #{canRefundFlag},
- #{useBalanceFlag},
- #{canRefundBeans},
- #{freePostageFee},
- #{freePostageTicketID},
- #{brokerage},
- #{delFlag},
- #{refundsAmount},
- #{orderStatusFlag},
- #{buyStatus},
- #{orderSubmitType},
- #{orderType},
- #{orderTime},
- #{deliveryTimeMills},
- #{presentNum},
- #{preferential},
- #{splitFlag},
- #{autoReceiveTimeMills},
- #{autoOverTimeMills},
- #{totalAddedValueTax},
- #{receiveGoodsTime},
- #{sendOutStatus},
- #{payStatus},
- #{costType},
- #{orderPromotionsId},
- #{promotionFullReduction},
- #{zeroCostFlag},
- #{svipShopReduction},
- #{realPay},
- #{eachDiscount},
- #{shopReceiptStatus},
- #{receiptAmount},
- #{splitCode})
- </insert>
- <select id="findByShopOrderID" resultType="newShopOrder">
- select
- <include refid="shopOrderColumns"/>
- ,bou.shouHuoRen as receiver,
- bou.mobile,
- bou.name as buyer,
- ifnull(co.orderSeen,1) as orderSeen,
- co.orderSource,
- co.rebateFlag as rebateOrder,
- co.clauseID,
- co.clauseName,
- s.name as shopName
- from cm_shop_order a
- left join cm_order co on co.orderID = a.orderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join shop s on a.shopId = s.shopId
- where a.shopOrderID = #{shopOrderID}
- </select>
- <select id="findByPayShopID" resultType="java.lang.Double">
- SELECT SUM(cpsr.payAmount)
- FROM cm_pay_shop cps
- LEFT JOIN cm_pay_shop_record cpsr ON cpsr.payShopID = cps.id
- WHERE cpsr.delFlag = 0
- AND cps.delFlag = 0
- AND cpsr.shopOrderId = #{shopOrderID}
- </select>
- <select id="findList" resultType="newShopOrder">
- SELECT
- <include refid="shopOrderColumns"/>
- FROM cm_shop_order a
- left join cm_order co on co.orderID = a.orderID
- <where>
- <if test="shopOrderNo != null and itemCount != ''">
- AND a.shopOrderNo = #{shopOrderNo}
- </if>
- <if test="orderNo != null and itemCount != ''">
- AND a.orderNo = #{orderNo}
- </if>
- <if test="orderID != null and itemCount != ''">
- AND a.orderID = #{orderID}
- </if>
- <if test="userID != null and itemCount != ''">
- AND a.userID = #{userID}
- </if>
- <if test="shopID != null and itemCount != ''">
- AND a.shopID = #{shopID}
- </if>
- <if test="payFlag != null and itemCount != ''">
- AND a.payFlag = #{payFlag}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findListByOrderID" resultType="newShopOrder">
- SELECT<include refid="shopOrderColumns"/>,
- b.name as shopName,
- oa.id as orderArchiveId,
- co.receiptStatus,
- (SELECT SUM(num) FROM cm_order_product WHERE shoporderid=29760 AND productType = 2) as presentNum
- FROM cm_shop_order a
- left join shop b on a.shopID = b.shopID
- left join cm_order_archive oa on a.shopOrderID = oa.shopOrderId
- left join cm_order co on co.orderID = a.orderID
- WHERE a.orderID = #{orderID} ORDER BY a.shopOrderNo DESC
- </select>
- <select id="getFreightAmount" resultType="java.lang.Double">
- SELECT ifnull(SUM(cfr.freightAmount), 0)
- FROM cm_freight_rule cfr
- LEFT JOIN cm_freight_template cft ON cft.id = cfr.freightId
- LEFT JOIN product p ON p.freightTemplateId = cft.id
- WHERE productId = #{productId}
- and cft.delFlag = 0
- </select>
- <select id="getShopOrderId" resultType="com.caimei.modules.product.entity.Shop">
- select shopId, AccountOwnership, bankAccount
- from shop
- where shopId = #{shopId}
- </select>
- <select id="findCommercialCode" resultType="String">
- select commercialCode
- FROM cm_shop_order a
- left join cm_shop_splitcode css on a.shopID = css.shopId
- WHERE a.orderID = #{orderID}
- </select>
- <update id="update" parameterType="newShopOrder">
- update cm_shop_order
- <set>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- shopOrderNo = #{shopOrderNo},
- </if>
- <if test="status != null and status != ''">
- shopStatus = #{status},
- </if>
- <if test="confirmTime != null and confirmTime != ''">
- confirmTime = #{confirmTime},
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- orderID = #{orderID},
- </if>
- <if test="orderNo != null and orderNo != ''">
- orderNo = #{orderNo},
- </if>
- <if test="userID != null and userID != ''">
- userID = #{userID},
- </if>
- <if test="shopID != null and shopID != ''">
- shopID = #{shopID},
- </if>
- <if test="itemCount != null and itemCount != ''">
- itemCount = #{itemCount},
- </if>
- <if test="townID != null and itemCount != ''">
- townID = #{townID,jdbcType=INTEGER},
- </if>
- <if test="productAmount != null and productAmount != ''">
- productAmount = #{productAmount},
- </if>
- <if test="discountAmount != null and discountAmount != ''">
- discountAmount = #{discountAmount},
- </if>
- <if test="accountAmount != null and accountAmount != ''">
- accountAmount = #{accountAmount},
- </if>
- <if test="totalAmount != null and totalAmount != ''">
- totalAmount = #{totalAmount},
- </if>
- <if test="payFlag != null and payFlag != ''">
- payFlag = #{payFlag},
- </if>
- <if test="payTime != null and payTime != ''">
- payTime = #{payTime},
- </if>
- <if test="finishTime != null and finishTime != ''">
- finishTime = #{finishTime},
- </if>
- <if test="refundStatus != null and refundStatus != ''">
- refundStatus = #{refundStatus},
- </if>
- <if test="needPayAmount != null and needPayAmount != ''">
- needPayAmount = #{needPayAmount},
- </if>
- <if test="canRefundAmount != null and canRefundAmount != ''">
- canRefundAmount = #{canRefundAmount},
- </if>
- <if test="refundAmount != null and refundAmount != ''">
- refundAmount = #{refundAmount},
- </if>
- <if test="clubID != null and clubID != ''">
- clubID = #{clubID},
- </if>
- <if test="spID != null and itemCount != ''">
- spID = #{spID,jdbcType=INTEGER},
- </if>
- <if test="mainSpID != null and mainSpID != ''">
- mainSpID = #{mainSpID},
- </if>
- <if test="orderBeanAmount != null and orderBeanAmount != ''">
- orderBeanAmount = #{orderBeanAmount},
- </if>
- <if test="useBeanAmount != null and useBeanAmount != ''">
- useBeanAmount = #{useBeanAmount},
- </if>
- <if test="useBeanFlag != null and useBeanFlag != ''">
- useBeanFlag = #{useBeanFlag},
- </if>
- <if test="canRefundFlag != null and canRefundFlag != ''">
- canRefundFlag = #{canRefundFlag},
- </if>
- <if test="useBalanceFlag != null and useBalanceFlag != ''">
- useBalanceFlag = #{useBalanceFlag},
- </if>
- <if test="canRefundBeans != null and canRefundBeans != ''">
- canRefundBeans = #{canRefundBeans},
- </if>
- <if test="freePostageFee != null and freePostageFee != ''">
- freePostageFee = #{freePostageFee},
- </if>
- <if test="freePostageTicketID != null and freePostageTicketID != ''">
- freePostageTicketID = #{freePostageTicketID},
- </if>
- <if test="brokerage != null and brokerage != ''">
- brokerage = #{brokerage},
- </if>
- <if test="delFlag != null and delFlag != ''">
- delFlag = #{delFlag},
- </if>
- <if test="refundsAmount != null and refundsAmount != ''">
- refundsAmount = #{refundsAmount},
- </if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">
- orderStatusFlag = #{orderStatusFlag},
- </if>
- <if test="buyStatus != null and buyStatus != ''">
- buyStatus = #{buyStatus},
- </if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">
- deliveryTimeMills = #{deliveryTimeMills},
- </if>
- <if test="orderSubmitType != null and orderSubmitType != ''">
- orderSubmitType = #{orderSubmitType},
- </if>
- <if test="orderType != null and orderType != ''">
- orderType = #{orderType},
- </if>
- <if test="orderTime != null and orderTime != ''">
- orderTime = #{orderTime},
- </if>
- <if test="presentNum != null and presentNum != ''">
- presentNum = #{presentNum},
- </if>
- <if test="preferential != null and preferential != ''">
- preferential = #{preferential},
- </if>
- <if test="outStoreNum != null and outStoreNum != ''">
- outStoreNum = #{outStoreNum},
- </if>
- <if test="outStoreTimes != null and outStoreTimes != ''">
- outStoreTimes = #{outStoreTimes},
- </if>
- <if test="splitFlag != null and splitFlag != ''">
- splitFlag = #{splitFlag},
- </if>
- <if test="autoReceiveTimeMills != null and autoReceiveTimeMills != ''">
- autoReceiveTimeMills = #{autoReceiveTimeMills},
- </if>
- <if test="autoOverTimeMills != null and autoOverTimeMills != ''">
- autoOverTimeMills = #{autoOverTimeMills},
- </if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">
- receiveGoodsTime = #{receiveGoodsTime},
- </if>
- <if test="totalAddedValueTax != null and totalAddedValueTax != ''">
- totalAddedValueTax = #{totalAddedValueTax},
- </if>
- <if test="note != null and note != ''">
- note = #{note},
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">
- sendOutStatus = #{sendOutStatus},
- </if>
- <if test="paying != null and paying != ''">
- paying = #{paying},
- </if>
- <if test="shopProductAmount != null">
- shopProductAmount = #{shopProductAmount},
- </if>
- <if test="shopPostFee != null">
- shopPostFee = #{shopPostFee},
- </if>
- <if test="shopTaxFee != null">
- shopTaxFee = #{shopTaxFee},
- </if>
- <if test="shouldPayShopAmount != null">
- shouldPayShopAmount = #{shouldPayShopAmount},
- </if>
- <if test="payedShopAmount != null">
- payedShopAmount = #{payedShopAmount},
- </if>
- <if test="shopOtherFee != null">
- shopOtherFee = #{shopOtherFee},
- </if>
- <if test="payStatus != null">
- payStatus = #{payStatus},
- </if>
- <if test="costType != null">
- costType = #{costType},
- </if>
- <if test="proportional != null">
- proportional = #{proportional},
- </if>
- <if test="modifyShouldPayNote != null">
- modifyShouldPayNote = #{modifyShouldPayNote},
- </if>
- <if test="modifyShouldPayUserID != null">
- modifyShouldPayUserID = #{modifyShouldPayUserID},
- </if>
- <if test="modifyShouldPayDate != null">
- modifyShouldPayDate = #{modifyShouldPayDate},
- </if>
- <if test="orderPromotionsId != null">
- orderPromotionsId = #{orderPromotionsId},
- </if>
- <if test="promotionFullReduction != null">
- promotionFullReduction = #{promotionFullReduction},
- </if>
- <if test="zeroCostFlag != null">
- zeroCostFlag = #{zeroCostFlag},
- </if>
- <if test="svipShopReduction != null">
- svipShopReduction = #{svipShopReduction},
- </if>
- <if test="realPay != null">
- realPay = #{realPay},
- </if>
- <if test="eachDiscount != null">
- eachDiscount = #{eachDiscount},
- </if>
- <if test="receiptStatus != null">
- receiptStatus = #{receiptStatus},
- </if>
- <if test="receiptAmount != null">
- receiptAmount = #{receiptAmount},
- </if>
- <if test="splitCode != null">
- splitCode = #{splitCode},
- </if>
- <if test="supplierFreight != null">
- supplierFreight = #{supplierFreight},
- </if>
- <if test="rebateOrder != null">
- rebateOrder = #{rebateOrder},
- </if>
- </set>
- <where>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND shopOrderID = #{shopOrderID}
- </if>
- <if test="orderID != null and orderID != ''">
- AND orderID = #{orderID}
- </if>
- </where>
- </update>
- <delete id="delete">
- DELETE
- FROM cm_shop_order
- WHERE shopOrderID = #{shopOrderID}
- </delete>
- <select id="findIDsByOrderID" resultType="int">
- select shopOrderID
- from cm_shop_order
- where orderID = #{orderID}
- </select>
- <update id="updateNote">
- UPDATE cm_shop_order
- SET note = #{note}
- WHERE shopOrderID = #{shopOrderID}
- </update>
- <select id="findShopOrderNum" resultType="int">
- select count(1)
- from cm_shop_order
- where orderID = #{orderID}
- </select>
- <update id="updateByShopOrderID" parameterType="newShopOrder">
- update cm_shop_order
- <set>
- <if test="status != null and status != ''">
- shopStatus = #{status},
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- shopOrderNo = #{shopOrderNo},
- </if>
- <if test="orderID != null and orderID != ''">
- orderID = #{orderID},
- </if>
- <if test="orderNo != null and orderNo != ''">
- orderNo = #{orderNo},
- </if>
- <if test="userID != null and userID != ''">
- userID = #{userID},
- </if>
- <if test="shopID != null and shopID != ''">
- shopID = #{shopID},
- </if>
- <if test="itemCount != null and itemCount != ''">
- itemCount = #{itemCount},
- </if>
- <if test="townID != null and itemCount != ''">
- townID = #{townID,jdbcType=INTEGER},
- </if>
- <if test="productAmount != null and productAmount != ''">
- productAmount = #{productAmount},
- </if>
- <if test="discountAmount != null and discountAmount != ''">
- discountAmount = #{discountAmount},
- </if>
- <if test="accountAmount != null and accountAmount != ''">
- accountAmount = #{accountAmount},
- </if>
- <if test="totalAmount != null and totalAmount != ''">
- totalAmount = #{totalAmount},
- </if>
- <if test="payFlag != null and payFlag != ''">
- payFlag = #{payFlag},
- </if>
- <if test="payTime != null and payTime != ''">
- payTime = #{payTime},
- </if>
- <if test="finishTime != null and finishTime != ''">
- finishTime = #{finishTime},
- </if>
- <if test="refundStatus != null and refundStatus != ''">
- refundStatus = #{refundStatus},
- </if>
- <if test="needPayAmount != null and needPayAmount != ''">
- needPayAmount = #{needPayAmount},
- </if>
- <if test="canRefundAmount != null and canRefundAmount != ''">
- canRefundAmount = #{canRefundAmount},
- </if>
- <if test="refundAmount != null and refundAmount != ''">
- refundAmount = #{refundAmount},
- </if>
- <if test="clubID != null and clubID != ''">
- clubID = #{clubID},
- </if>
- <if test="spID != null and itemCount != ''">
- spID = #{spID,jdbcType=INTEGER},
- </if>
- <if test="mainSpID != null and mainSpID != ''">
- mainSpID = #{mainSpID},
- </if>
- <if test="orderBeanAmount != null and orderBeanAmount != ''">
- orderBeanAmount = #{orderBeanAmount},
- </if>
- <if test="useBeanAmount != null and useBeanAmount != ''">
- useBeanAmount = #{useBeanAmount},
- </if>
- <if test="useBeanFlag != null and useBeanFlag != ''">
- useBeanFlag = #{useBeanFlag},
- </if>
- <if test="canRefundFlag != null and canRefundFlag != ''">
- canRefundFlag = #{canRefundFlag},
- </if>
- <if test="useBalanceFlag != null and useBalanceFlag != ''">
- useBalanceFlag = #{useBalanceFlag},
- </if>
- <if test="canRefundBeans != null and canRefundBeans != ''">
- canRefundBeans = #{canRefundBeans},
- </if>
- <if test="freePostageFee != null and freePostageFee != ''">
- freePostageFee = #{freePostageFee},
- </if>
- <if test="freePostageTicketID != null and freePostageTicketID != ''">
- freePostageTicketID = #{freePostageTicketID},
- </if>
- <if test="brokerage != null and brokerage != ''">
- brokerage = #{brokerage},
- </if>
- <if test="delFlag != null and delFlag != ''">
- delFlag = #{delFlag},
- </if>
- <if test="refundsAmount != null and refundsAmount != ''">
- refundsAmount = #{refundsAmount},
- </if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">
- orderStatusFlag = #{orderStatusFlag},
- </if>
- <if test="buyStatus != null and buyStatus != ''">
- buyStatus = #{buyStatus},
- </if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">
- deliveryTimeMills = #{deliveryTimeMills},
- </if>
- <if test="orderSubmitType != null and orderSubmitType != ''">
- orderSubmitType = #{orderSubmitType},
- </if>
- <if test="orderType != null and orderType != ''">
- orderType = #{orderType},
- </if>
- <if test="orderTime != null and orderTime != ''">
- orderTime = #{orderTime},
- </if>
- <if test="presentNum != null and presentNum != ''">
- presentNum = #{presentNum},
- </if>
- <if test="preferential != null and preferential != ''">
- preferential = #{preferential},
- </if>
- <if test="outStoreNum != null and outStoreNum != ''">
- outStoreNum = #{outStoreNum},
- </if>
- <if test="outStoreTimes != null and outStoreTimes != ''">
- outStoreTimes = #{outStoreTimes},
- </if>
- <if test="splitFlag != null and splitFlag != ''">
- splitFlag = #{splitFlag},
- </if>
- <if test="autoReceiveTimeMills != null and autoReceiveTimeMills != ''">
- autoReceiveTimeMills = #{autoReceiveTimeMills},
- </if>
- <if test="autoOverTimeMills != null and autoOverTimeMills != ''">
- autoOverTimeMills = #{autoOverTimeMills},
- </if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">
- receiveGoodsTime = #{receiveGoodsTime},
- </if>
- <if test="totalAddedValueTax != null and totalAddedValueTax != ''">
- totalAddedValueTax = #{totalAddedValueTax},
- </if>
- <if test="note != null and note != ''">
- note = #{note},
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">
- sendOutStatus = #{sendOutStatus}
- </if>
- </set>
- where shopOrderID = #{shopOrderID}
- </update>
- <select id="findPayOrderList" resultType="newShopOrder">
- select<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- a.supplierFreight as supplierFreight,
- a.rebateOrder as rebateOrder,
- bou.name AS buyer,
- s.name AS shopName,
- c.name AS clubName,
- a.onlinePayWays,
- ifnull(a.cmAccountType,0) as cmAccountType,
- cdr.payWay AS payWay
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- left join shop s on s.shopID = a.shopID
- LEFT JOIN club c ON c.userID = a.userID
- <where>
- (s.shopId = 1161 OR s.AccountOwnership = 0 OR a.splitCode = 'E1807059160' or a.ordertype = 2)
- and a.shopStatus not in (4, 5)
- <if test="startTime != null and startTime != ''">
- AND (a.orderTime > #{startTime} OR a.orderTime = #{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND (a.orderTime < #{endTime} OR a.orderTime = #{endTime})
- </if>
- <if test="orderID != null and orderID != ''">
- AND a.orderID = #{orderID}
- </if>
- <if test="organizeID != null and organizeID != 9999">
- AND co.organizeID = #{organizeID}
- </if>
- <if test="organizeID == 9999 ">
- AND co.orderType = 2
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND a.orderNo like concat('%', #{orderNo} ,'%')
- </if>
- <if test="ps != null and ps.length>0 ">
- AND a.payStatus in
- <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name like concat('%', #{shopName} ,'%')
- </if>
- <if test="buyer != null and buyer != ''">
- AND bou.name like concat('%', #{buyer} ,'%')
- </if>
- <if test="clubName != null and clubName != ''">
- AND c.name like concat('%', #{clubName} ,'%')
- </if>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND a.shopOrderID = #{shopOrderID}
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
- </if>
- <if test="operatingMode != null and operatingMode == '1'.toString()">
- and a.payStatus != 3 and co.status NOT IN (6,7)
- </if>
- <if test="operatingMode != null and operatingMode == '2'.toString()">
- and a.payStatus != 1 and co.status != 6
- </if>
- <if test="operatingMode != null and operatingMode == '3'.toString()">
- and a.payStatus = 3 and co.status NOT IN (6,7)
- </if>
- and a.shopStatus != 0
- and co.delFlag = 0
- -- and not (co.secondHandOrderFlag=1 AND co.rebateFlag=1)
- and a.delFlag = 0
- and (a.organizeID!=4 or a.organizeID is null)
- and a.shopID != 998
- and co.orderID not in (
- SELECT orderID FROM cm_order_product WHERE productID IN
- (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069) GROUP BY orderID
- )
- </where>
- group by a.shopOrderID
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="payThirdParties" resultType="newShopOrder">
- select<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- bou.name AS buyer,
- s.name AS shopName,
- c.name AS clubName,
- cdr.payWay AS payWay
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- left join shop s on s.shopID = a.shopID
- LEFT JOIN club c ON c.userID = a.userID
- <where>
- s.name NOT LIKE '%综合供应商%'
- AND s.AccountOwnership = 1
- AND cdr.payWay = 2
- AND a.receiptStatus != 1
- <if test="startTime != null and startTime != ''">
- AND (a.orderTime > #{startTime} OR a.orderTime = #{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND (a.orderTime < #{endTime} OR a.orderTime = #{endTime})
- </if>
- <if test="orderID != null and orderID != ''">
- AND a.orderID = #{orderID}
- </if>
- <if test="organizeID != null and organizeID != 9999">
- AND co.organizeID = #{organizeID}
- </if>
- <if test="organizeID == 9999 ">
- AND co.orderType = 2
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND a.orderNo like concat('%', #{orderNo} ,'%')
- </if>
- <if test="ps != null and ps.length>0 ">
- AND a.payStatus in
- <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name like concat('%', #{shopName} ,'%')
- </if>
- <if test="buyer != null and buyer != ''">
- AND bou.name like concat('%', #{buyer} ,'%')
- </if>
- <if test="clubName != null and clubName != ''">
- AND c.name like concat('%', #{clubName} ,'%')
- </if>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND a.shopOrderID = #{shopOrderID}
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
- </if>
- -- and (co.confirmFlag = '1' or co.confirmFlag = '2')
- and a.shopStatus = '1'
- <if test="operatingMode != null and operatingMode == '1'.toString()">
- and a.payStatus != 3 and co.status NOT IN (6,7)
- </if>
- <if test="operatingMode != null and operatingMode == '2'.toString()">
- and a.payStatus != 1 and co.status != 6
- </if>
- <if test="operatingMode != null and operatingMode == '3'.toString()">
- and a.payStatus = 3 and co.status NOT IN (6,7)
- </if>
- and co.delFlag = 0
- -- and not (co.secondHandOrderFlag=1 AND co.rebateFlag=1)
- and a.delFlag = 0
- and (a.organizeID!=4 or a.organizeID is null)
- and a.shopID != 998
- and co.orderID not in (
- SELECT orderID FROM cm_order_product WHERE productID IN
- (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069) GROUP BY orderID
- )
- </where>
- group by a.shopOrderID
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="findShopOrderList" resultType="newShopOrder">
- select<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- bou.name AS buyer,
- s.name AS shopName,
- c.name AS clubName,
- cdr.payWay AS payWay,
- a.onlinePayWays,
- ifnull(cmAccountType,0) as cmAccountType,
- ifnull(cmShopOtherFee,0) as cmShopOtherFee,
- (select sum((num+presentNum)*cmCostPrice) from cm_order_product where shopOrderId = a.shopOrderId) as
- allServeAmount
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- left join shop s on s.shopID = a.shopID
- LEFT JOIN club c ON c.userID = a.userID
- <where>
- (s.shopId = 1161 OR s.AccountOwnership = 0 OR a.splitCode = 'E1807059160' or a.ordertype = 2)
- <if test="startTime != null and startTime != ''">
- AND (a.orderTime > #{startTime} OR a.orderTime = #{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND (a.orderTime < #{endTime} OR a.orderTime = #{endTime})
- </if>
- <if test="orderID != null and orderID != ''">
- AND a.orderID = #{orderID}
- </if>
- <if test="organizeID != null and organizeID != 9999">
- AND co.organizeID = #{organizeID}
- </if>
- <if test="organizeID == 9999 ">
- AND co.orderType = 2
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND a.orderNo like concat('%', #{orderNo} ,'%')
- </if>
- <if test="ps != null and ps.length>0 ">
- AND a.payStatus in
- <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="receiptStatus != null and receiptStatus!= ''">
- AND a.receiptStatus = #{receiptStatus}
- </if>
- <if test="refundStatus !=null and refundStatus != ''">
- AND a.refundStatus = #{refundStatus}
- </if>
- <if test="settleStatus != null and settleStatus!= ''">
- AND a.settleStatus = #{settleStatus}
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name like concat('%', #{shopName} ,'%')
- </if>
- <if test="buyer != null and buyer != ''">
- AND bou.name like concat('%', #{buyer} ,'%')
- </if>
- <if test="clubName != null and clubName != ''">
- AND c.name like concat('%', #{clubName} ,'%')
- </if>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND a.shopOrderID = #{shopOrderID}
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
- </if>
- and co.delFlag = 0
- -- and not (co.secondHandOrderFlag=1 AND co.rebateFlag=1)
- and a.delFlag = 0
- and (a.organizeID!=4 or a.organizeID is null)
- and a.shopID != 998
- and co.orderID not in (
- SELECT orderID FROM cm_order_product WHERE productID IN
- (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069) GROUP BY orderID
- )
- </where>
- group by a.shopOrderID
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="payAmountByShopOrderId" resultType="java.lang.Double">
- SELECT IFNULL(SUM(cpsr.payAmount), 0)
- FROM cm_pay_shop cps
- LEFT JOIN cm_pay_shop_record cpsr ON cps.id = cpsr.payShopID
- WHERE cps.delFlag = 0
- AND cpsr.delFlag = 0
- AND cpsr.shopOrderID = #{shopOrderId}
- </select>
- <select id="settleAmountByShopOrderId" resultType="java.lang.Double">
- SELECT IFNULL(SUM(settleAmount), 0)
- FROM cm_settle_record
- WHERE shopOrderId = #{shopOrderId}
- </select>
- <select id="payShopAmountShopOrderId" resultType="java.lang.Double">
- SELECT IFNULL(SUM(cpsr.payCmAmount), 0)
- FROM cm_pay_shop cps
- LEFT JOIN cm_pay_shop_record cpsr ON cps.id = cpsr.payShopID
- WHERE cpsr.delFlag = 0
- AND cpsr.shopOrderID = 29478
- </select>
- <select id="returnedPurchaseFeeByShopOrderId" resultType="java.lang.Double">
- SELECT IFNULL(SUM(crp.returnedPurchaseFee), 0)
- FROM cm_returned_purchase crp
- LEFT JOIN cm_returned_purchase_product crpp ON crp.id = crpp.returnedID
- WHERE crp.delFlag = 0
- AND crp.status = 2
- AND crp.shopOrderId = #{shopOrderId}
- </select>
- <select id="findSplitCount" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM cm_split_account
- WHERE shopOrderId = #{shopOrderId}
- </select>
- <select id="findPayOrderListByIDs" resultType="newShopOrder">
- select distinct<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- co.promotionFullReduction,
- bou.name AS buyer,
- s.name AS shopName,
- (select sum((num+presentNum)*cmCostPrice) from cm_order_product where shopOrderId = a.shopOrderId) as
- allServeAmount
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- left join shop s on s.shopID = a.shopID
- <where>
- <if test="ids != null and ids != ''">
- and a.shopOrderID in
- <foreach collection="ids" open="(" close=")" item="id" separator=",">
- #{id}
- </foreach>
- </if>
- </where>
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="findByRefundID" resultType="newShopOrder">
- select distinct<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- bou.name AS buyer,
- s.name AS shopName
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- left join shop s on s.shopID = a.shopID
- where a.shopOrderID in
- (select crsr.shopOrderID
- from cm_refund_shop_record crsr
- left join cm_refund_shop crs on crsr.refundShopID = crs.id
- where crs.id = #{refundShopID} and crsr.shopOrderID is not null)
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="updatePayShopAmount">
- UPDATE cm_shop_order
- <set>
- <if test="shopProductAmount != null">
- shopProductAmount = #{shopProductAmount},
- </if>
- <if test="shopPostFee != null">
- shopPostFee = #{shopPostFee},
- </if>
- <if test="shopTaxFee != null">
- shopTaxFee = #{shopTaxFee},
- </if>
- <if test="shouldPayShopAmount != null">
- shouldPayShopAmount = #{shouldPayShopAmount},
- </if>
- <if test="shopOtherFee != null">
- shopOtherFee = #{shopOtherFee},
- </if>
- <if test="payStatus != null">
- payStatus = #{payStatus},
- </if>
- <if test="payedShopAmount != null">
- payedShopAmount = #{payedShopAmount}
- </if>
- <if test="status != null and status != ''">
- shopStatus = #{status},
- </if>
- </set>
- WHERE shopOrderID = #{shopOrderID}
- </select>
- <select id="findByShopOrderIDs" resultType="newShopOrder">
- select distinct<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- co.promotionFullReduction AS promotionFullReduction,
- a.onlinePayWays,
- ifnull(a.cmAccountType,0) as cmAccountType,
- ifnull(a.cmShopOtherFee,0) as cmShopOtherFee,
- bou.name AS buyer,
- s.name AS shopName,
- c.name AS clubName
- from cm_shop_order a
- left join cm_pay_shop_record cpsr on a.shopOrderID = cpsr.shopOrderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join cm_order co on co.orderID = a.orderID
- left join shop s on s.shopID = a.shopID
- left join club c on c.userID = a.userID
- <if test="shopOrderIDs != null and shopOrderIDs.size() > 0">
- where a.shopOrderID in
- <foreach collection="shopOrderIDs" separator="," item="shopOrderID" open="(" close=")">
- #{shopOrderID}
- </foreach>
- </if>
- </select>
- <update id="updatePaying">
- update cm_shop_order
- set paying = #{paying}
- where shopOrderID = #{shopOrderID}
- </update>
- <update id="outPaying">
- update cm_shop_order
- set paying = '0'
- where shopOrderID in
- (select cpsr.shopOrderID
- from cm_pay_shop_record cpsr
- left join cm_pay_shop cps on cps.id = cpsr.payShopID
- where cps.id = #{payShopID}
- and cps.delFlag = '0'
- and cpsr.delFlag = '0'
- and cpsr.shopOrderID is not null)
- </update>
- <update id="inPaying">
- update cm_shop_order
- set paying = '1'
- where shopOrderID in
- (select cpsr.shopOrderID
- from cm_pay_shop_record cpsr
- left join cm_pay_shop cps on cps.id = cpsr.payShopID
- where cps.id = #{payShopID}
- and cps.delFlag = '0'
- and cpsr.delFlag = '0'
- and cpsr.shopOrderID is not null)
- </update>
- <update id="updatePayStatus">
- update cm_shop_order
- set payStatus = #{payStatus}
- where shopOrderID = #{shopOrderID}
- </update>
- <select id="findPayStatusByOrderID" resultType="string">
- select payStatus
- from cm_shop_order
- where orderID = #{orderID}
- AND shopID != 998
- </select>
- <select id="getPayingStatus" resultType="string">
- select ifnull(paying, '0')
- from cm_shop_order
- where shopOrderID in
- (select cpsr.shopOrderID
- from cm_pay_shop_record cpsr
- left join cm_pay_shop cps on cps.id = cpsr.payShopID
- where cps.id = #{payShopID}
- and cps.delFlag = '0'
- and cpsr.delFlag = '0'
- and cpsr.shopOrderID is not null)
- </select>
- <select id="findSiblingPostFeeOrder" resultType="newShopOrder">
- select
- <include refid="shopOrderColumns"/>
- from cm_shop_order a
- left join cm_order co on co.orderID = a.orderID
- where a.orderID = #{orderID} and a.shopID = 998
- </select>
- <select id="findShopOrderNos" resultType="java.lang.String">
- SELECT CONCAT(shopOrderNo, '(', shopOrderID, ')') AS result
- FROM cm_shop_order
- WHERE orderID = #{orderID}
- and shopId != 998
- </select>
- <select id="findIncome" resultType="java.lang.Double">
- SELECT ROUND(IFNULL((
- co.payTotalFee - (IFNULL((SELECT ROUND(SUM((IFNULL(op.costPrice, 0) *
- (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0))) +
- IFNULL(op.shouldPayTotalTax, 0)),
- 2)
- FROM cm_order_product op
- LEFT JOIN cm_shop_order cso ON cso.shopOrderID = op.shopOrderID
- WHERE cso.orderID = co.orderID
- AND op.productID != 999
- GROUP BY cso.orderID), 0))
- - (SELECT IFNULL(SUM(cso.shopOtherFee), 0)
- FROM cm_shop_order cso
- WHERE cso.orderID = co.orderID)
- - IFNULL((SELECT SUM(shopPostFee + IF(differenceType = 1, differencePrice, 0) -
- IF(differenceType = 2, differencePrice, 0))
- FROM cm_shop_order
- WHERE orderID = co.orderID), 0)
- + IFNULL((SELECT SUM(cpsr.wipePayment)
- FROM cm_pay_shop_record cpsr
- WHERE cpsr.shopOrderID IN (SELECT cso.shopOrderID
- FROM cm_shop_order cso
- WHERE cso.orderID = co.orderID)
- AND cpsr.delFlag = 0
- AND (cpsr.`status` = 1 OR cpsr.`status` = 0)), 0)
- + IFNULL(co.rebateFee, 0)
- ), 0), 2) AS "采美总佣金"
- FROM cm_order co
- WHERE co.orderID = #{orderID}
- </select>
- <update id="updateByShopOtherFee">
- UPDATE cm_shop_order
- SET shopOtherFee = #{shopOtherFee}
- WHERE shopOrderID = #{shopOrderId}
- </update>
- <update id="updateByDifferencePrice">
- UPDATE cm_shop_order
- SET differenceType = #{type},
- differencePrice = #{differencePrice}
- WHERE shopOrderID = #{shopOrderId}
- </update>
- <select id="findSplitList" resultType="newShopOrder">
- SELECT co.couponAmount AS couponAmount,
- co.userBeans AS userBeans,
- a.shopOrderID AS shopOrderID,
- a.orderID AS orderID,
- a.organizeID AS organizeID,
- a.shopOrderNo AS shopOrderNo,
- a.orderNo AS orderNo,
- a.userID AS userID,
- a.shopID AS shopID,
- a.itemCount AS itemCount,
- a.townID AS townID,
- a.productAmount AS productAmount,
- a.discountAmount AS discountAmount,
- a.accountAmount AS accountAmount,
- a.totalAmount AS totalAmount,
- a.payFlag AS payFlag,
- a.payTime AS payTime,
- a.finishTime AS finishTime,
- a.refundStatus AS refundStatus,
- a.needPayAmount AS needPayAmount,
- a.canRefundAmount AS canRefundAmount,
- a.refundAmount AS refundAmount,
- a.clubID AS clubID,
- a.spID AS spID,
- a.mainSpID AS mainSpID,
- a.orderBeanAmount AS orderBeanAmount,
- a.useBeanAmount AS useBeanAmount,
- a.useBeanFlag AS useBeanFlag,
- a.canRefundFlag AS canRefundFlag,
- a.useBalanceFlag AS useBalanceFlag,
- a.canRefundBeans AS canRefundBeans,
- a.freePostageFee AS freePostageFee,
- a.freePostageTicketID AS freePostageTicketID,
- a.brokerage AS brokerage,
- a.delFlag AS delFlag,
- a.refundsAmount AS refundsAmount,
- a.orderStatusFlag AS orderStatusFlag,
- a.buyStatus AS buyStatus,
- a.orderSubmitType AS orderSubmitType,
- a.orderType AS orderType,
- a.orderTime AS orderTime,
- a.deliveryTimeMills AS deliveryTimeMills,
- a.presentNum AS presentNum,
- a.preferential AS preferential,
- a.outStoreNum AS outStoreNum,
- IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
- a.splitFlag AS splitFlag,
- a.autoReceiveTimeMills AS autoReceiveTimeMills,
- a.autoOverTimeMills AS autoOverTimeMills,
- a.receiveGoodsTime AS receiveGoodsTime,
- a.totalAddedValueTax AS totalAddedValueTax,
- a.note AS note,
- a.payStatus AS payStatus,
- a.sendOutStatus AS sendOutStatus,
- a.shopProductAmount AS shopProductAmount,
- a.shopPostFee AS shopPostFee,
- a.shopTaxFee AS shopTaxFee,
- a.shouldPayShopAmount AS shouldPayShopAmount,
- a.payedShopAmount AS payedShopAmount,
- a.shopOtherFee AS shopOtherFee,
- a.paying AS paying,
- a.costType AS costType,
- a.modifyShouldPayNote AS modifyShouldPayNote,
- a.orderPromotionsId AS orderPromotionsId,
- a.differenceType AS differenceType,
- a.differencePrice AS differencePrice,
- a.proportional AS proportional,
- a.promotionFullReduction AS promotionFullReduction,
- a.zeroCostFlag AS zeroCostFlag,
- co.payTotalFee AS payTotalFee,
- co.status AS STATUS,
- bou.name AS buyer,
- s.name AS shopName,
- c.name AS clubName,
- a.onlinePayWays,
- ifnull(a.cmShopOtherFee,0) as cmShopOtherFee,
- ifnull(a.cmAccountType,0) as cmAccountType
- FROM cm_shop_order a
- LEFT JOIN cm_pay_shop_record cpsr ON a.shopOrderID = cpsr.shopOrderID
- LEFT JOIN bp_order_userinfo bou ON bou.orderId = a.orderID
- LEFT JOIN cm_order co ON co.orderID = a.orderID
- LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- LEFT JOIN shop s ON s.shopID = a.shopID
- LEFT JOIN club c ON c.userID = a.userID
- WHERE co.organizeID = 0
- AND a.refundStatus = 1
- AND co.delFlag = 0
- AND co.orderType != 2
- AND a.delFlag = 0
- AND a.shopID != 998
- AND (a.organizeID != 4 or a.organizeID is null)
- AND cdr.payWay = 1
- AND cdr.receiptDate <![CDATA[ <= ]]> NOW()
- AND cror.relationType = 2
- AND cror.delFlag = 0
- AND cror.mbOrderId IS NOT NULL
- AND cror.splitStatus = 0
- AND a.receiptStatus = 3
- AND a.splitCode != 'E1807059160'
- AND co.orderID NOT IN (SELECT orderID
- FROM cm_order_product
- WHERE productID IN
- (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069)
- GROUP BY orderID)
- GROUP BY a.shopOrderID
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="getOpenidListByPermission" resultType="java.lang.String">
- SELECT openid
- FROM `wechat_user`
- WHERE unionid = #{unionid}
- </select>
- <select id="FromUnionId" resultType="java.lang.String">
- SELECT unionID
- FROM `cm_order`
- WHERE orderID = #{orderId}
- </select>
- <select id="UnionId" resultType="java.lang.String">
- SELECT unionID
- FROM `cm_order`
- WHERE userID = #{userID}
- ORDER BY orderID DESC
- LIMIT 1
- </select>
- <select id="getProductOrder" resultType="java.lang.String">
- SELECT productID
- FROM `cm_order_product`
- WHERE orderID = #{orderid}
- </select>
- <select id="payWay" resultType="java.lang.Integer">
- SELECT cdr.payWay
- FROM cm_shop_order a
- LEFT JOIN cm_order co ON co.orderID = a.orderID
- LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- WHERE a.shopOrderID = #{shopOrderID}
- </select>
- <select id="findSettlementList" resultType="com.caimei.modules.order.entity.NewShopOrder">
- SELECT co.couponAmount AS couponAmount,
- co.userBeans AS userBeans,
- a.shopOrderID AS shopOrderID,
- a.orderID AS orderID,
- a.organizeID AS organizeID,
- a.shopOrderNo AS shopOrderNo,
- a.orderNo AS orderNo,
- a.userID AS userID,
- a.shopID AS shopID,
- a.itemCount AS itemCount,
- a.townID AS townID,
- a.productAmount AS productAmount,
- a.discountAmount AS discountAmount,
- a.accountAmount AS accountAmount,
- a.totalAmount AS totalAmount,
- a.payFlag AS payFlag,
- a.payTime AS payTime,
- a.finishTime AS finishTime,
- a.refundStatus AS refundStatus,
- a.needPayAmount AS needPayAmount,
- a.canRefundAmount AS canRefundAmount,
- a.refundAmount AS refundAmount,
- a.clubID AS clubID,
- a.spID AS spID,
- a.mainSpID AS mainSpID,
- a.orderBeanAmount AS orderBeanAmount,
- a.useBeanAmount AS useBeanAmount,
- a.useBeanFlag AS useBeanFlag,
- a.canRefundFlag AS canRefundFlag,
- a.useBalanceFlag AS useBalanceFlag,
- a.canRefundBeans AS canRefundBeans,
- a.freePostageFee AS freePostageFee,
- a.freePostageTicketID AS freePostageTicketID,
- a.brokerage AS brokerage,
- a.delFlag AS delFlag,
- a.refundsAmount AS refundsAmount,
- a.orderStatusFlag AS orderStatusFlag,
- a.buyStatus AS buyStatus,
- a.orderSubmitType AS orderSubmitType,
- a.orderType AS orderType,
- a.orderTime AS orderTime,
- a.deliveryTimeMills AS deliveryTimeMills,
- a.presentNum AS presentNum,
- a.preferential AS preferential,
- a.outStoreNum AS outStoreNum,
- IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
- a.splitFlag AS splitFlag,
- a.autoReceiveTimeMills AS autoReceiveTimeMills,
- a.autoOverTimeMills AS autoOverTimeMills,
- a.receiveGoodsTime AS receiveGoodsTime,
- a.totalAddedValueTax AS totalAddedValueTax,
- a.note AS note,
- a.payStatus AS payStatus,
- a.sendOutStatus AS sendOutStatus,
- a.shopProductAmount AS shopProductAmount,
- a.shopPostFee AS shopPostFee,
- a.shopTaxFee AS shopTaxFee,
- a.shouldPayShopAmount AS shouldPayShopAmount,
- a.payedShopAmount AS payedShopAmount,
- a.shopOtherFee AS shopOtherFee,
- a.paying AS paying,
- a.costType AS costType,
- a.modifyShouldPayNote AS modifyShouldPayNote,
- a.orderPromotionsId AS orderPromotionsId,
- a.differenceType AS differenceType,
- a.differencePrice AS differencePrice,
- a.proportional AS proportional,
- a.promotionFullReduction AS promotionFullReduction,
- a.zeroCostFlag AS zeroCostFlag,
- a.settleStatus AS settleStatus,
- co.payTotalFee AS payTotalFee,
- co.status AS STATUS,
- bou.name AS buyer,
- s.name AS shopName,
- c.name AS clubName,
- a.onlinePayWays,
- ifnull(a.cmAccountType,0) as cmAccountType,
- ifnull(a.a.cmShopOtherFee,0) as cmShopOtherFee
- FROM cm_shop_order a
- LEFT JOIN cm_pay_shop_record cpsr ON a.shopOrderID = cpsr.shopOrderID
- LEFT JOIN bp_order_userinfo bou ON bou.orderId = a.orderID
- LEFT JOIN cm_order co ON co.orderID = a.orderID
- LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- LEFT JOIN cm_split_account csa on csa.shopOrderId = a.shopOrderID
- LEFT JOIN shop s ON s.shopID = a.shopID
- LEFT JOIN club c ON c.userID = a.userID
- WHERE co.organizeID = 0
- AND co.refundType != 2
- AND co.delFlag = 0
- AND co.orderType != 2
- AND co.receiptStatus = 3
- AND a.delFlag = 0
- AND a.refundStatus = 1
- AND a.shopID != 998
- AND (a.organizeID!=4 or a.organizeID is null)
- AND cdr.payWay = 1
- AND cror.relationType = 2
- AND a.settleStatus in (1,2)
- AND csa.settleStatus = 0
- AND cror.delFlag = 0
- AND cror.mbOrderId IS NOT NULL
- AND cror.splitStatus = 1
- AND a.splitCode != 'E1807059160'
- <if test="startTime != null and startTime != ''">
- AND (a.orderTime > #{startTime} OR a.orderTime = #{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND (a.orderTime < #{endTime} OR a.orderTime = #{endTime})
- </if>
- <if test="orderID != null and orderID != ''">
- AND a.orderID = #{orderID}
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND a.orderNo like concat('%', #{orderNo} ,'%')
- </if>
- <if test="ps != null and ps.length>0 ">
- AND a.settleStatus in
- <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name like concat('%', #{shopName} ,'%')
- </if>
- <if test="clubName != null and clubName != ''">
- AND c.name like concat('%', #{clubName} ,'%')
- </if>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND a.shopOrderID = #{shopOrderID}
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
- </if>
- GROUP BY a.shopOrderID
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="findSettleRecord" resultType="com.caimei.modules.order.entity.SettleRecord">
- select settleAmount, settleType, settleTime
- from cm_settle_record
- where shopOrderId = #{shopOrderID}
- </select>
- <select id="findListByShopOrderId" resultType="com.caimei.modules.order.entity.NewShopOrder">
- SELECT<include refid="shopOrderColumns"/>,
- b.name as shopName,
- oa.id as orderArchiveId,
- co.receiptStatus
- FROM cm_shop_order a
- left join shop b on a.shopID = b.shopID
- left join cm_order_archive oa on a.shopOrderID = oa.shopOrderId
- left join cm_order co on co.orderID = a.orderID
- WHERE a.shopOrderId = #{onlineShopOrderId}
- ORDER BY a.shopOrderNo DESC
- </select>
- <resultMap type="com.caimei.modules.order.entity.NewShopOrder" id="CmShopOrderResult">
- <result property="shopOrderID" column="shopOrderID"/>
- <result property="shopOrderNo" column="shopOrderNo"/>
- <result property="orderNo" column="orderNo"/>
- <result property="orderID" column="orderID"/>
- <result property="organizeID" column="organizeID"/>
- <result property="isColdChina" column="isColdChina"/>
- <result property="userID" column="userID"/>
- <result property="shopID" column="shopID"/>
- <result property="orderPromotionsId" column="orderPromotionsId"/>
- <result property="orderType" column="orderType"/>
- <result property="orderSubmitType" column="orderSubmitType"/>
- <result property="presentNum" column="presentNum"/>
- <result property="itemCount" column="itemCount"/>
- <result property="outStoreNum" column="outStoreNum"/>
- <result property="outStoreTimes" column="outStoreTimes"/>
- <result property="townID" column="townID"/>
- <result property="note" column="note"/>
- <result property="eachDiscount" column="eachDiscount"/>
- <result property="realPay" column="realPay"/>
- <result property="receiptAmount" column="receiptAmount"/>
- <result property="accountAmount" column="accountAmount"/>
- <result property="productAmount" column="productAmount"/>
- <result property="totalAmount" column="totalAmount"/>
- <result property="needPayAmount" column="needPayAmount"/>
- <result property="discountAmount" column="discountAmount"/>
- <result property="preferential" column="preferential"/>
- <result property="promotionFullReduction" column="promotionFullReduction"/>
- <result property="payFlag" column="payFlag"/>
- <result property="orderTime" column="orderTime"/>
- <result property="payTime" column="payTime"/>
- <result property="finishTime" column="finishTime"/>
- <result property="autoOverTimeMills" column="autoOverTimeMills"/>
- <result property="settleStatus" column="settleStatus"/>
- <result property="payStatus" column="payStatus"/>
- <result property="receiptStatus" column="receiptStatus"/>
- <result property="sendOutStatus" column="sendOutStatus"/>
- <result property="refundStatus" column="refundStatus"/>
- <result property="returnGoodsStatus" column="returnGoodsStatus"/>
- <result property="receiveGoodsTime" column="receiveGoodsTime"/>
- <result property="autoReceiveTimeMills" column="autoReceiveTimeMills"/>
- <result property="totalAddedValueTax" column="totalAddedValueTax"/>
- <result property="canRefundAmount" column="canRefundAmount"/>
- <result property="refundAmount" column="refundAmount"/>
- <result property="clubID" column="clubID"/>
- <result property="spID" column="spID"/>
- <result property="mainSpID" column="mainSpID"/>
- <result property="orderBeanAmount" column="orderBeanAmount"/>
- <result property="useBeanAmount" column="useBeanAmount"/>
- <result property="useBeanFlag" column="useBeanFlag"/>
- <result property="canRefundFlag" column="canRefundFlag"/>
- <result property="useBalanceFlag" column="useBalanceFlag"/>
- <result property="canRefundBeans" column="canRefundBeans"/>
- <result property="freePostageFee" column="freePostageFee"/>
- <result property="freePostageTicketID" column="freePostageTicketID"/>
- <result property="brokerage" column="brokerage"/>
- <result property="delFlag" column="delFlag"/>
- <result property="refundsAmount" column="refundsAmount"/>
- <result property="orderStatusFlag" column="orderStatusFlag"/>
- <result property="buyStatus" column="buyStatus"/>
- <result property="deliveryTimeMills" column="deliveryTimeMills"/>
- <result property="orderDeliveryID" column="orderDeliveryID"/>
- <result property="splitFlag" column="splitFlag"/>
- <result property="paying" column="paying"/>
- <result property="shopProductAmount" column="shopProductAmount"/>
- <result property="shopPostFee" column="shopPostFee"/>
- <result property="shopPostFlag" column="shopPostFlag"/>
- <result property="shopTaxFee" column="shopTaxFee"/>
- <result property="payCmAmount" column="payCmAmount"/>
- <result property="shouldPayShopAmount" column="shouldPayShopAmount"/>
- <result property="payedShopAmount" column="payedShopAmount"/>
- <result property="shopOtherFee" column="shopOtherFee"/>
- <result property="receiptedFlag" column="receiptedFlag"/>
- <result property="receiptedType" column="receiptedType"/>
- <result property="costType" column="costType"/>
- <result property="proportional" column="proportional"/>
- <result property="modifyShouldPayNote" column="modifyShouldPayNote"/>
- <result property="modifyShouldPayUserID" column="modifyShouldPayUserID"/>
- <result property="modifyShouldPayDate" column="modifyShouldPayDate"/>
- <result property="zeroCostFlag" column="zeroCostFlag"/>
- <result property="differenceType" column="differenceType"/>
- <result property="differencePrice" column="differencePrice"/>
- <result property="svipShopReduction" column="svipShopReduction"/>
- <result property="splitCode" column="splitCode"/>
- <result property="paySuccessCounter" column="paySuccessCounter"/>
- <result property="onlinePayWays" column="onlinePayWays"/>
- <result property="status" column="shopStatus"/>
- </resultMap>
- <sql id="selectCmShopOrderVo">
- select cm_shop_order.shopOrderID,
- cm_shop_order.shopOrderNo,
- cm_shop_order.orderNo,
- cm_shop_order.orderID,
- cm_shop_order.organizeID,
- cm_shop_order.isColdChina,
- cm_shop_order.userID,
- cm_shop_order.shopID,
- cm_shop_order.orderPromotionsId,
- cm_shop_order.orderType,
- cm_shop_order.orderSubmitType,
- cm_shop_order.presentNum,
- cm_shop_order.itemCount,
- cm_shop_order.outStoreNum,
- cm_shop_order.outStoreTimes,
- cm_shop_order.townID,
- cm_shop_order.note,
- ifnull(cm_shop_order.accountAmount, 0) AS accountAmount,
- ifnull(cm_shop_order.productAmount, 0) AS productAmount,
- ifnull(cm_shop_order.totalAmount, 0) AS totalAmount,
- ifnull(cm_shop_order.needPayAmount, 0) AS needPayAmount,
- ifnull(cm_shop_order.discountAmount, 0) AS discountAmount,
- ifnull(cm_shop_order.preferential, 0) AS preferential,
- ifnull(cm_shop_order.promotionFullReduction, 0) AS promotionFullReduction,
- cm_shop_order.payFlag,
- cm_shop_order.orderTime,
- cm_shop_order.payTime,
- cm_shop_order.finishTime,
- cm_shop_order.autoOverTimeMills,
- cm_shop_order.settleStatus,
- cm_shop_order.payStatus,
- cm_shop_order.sendOutStatus,
- cm_shop_order.refundStatus,
- cm_shop_order.shopStatus,
- cm_shop_order.returnGoodsStatus,
- cm_shop_order.receiveGoodsTime,
- cm_shop_order.autoReceiveTimeMills,
- ifnull(cm_shop_order.totalAddedValueTax, 0) AS totalAddedValueTax,
- cm_shop_order.canRefundAmount,
- cm_shop_order.refundAmount,
- cm_shop_order.clubID,
- cm_shop_order.spID,
- cm_shop_order.mainSpID,
- cm_shop_order.orderBeanAmount,
- cm_shop_order.useBeanAmount,
- cm_shop_order.useBeanFlag,
- cm_shop_order.canRefundFlag,
- cm_shop_order.useBalanceFlag,
- cm_shop_order.canRefundBeans,
- ifnull(cm_shop_order.freePostageFee, 0) AS freePostageFee,
- cm_shop_order.freePostageTicketID,
- ifnull(cm_shop_order.brokerage, 0) AS brokerage,
- cm_shop_order.delFlag,
- ifnull(cm_shop_order.refundsAmount, 0) AS refundsAmount,
- cm_shop_order.orderStatusFlag,
- cm_shop_order.buyStatus,
- cm_shop_order.deliveryTimeMills,
- cm_shop_order.confirmTime,
- cm_shop_order.updateTime,
- cm_shop_order.orderDeliveryID,
- cm_shop_order.splitFlag,
- cm_shop_order.receiptedFlag,
- cm_shop_order.receiptedType,
- cm_shop_order.paying,
- ifnull(cm_shop_order.shopProductAmount, 0) AS shopProductAmount,
- ifnull(cm_shop_order.shopPostFee, 0) AS shopPostFee,
- cm_shop_order.shopPostFlag,
- ifnull(cm_shop_order.shopTaxFee, 0) AS shopTaxFee,
- ifnull(cm_shop_order.payCmAmount, 0) AS payCmAmount,
- ifnull(cm_shop_order.shouldPayShopAmount, 0) AS shouldPayShopAmount,
- ifnull(cm_shop_order.payedShopAmount, 0) AS payedShopAmount,
- ifnull(cm_shop_order.shopOtherFee, 0) AS shopOtherFee,
- cm_shop_order.costType,
- ifnull(cm_shop_order.proportional, 0) AS proportional,
- cm_shop_order.modifyShouldPayNote,
- cm_shop_order.modifyShouldPayUserID,
- cm_shop_order.modifyShouldPayDate,
- cm_shop_order.zeroCostFlag,
- cm_shop_order.differenceType,
- ifnull(cm_shop_order.differencePrice, 0) AS differencePrice,
- ifnull(cm_shop_order.svipShopReduction, 0) AS svipShopReduction,
- ifnull(cm_shop_order.shopRefundAmount, 0) AS shopRefundAmount,
- cm_shop_order.splitCode,
- cm_shop_order.paySuccessCounter,
- cm_shop_order.onlinePayWays,
- cm_shop_order.receiptStatus,
- ifnull(cm_shop_order.receiptAmount, 0) AS receiptAmount,
- ifnull(cm_shop_order.eachDiscount, 0) AS eachDiscount,
- ifnull(cm_shop_order.realPay, 0) AS realPay,
- cm_shop_order.discountFee,
- cm_shop_order.fee
- </sql>
- <select id="getByCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder"
- resultMap="CmShopOrderResult">
- <include refid="selectCmShopOrderVo"/>
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- order by cm_shop_order.orderTime desc
- limit 0,1
- </select>
- <select id="getCmShopOrderList" parameterType="com.caimei.modules.order.entity.NewShopOrder"
- resultMap="CmShopOrderResult">
- <include refid="selectCmShopOrderVo"/>
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- order by cm_shop_order.orderTime desc
- </select>
- <select id="getCmShopOrderCount" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
- select count(1)
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- </select>
- <select id="getCmShopOrderByShopOrderID" parameterType="String" resultMap="CmShopOrderResult">
- <include refid="selectCmShopOrderVo"/>
- from cm_shop_order AS cm_shop_order
- where cm_shop_order.delFlag = 0 and cm_shop_order.shopOrderID = #{shopOrderID}
- </select>
- <select id="getByIds" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
- select shopOrderID
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- </select>
- <select id="getById" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
- select shopOrderID
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- limit 0,1
- </select>
- <select id="getShopOrderlist" resultType="com.caimei.modules.order.entity.NewShopOrder">
- select cso.shopOrderID,
- cso.shopOrderNo,
- cso.orderId,
- cso.orderNo,
- cso.organizeID,
- cso.userID,
- cso.clubID,
- cso.orderType,
- bou.shouHuoRen AS receiver,
- co.orderSource,
- cso.needPayAmount,
- cso.orderTime,
- cso.confirmTime,
- cso.payStatus,
- cso.sendOutStatus,
- cso.receiptStatus,
- cso.refundStatus,
- cso.shopStatus,
- u.name AS buyer,
- (case when co.orderType = '0' then
- (select case status when 91 then '采美默认协销经理(官方账号)' else linkMan end from serviceprovider where serviceProviderID
- = co.spID)
- else
- ''
- end) AS spName,
- co.rebateFlag,
- cso.closeTime,
- (SELECT COUNT(*) FROM cm_returned_purchase
- WHERE shopOrderId = cso.shopOrderId AND status =1 AND delFLag = 0) AS returnedPurchaseStatus,
- co.closeReason AS closeReason
- from cm_shop_order cso
- left join cm_order co on cso.orderId = co.orderId
- left join bp_order_userinfo bou on bou.orderId = cso.orderId
- <if test="productName != null and productName != ''">
- LEFT JOIN cm_order_product cop ON co.orderID = cop.orderID
- LEFT JOIN product p ON cop.productID = p.productID
- </if>
- LEFT JOIN user u ON u.userID = cso.userID
- <where>
- cso.delFlag = 0
- and co.delflag = 0
- and cso.orderType != 2
- <if test="serviceProviderId != null and serviceProviderId != 0">
- and cso.orderType = 0
- and co.spID = #{serviceProviderId}
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- AND cso.shopOrderNo = #{shopOrderNo}
- </if>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND cso.shopOrderID = #{shopOrderID}
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND cso.orderNo = #{orderNo}
- </if>
- <if test="orderID != null and orderID != ''">
- AND cso.orderID = #{orderID}
- </if>
- <if test="buyer != null and buyer != ''">
- AND u.name LIKE concat('%',#{buyer},'%')
- </if>
- <if test="status != null">
- AND cso.shopStatus = #{status}
- </if>
- <if test="productName != null and productName != ''">
- and p.name like CONCAT('%',#{productName},'%')
- </if>
- <if test="receiptStatus != null and receiptStatus != ''">
- AND cso.receiptStatus = #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">
- AND cso.sendOutStatus = #{sendOutStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">
- AND cso.payStatus = #{payStatus}
- </if>
- <if test="refundStatus != null and refundStatus != ''">
- AND cso.refundStatus = #{refundStatus}
- </if>
- <if test="orderType != null">
- AND cso.orderType = #{orderType}
- </if>
- <if test="spID != null and spID != ''">
- AND co.spId = #{spID}
- </if>
- <if test="rebateFlag != null and rebateFlag != ''">
- AND co.rebateFlag = #{rebateFlag}
- </if>
- <if test="orderSource != null and orderSource != ''">
- AND co.orderSource = #{orderSource}
- </if>
- <if test="organizeID != null and organizeID != ''">
- AND cso.organizeID = #{organizeID}
- </if>
- <if test="receiver != null and receiver != ''">
- AND bou.shouHuoRen LIKE concat('%',#{receiver},'%')
- </if>
- <if test="startTime != null and startTime != ''">
- AND cso.orderTime <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND cso.orderTime <![CDATA[ <= ]]> #{endTime}
- </if>
- <if test="startConfirmTime != null and startConfirmTime != ''">
- AND cso.confirmTime <![CDATA[ >= ]]> #{startConfirmTime}
- </if>
- <if test="endConfirmTime != null and endConfirmTime != ''">
- AND cso.confirmTime <![CDATA[ <= ]]> #{endConfirmTime}
- </if>
- <if test="returnedPurchaseStatus != null and returnedPurchaseStatus != ''">
- AND
- <if test="returnedPurchaseStatus == 1">
- exists
- </if>
- <if test="returnedPurchaseStatus == 0">
- not exists
- </if>
- (select 1 from cm_returned_purchase
- where status = 1 and shopOrderId = cso.shopOrderId and delFlag= 0)
- </if>
- </where>
- ORDER BY cso.shopOrderID DESC
- </select>
- <select id="findCmProfit" resultType="com.caimei.modules.order.entity.OtherFeeDto">
- select IF((SELECT SUM(cdr.receiptAmount)
- FROM cm_discern_receipt cdr
- LEFT JOIN cm_receipt_order_relation cror ON cdr.id = cror.receiptId
- WHERE cdr.receiptType IN (10, 11)
- AND cdr.receiptStatus NOT IN (1, 4, 5)
- AND cdr.delflag = 0
- AND cror.shopOrderId = acso.shopOrderId) > 0, 0,
- (SELECT acso.needpayAmount
- - SUM(IFNULL(op.costprice, 0) * (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0)))
- - SUM(IFNULL(op.organizeCostPrice, 0) * (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0)))
- - SUM(IFNULL(op.cmCostPrice, 0) * (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0)))
- - (IFNULL(SUM(acso.shopPostFee +
- IF(acso.differenceType = 1, acso.differencePrice, 0) -
- IF(acso.differenceType = 2, acso.differencePrice, 0)),
- 0))
- FROM cm_order_product op
- WHERE op.shopOrderId = acso.shopOrderId)) as cmProfit,
- acso.onlinePayWays,
- ifnull(acso.cmAccountType,0) as cmAccountType
- from cm_shop_order acso
- where acso.shopOrderId = #{shopOrderId}
- </select>
- <insert id="addCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder" useGeneratedKeys="true"
- keyProperty="shopOrderID">
- insert into cm_shop_order
- <trim prefix="(" suffix=")" suffixOverrides=",">
- <if test="shopOrderID != null and shopOrderID != ''">shopOrderID,</if>
- <if test="shopOrderNo != null and shopOrderNo != ''">shopOrderNo,</if>
- <if test="orderNo != null and orderNo != ''">orderNo,</if>
- <if test="orderID != null">orderID,</if>
- <if test="organizeID != null">organizeID,</if>
- <if test="isColdChina != null">isColdChina,</if>
- <if test="userID != null">userID,</if>
- <if test="shopID != null">shopID,</if>
- <if test="orderPromotionsId != null">orderPromotionsId,</if>
- <if test="orderType != null">orderType,</if>
- <if test="orderSubmitType != null">orderSubmitType,</if>
- <if test="presentNum != null">presentNum,</if>
- <if test="itemCount != null">itemCount,</if>
- <if test="outStoreNum != null">outStoreNum,</if>
- <if test="outStoreTimes != null">outStoreTimes,</if>
- <if test="townID != null">townID,</if>
- <if test="note != null and note != ''">note,</if>
- <if test="eachDiscount != null">eachDiscount,</if>
- <if test="realPay != null">realPay,</if>
- <if test="receiptAmount != null">receiptAmount,</if>
- <if test="accountAmount != null">accountAmount,</if>
- <if test="productAmount != null">productAmount,</if>
- <if test="totalAmount != null">totalAmount,</if>
- <if test="needPayAmount != null">needPayAmount,</if>
- <if test="discountAmount != null">discountAmount,</if>
- <if test="preferential != null">preferential,</if>
- <if test="promotionFullReduction != null">promotionFullReduction,</if>
- <if test="payFlag != null and payFlag != ''">payFlag,</if>
- <if test="orderTime != null and orderTime != ''">orderTime,</if>
- <if test="payTime != null and payTime != ''">payTime,</if>
- <if test="finishTime != null and finishTime != ''">finishTime,</if>
- <if test="autoOverTimeMills != null">autoOverTimeMills,</if>
- <if test="settleStatus != null and settleStatus != ''">settleStatus,</if>
- <if test="payStatus != null and payStatus != ''">payStatus,</if>
- <if test="receiptStatus != null and receiptStatus != ''">receiptStatus,</if>
- <if test="sendOutStatus != null and sendOutStatus != ''">sendOutStatus,</if>
- <if test="refundStatus != null">refundStatus,</if>
- <if test="returnGoodsStatus != null">returnGoodsStatus,</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">receiveGoodsTime,</if>
- <if test="autoReceiveTimeMills != null">autoReceiveTimeMills,</if>
- <if test="totalAddedValueTax != null">totalAddedValueTax,</if>
- <if test="canRefundAmount != null">canRefundAmount,</if>
- <if test="refundAmount != null">refundAmount,</if>
- <if test="clubID != null">clubID,</if>
- <if test="spID != null">spID,</if>
- <if test="mainSpID != null">mainSpID,</if>
- <if test="orderBeanAmount != null">orderBeanAmount,</if>
- <if test="useBeanAmount != null">useBeanAmount,</if>
- <if test="useBeanFlag != null">useBeanFlag,</if>
- <if test="canRefundFlag != null">canRefundFlag,</if>
- <if test="useBalanceFlag != null">useBalanceFlag,</if>
- <if test="canRefundBeans != null">canRefundBeans,</if>
- <if test="freePostageFee != null">freePostageFee,</if>
- <if test="freePostageTicketID != null">freePostageTicketID,</if>
- <if test="brokerage != null">brokerage,</if>
- <if test="delFlag != null and delFlag != ''">delFlag,</if>
- <if test="refundsAmount != null">refundsAmount,</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">orderStatusFlag,</if>
- <if test="buyStatus != null and buyStatus != ''">buyStatus,</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">deliveryTimeMills,</if>
- <if test="orderDeliveryID != null">orderDeliveryID,</if>
- <if test="splitFlag != null and splitFlag != ''">splitFlag,</if>
- <if test="paying != null and paying != ''">paying,</if>
- <if test="shopProductAmount != null">shopProductAmount,</if>
- <if test="shopPostFee != null">shopPostFee,</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">shopPostFlag,</if>
- <if test="shopTaxFee != null">shopTaxFee,</if>
- <if test="payCmAmount != null">payCmAmount,</if>
- <if test="shouldPayShopAmount != null">shouldPayShopAmount,</if>
- <if test="payedShopAmount != null">payedShopAmount,</if>
- <if test="shopOtherFee != null">shopOtherFee,</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">receiptedFlag,</if>
- <if test="receiptedType != null and receiptedType != ''">receiptedType,</if>
- <if test="costType != null and costType != ''">costType,</if>
- <if test="proportional != null">proportional,</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">modifyShouldPayNote,</if>
- <if test="modifyShouldPayUserID != null">modifyShouldPayUserID,</if>
- <if test="modifyShouldPayDate != null">modifyShouldPayDate,</if>
- <if test="zeroCostFlag != null">zeroCostFlag,</if>
- <if test="differenceType != null and differenceType != ''">differenceType,</if>
- <if test="differencePrice != null">differencePrice,</if>
- <if test="svipShopReduction != null">svipShopReduction,</if>
- <if test="splitCode != null and splitCode != ''">splitCode,</if>
- <if test="paySuccessCounter != null">paySuccessCounter,</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">onlinePayWays,</if>
- <if test="status != null and status != ''">shopStatus,</if>
- </trim>
- <trim prefix="values (" suffix=")" suffixOverrides=",">
- <if test="shopOrderID != null and shopOrderID != ''">#{shopOrderID},</if>
- <if test="shopOrderNo != null and shopOrderNo != ''">#{shopOrderNo},</if>
- <if test="orderNo != null and orderNo != ''">#{orderNo},</if>
- <if test="orderID != null">#{orderID},</if>
- <if test="organizeID != null">#{organizeID},</if>
- <if test="isColdChina != null">#{isColdChina},</if>
- <if test="userID != null">#{userID},</if>
- <if test="shopID != null">#{shopID},</if>
- <if test="orderPromotionsId != null">#{orderPromotionsId},</if>
- <if test="orderType != null">#{orderType},</if>
- <if test="orderSubmitType != null">#{orderSubmitType},</if>
- <if test="presentNum != null">#{presentNum},</if>
- <if test="itemCount != null">#{itemCount},</if>
- <if test="outStoreNum != null">#{outStoreNum},</if>
- <if test="outStoreTimes != null">#{outStoreTimes},</if>
- <if test="townID != null">#{townID},</if>
- <if test="note != null and note != ''">#{note},</if>
- <if test="eachDiscount != null">#{eachDiscount},</if>
- <if test="realPay != null">#{realPay},</if>
- <if test="receiptAmount != null">#{receiptAmount},</if>
- <if test="accountAmount != null">#{accountAmount},</if>
- <if test="productAmount != null">#{productAmount},</if>
- <if test="totalAmount != null">#{totalAmount},</if>
- <if test="needPayAmount != null">#{needPayAmount},</if>
- <if test="discountAmount != null">#{discountAmount},</if>
- <if test="preferential != null">#{preferential},</if>
- <if test="promotionFullReduction != null">#{promotionFullReduction},</if>
- <if test="payFlag != null and payFlag != ''">#{payFlag},</if>
- <if test="orderTime != null and orderTime != ''">#{orderTime},</if>
- <if test="payTime != null and payTime != ''">#{payTime},</if>
- <if test="finishTime != null and finishTime != ''">#{finishTime},</if>
- <if test="autoOverTimeMills != null">#{autoOverTimeMills},</if>
- <if test="settleStatus != null and settleStatus != ''">#{settleStatus},</if>
- <if test="payStatus != null and payStatus != ''">#{payStatus},</if>
- <if test="receiptStatus != null and receiptStatus != ''">#{receiptStatus},</if>
- <if test="sendOutStatus != null and sendOutStatus != ''">#{sendOutStatus},</if>
- <if test="refundStatus != null">#{refundStatus},</if>
- <if test="returnGoodsStatus != null">#{returnGoodsStatus},</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">#{receiveGoodsTime},</if>
- <if test="autoReceiveTimeMills != null">#{autoReceiveTimeMills},</if>
- <if test="totalAddedValueTax != null">#{totalAddedValueTax},</if>
- <if test="canRefundAmount != null">#{canRefundAmount},</if>
- <if test="refundAmount != null">#{refundAmount},</if>
- <if test="clubID != null">#{clubID},</if>
- <if test="spID != null">#{spID},</if>
- <if test="mainSpID != null">#{mainSpID},</if>
- <if test="orderBeanAmount != null">#{orderBeanAmount},</if>
- <if test="useBeanAmount != null">#{useBeanAmount},</if>
- <if test="useBeanFlag != null">#{useBeanFlag},</if>
- <if test="canRefundFlag != null">#{canRefundFlag},</if>
- <if test="useBalanceFlag != null">#{useBalanceFlag},</if>
- <if test="canRefundBeans != null">#{canRefundBeans},</if>
- <if test="freePostageFee != null">#{freePostageFee},</if>
- <if test="freePostageTicketID != null">#{freePostageTicketID},</if>
- <if test="brokerage != null">#{brokerage},</if>
- <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
- <if test="refundsAmount != null">#{refundsAmount},</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">#{orderStatusFlag},</if>
- <if test="buyStatus != null and buyStatus != ''">#{buyStatus},</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">#{deliveryTimeMills},</if>
- <if test="orderDeliveryID != null">#{orderDeliveryID},</if>
- <if test="splitFlag != null and splitFlag != ''">#{splitFlag},</if>
- <if test="paying != null and paying != ''">#{paying},</if>
- <if test="shopProductAmount != null">#{shopProductAmount},</if>
- <if test="shopPostFee != null">#{shopPostFee},</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">#{shopPostFlag},</if>
- <if test="shopTaxFee != null">#{shopTaxFee},</if>
- <if test="payCmAmount != null">#{payCmAmount},</if>
- <if test="shouldPayShopAmount != null">#{shouldPayShopAmount},</if>
- <if test="payedShopAmount != null">#{payedShopAmount},</if>
- <if test="shopOtherFee != null">#{shopOtherFee},</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">#{receiptedFlag},</if>
- <if test="receiptedType != null and receiptedType != ''">#{receiptedType},</if>
- <if test="costType != null and costType != ''">#{costType},</if>
- <if test="proportional != null">#{proportional},</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">#{modifyShouldPayNote},</if>
- <if test="modifyShouldPayUserID != null">#{modifyShouldPayUserID},</if>
- <if test="modifyShouldPayDate != null">#{modifyShouldPayDate},</if>
- <if test="zeroCostFlag != null">#{zeroCostFlag},</if>
- <if test="differenceType != null and differenceType != ''">#{differenceType},</if>
- <if test="differencePrice != null">#{differencePrice},</if>
- <if test="svipShopReduction != null">#{svipShopReduction},</if>
- <if test="splitCode != null and splitCode != ''">#{splitCode},</if>
- <if test="paySuccessCounter != null">#{paySuccessCounter},</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">#{onlinePayWays},</if>
- <if test="status != null and status != ''">#{status},</if>
- </trim>
- </insert>
- <update id="updateCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder">
- update cm_shop_order
- <trim prefix="SET" suffixOverrides=",">
- <if test="shopOrderNo != null and shopOrderNo != ''">shopOrderNo = #{shopOrderNo},</if>
- <if test="orderNo != null and orderNo != ''">orderNo = #{orderNo},</if>
- <if test="orderID != null">orderID = #{orderID},</if>
- <if test="organizeID != null">organizeID = #{organizeID},</if>
- <if test="isColdChina != null">isColdChina = #{isColdChina},</if>
- <if test="userID != null">userID = #{userID},</if>
- <if test="shopID != null">shopID = #{shopID},</if>
- <if test="orderPromotionsId != null">orderPromotionsId = #{orderPromotionsId},</if>
- <if test="orderType != null">orderType = #{orderType},</if>
- <if test="orderSubmitType != null">orderSubmitType = #{orderSubmitType},</if>
- <if test="presentNum != null">presentNum = #{presentNum},</if>
- <if test="itemCount != null">itemCount = #{itemCount},</if>
- <if test="outStoreNum != null">outStoreNum = #{outStoreNum},</if>
- <if test="outStoreTimes != null">outStoreTimes = #{outStoreTimes},</if>
- <if test="townID != null">townID = #{townID},</if>
- <if test="note != null and note != ''">note = #{note},</if>
- <if test="eachDiscount != null">eachDiscount = #{eachDiscount},</if>
- <if test="realPay != null">realPay = #{realPay},</if>
- <if test="receiptAmount != null">receiptAmount = #{receiptAmount},</if>
- <if test="accountAmount != null">accountAmount = #{accountAmount},</if>
- <if test="productAmount != null">productAmount = #{productAmount},</if>
- <if test="totalAmount != null">totalAmount = #{totalAmount},</if>
- <if test="needPayAmount != null">needPayAmount = #{needPayAmount},</if>
- <if test="discountAmount != null">discountAmount = #{discountAmount},</if>
- <if test="preferential != null">preferential = #{preferential},</if>
- <if test="promotionFullReduction != null">promotionFullReduction = #{promotionFullReduction},</if>
- <if test="payFlag != null and payFlag != ''">payFlag = #{payFlag},</if>
- <if test="orderTime != null and orderTime != ''">orderTime = #{orderTime},</if>
- <if test="payTime != null and payTime != ''">payTime = #{payTime},</if>
- <if test="finishTime != null and finishTime != ''">finishTime = #{finishTime},</if>
- <if test="autoOverTimeMills != null">autoOverTimeMills = #{autoOverTimeMills},</if>
- <if test="settleStatus != null and settleStatus != ''">settleStatus = #{settleStatus},</if>
- <if test="payStatus != null and payStatus != ''">payStatus = #{payStatus},</if>
- <if test="receiptStatus != null and receiptStatus != ''">receiptStatus = #{receiptStatus},</if>
- <if test="sendOutStatus != null and sendOutStatus != ''">sendOutStatus = #{sendOutStatus},</if>
- <if test="refundStatus != null">refundStatus = #{refundStatus},</if>
- <if test="returnGoodsStatus != null">returnGoodsStatus = #{returnGoodsStatus},</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">receiveGoodsTime = #{receiveGoodsTime},</if>
- <if test="autoReceiveTimeMills != null">autoReceiveTimeMills = #{autoReceiveTimeMills},</if>
- <if test="totalAddedValueTax != null">totalAddedValueTax = #{totalAddedValueTax},</if>
- <if test="canRefundAmount != null">canRefundAmount = #{canRefundAmount},</if>
- <if test="refundAmount != null">refundAmount = #{refundAmount},</if>
- <if test="clubID != null">clubID = #{clubID},</if>
- <if test="spID != null">spID = #{spID},</if>
- <if test="mainSpID != null">mainSpID = #{mainSpID},</if>
- <if test="orderBeanAmount != null">orderBeanAmount = #{orderBeanAmount},</if>
- <if test="useBeanAmount != null">useBeanAmount = #{useBeanAmount},</if>
- <if test="useBeanFlag != null">useBeanFlag = #{useBeanFlag},</if>
- <if test="canRefundFlag != null">canRefundFlag = #{canRefundFlag},</if>
- <if test="useBalanceFlag != null">useBalanceFlag = #{useBalanceFlag},</if>
- <if test="canRefundBeans != null">canRefundBeans = #{canRefundBeans},</if>
- <if test="freePostageFee != null">freePostageFee = #{freePostageFee},</if>
- <if test="freePostageTicketID != null">freePostageTicketID = #{freePostageTicketID},</if>
- <if test="brokerage != null">brokerage = #{brokerage},</if>
- <if test="delFlag != null and delFlag != ''">delFlag = #{delFlag},</if>
- <if test="refundsAmount != null">refundsAmount = #{refundsAmount},</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">orderStatusFlag = #{orderStatusFlag},</if>
- <if test="buyStatus != null and buyStatus != ''">buyStatus = #{buyStatus},</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">deliveryTimeMills = #{deliveryTimeMills},
- </if>
- <if test="orderDeliveryID != null">orderDeliveryID = #{orderDeliveryID},</if>
- <if test="splitFlag != null and splitFlag != ''">splitFlag = #{splitFlag},</if>
- <if test="paying != null and paying != ''">paying = #{paying},</if>
- <if test="shopProductAmount != null">shopProductAmount = #{shopProductAmount},</if>
- <if test="shopPostFee != null">shopPostFee = #{shopPostFee},</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">shopPostFlag = #{shopPostFlag},</if>
- <if test="shopTaxFee != null">shopTaxFee = #{shopTaxFee},</if>
- <if test="payCmAmount != null">payCmAmount = #{payCmAmount},</if>
- <if test="shouldPayShopAmount != null">shouldPayShopAmount = #{shouldPayShopAmount},</if>
- <if test="payedShopAmount != null">payedShopAmount = #{payedShopAmount},</if>
- <if test="shopOtherFee != null">shopOtherFee = #{shopOtherFee},</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">receiptedFlag = #{receiptedFlag},</if>
- <if test="receiptedType != null and receiptedType != ''">receiptedType = #{receiptedType},</if>
- <if test="costType != null and costType != ''">costType = #{costType},</if>
- <if test="proportional != null">proportional = #{proportional},</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">modifyShouldPayNote =
- #{modifyShouldPayNote},
- </if>
- <if test="modifyShouldPayUserID != null">modifyShouldPayUserID = #{modifyShouldPayUserID},</if>
- <if test="modifyShouldPayDate != null">modifyShouldPayDate = #{modifyShouldPayDate},</if>
- <if test="zeroCostFlag != null">zeroCostFlag = #{zeroCostFlag},</if>
- <if test="differenceType != null and differenceType != ''">differenceType = #{differenceType},</if>
- <if test="differencePrice != null">differencePrice = #{differencePrice},</if>
- <if test="svipShopReduction != null">svipShopReduction = #{svipShopReduction},</if>
- <if test="splitCode != null and splitCode != ''">splitCode = #{splitCode},</if>
- <if test="paySuccessCounter != null">paySuccessCounter = #{paySuccessCounter},</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">onlinePayWays = #{onlinePayWays},</if>
- <if test="status != null and status != ''">shopStatus = #{status},</if>
- </trim>
- where shopOrderID = #{shopOrderID}
- </update>
- <update id="updateDelCmShopOrderByShopOrderIDs" parameterType="String">
- update cm_shop_order set delFlag=#{delFlag} where shopOrderID in
- <foreach item="shopOrderID" collection="shopOrderIDs" open="(" separator="," close=")">
- #{shopOrderID}
- </foreach>
- </update>
- <update id="updateStatus">
- UPDATE cm_shop_order
- SET shopStatus = #{status},
- closeTime = NOW(),
- closeReason = #{closeReason}
- WHERE shopOrderID = #{shopOrderID}
- </update>
- <delete id="delCmShopOrderByShopOrderID" parameterType="String">
- delete
- from cm_shop_order
- where shopOrderID = #{shopOrderID}
- </delete>
- <delete id="delCmShopOrderByShopOrderIDs" parameterType="String">
- delete from cm_shop_order where shopOrderID in
- <foreach item="shopOrderID" collection="shopOrderIDs" open="(" separator="," close=")">
- #{shopOrderID}
- </foreach>
- </delete>
- </mapper>
|