12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197 |
- <?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,
- ifnull(a.accountAmount,0) 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"/>
- ,ifnull(a.cmAccountType,0) as cmAccountType,
- ifnull(a.rebateOrder,0) as rebateOrder,
- ifnull(a.supplierFreight,0) as supplierFreight
- 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,
- c.name as clubName,
- s.name as shopName
- from cm_shop_order a
- left join cm_order co on co.orderID = a.orderID
- left join club c on c.clubId = a.clubId
- 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="cmShopOtherFee != null">
- cmShopOtherFee = #{cmShopOtherFee},
- </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,
- ifnull(a.supplierFreight,0) as supplierFreight,
- ifnull(a.rebateOrder,0) 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,
- ifnull(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.shopOrderId = a.shopOrderId and cror.delFlag = 0
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id and cdr.delFlag = 0
- 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)
- and IFNULL(cdr.receiptType,0) not in (10,11)
- <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,
- ifnull(a.supplierFreight,0) as supplierFreight,
- ifnull(a.rebateOrder,0) as rebateOrder,
- 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(a.supplierFreight,0) as supplierFreight,
- ifnull(a.cmAccountType,0) as cmAccountType,
- ifnull(a.cmShopOtherFee,0) as cmShopOtherFee,
- ifnull(a.rebateOrder,0) as rebateOrder,
- (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 IF(EXISTS(SELECT splitStatus
- FROM cm_receipt_order_relation
- WHERE shopOrderId = #{shopOrderId} AND splitStatus = 1),
- (SELECT SUM(csa.splitAccount)
- FROM cm_split_account csa
- WHERE csa.type = 4 AND csa.shopOrderId = #{shopOrderId}),
- 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 = #{shopOrderId}
- </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,
- ifnull(a.cmShopOtherFee,0) as cmShopOtherFee,
- ifnull(a.cmAccountType,0) as cmAccountType,
- bou.name AS buyer,
- ifnull(a.supplierFreight,0) as supplierFreight,
- ifnull(a.rebateOrder,0) as rebateOrder,
- 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
- 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,
- 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,
- co.payTotalFee AS payTotalFee,
- co.promotionFullReduction AS promotionFullReduction,
- a.onlinePayWays,
- ifnull(a.cmAccountType,0) as cmAccountType,
- ifnull(IF(cpsr.status!=1 AND paymentType=3,cpsr.payAmount,a.shopOtherFee), 0) AS shopOtherFee,
- ifnull(IF(cpsr.status!=1 AND paymentType=3,cpsr.payCmAmount,a.cmShopOtherFee),0) AS cmShopOtherFee,
- ifnull(a.supplierFreight,0) as supplierFreight,
- ifnull(a.rebateOrder,0) as rebateOrder,
- 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>
- <if test="payShopId != null and payShopId != ''">
- and cpsr.payShopId = #{payShopId}
- </if>
- group by a.shopOrderID
- </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},
- cmShopOtherFee = #{profit}
- 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 a.splitCode != 'E1808689662'
- 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.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'
- AND a.splitCode != 'E1808689662'
- <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,
- IF(EXISTS(SELECT 1 FROM cm_order_product WHERE productId = 4730 AND shopOrderId= cso.shopOrderId) , 1, 0) AS partnerId
- 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 cso.shopOrderId = cop.shopOrderId
- LEFT JOIN product p ON cop.productID = p.productID
- </if>
- LEFT JOIN user u ON u.userID = cso.userID
- left join club c on c.clubId = cso.clubId
- <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="clubID != null">
- and c.clubId = #{clubID}
- </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},'%') OR p.aliasName 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.supplierFreight +
- IF(acso.differenceType = 1, acso.differencePrice, 0) -
- IF(acso.differenceType = 2, acso.differencePrice, 0)),
- 0))
- + IFNULL(acso.shopPostFee, 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>
- <select id="findByShopOrderIDsNot" resultType="com.caimei.modules.order.entity.NewShopOrder">
- select distinct
- 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,
- 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,
- co.payTotalFee AS payTotalFee,
- co.promotionFullReduction AS promotionFullReduction,
- a.onlinePayWays,
- ifnull(a.cmAccountType,0) as cmAccountType,
- ifnull(a.shopOtherFee, 0) AS shopOtherFee,
- ifnull(a.cmShopOtherFee,0) AS cmShopOtherFee,
- ifnull(a.supplierFreight,0) as supplierFreight,
- ifnull(a.rebateOrder,0) as rebateOrder,
- 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="ids != null and ids.size() > 0">
- where a.shopOrderID in
- <foreach collection="ids" separator="," item="shopOrderID" open="(" close=")">
- #{shopOrderID}
- </foreach>
- </if>
- </select>
- <select id="findPayOtherList" resultType="com.caimei.modules.order.entity.NewShopOrder">
- select<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- ifnull(a.supplierFreight,0) as supplierFreight,
- ifnull(a.rebateOrder,0) 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,
- ifnull(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 and cror.delFlag = 0
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id and cdr.delFlag = 0
- left join shop s on s.shopID = a.shopID
- LEFT JOIN club c ON c.userID = a.userID
- <where>
- s.AccountOwnership = 1
- and a.shopStatus not in (4, 5)
- and IFNULL(cdr.receiptType,0) not in (10,11)
- and cdr.payWay = 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="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 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>
- <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>
|