123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="com.caimei.modules.order.dao.NewShopOrderDao">
- <sql id="shopOrderColumns">
- co.rebateFee as rebateFee,
- co.userBeans as userBeans,
- a.shopOrderID AS shopOrderID,
- a.shopStatus AS status,
- a.shopPostFlag AS shopPostFlag,
- a.orderID AS orderID,
- a.organizeID AS organizeID,
- a.shopOrderNo AS shopOrderNo,
- a.orderNo AS orderNo,
- a.userID AS userID,
- a.shopID AS shopID,
- a.isColdChina AS isColdChina,
- a.itemCount AS itemCount,
- a.townID AS townID,
- a.productAmount AS productAmount,
- a.discountAmount AS discountAmount,
- a.accountAmount AS accountAmount,
- a.totalAmount AS totalAmount,
- a.payFlag AS payFlag,
- a.payTime AS payTime,
- a.finishTime AS finishTime,
- a.refundStatus AS refundStatus,
- a.needPayAmount AS needPayAmount,
- a.splitCode,
- ifnull(a.realPay, a.needPayAmount) AS realPay,
- a.eachDiscount AS eachDiscount,
- IFNULL((SELECT SUM(cror.associateAmount)
- FROM cm_receipt_order_relation cror
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- WHERE cror.shopOrderId = a.shopOrderId
- AND cror.relationType = '2'
- AND cdr.receiptType = 1
- AND cdr.delFlag = 0
- AND cror.delFlag = 0
- AND cdr.receiptStatus IN (2, 3)
- AND cdr.payWay != 3)
- , 0) AS receiptAmount,
- (ifnull(a.realPay,a.needPayAmount) - ifnull(a.receiptAmount,0)) as restAmount,
- a.receiptStatus as shopReceiptStatus,
- a.receiptStatus as ReceiptStatus,
- a.canRefundAmount AS canRefundAmount,
- a.refundAmount AS refundAmount,
- a.clubID AS clubID,
- a.spID AS spID,
- a.mainSpID AS mainSpID,
- a.orderBeanAmount AS orderBeanAmount,
- a.useBeanAmount AS useBeanAmount,
- a.useBeanFlag AS useBeanFlag,
- a.canRefundFlag AS canRefundFlag,
- a.useBalanceFlag AS useBalanceFlag,
- a.canRefundBeans AS canRefundBeans,
- a.freePostageFee AS freePostageFee,
- a.freePostageTicketID AS freePostageTicketID,
- a.brokerage AS brokerage,
- a.delFlag AS delFlag,
- a.refundsAmount AS refundsAmount,
- a.orderStatusFlag AS orderStatusFlag,
- a.buyStatus AS buyStatus,
- a.orderSubmitType AS orderSubmitType,
- a.orderType AS orderType,
- a.orderTime AS orderTime,
- a.deliveryTimeMills AS deliveryTimeMills,
- a.presentNum AS presentNum,
- a.preferential AS preferential,
- a.outStoreNum AS outStoreNum,
- IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
- a.splitFlag AS splitFlag,
- a.autoReceiveTimeMills AS autoReceiveTimeMills,
- a.autoOverTimeMills AS autoOverTimeMills,
- a.receiveGoodsTime AS receiveGoodsTime,
- a.totalAddedValueTax AS totalAddedValueTax,
- a.note AS note,
- a.payStatus AS payStatus,
- a.sendOutStatus AS sendOutStatus,
- a.shopProductAmount AS shopProductAmount,
- ifnull(a.shopPostFee, 0) AS shopPostFee,
- ifnull(a.shopTaxFee,0) AS shopTaxFee,
- a.shouldPayShopAmount AS shouldPayShopAmount,
- a.payedShopAmount AS payedShopAmount,
- ifnull(a.shopOtherFee, 0) AS shopOtherFee,
- a.paying AS paying,
- a.costType AS costType,
- a.settleStatus AS settleStatus,
- a.modifyShouldPayNote AS modifyShouldPayNote,
- a.orderPromotionsId AS orderPromotionsId,
- a.differenceType AS differenceType,
- a.differencePrice AS differencePrice,
- a.proportional AS proportional,
- ifnull(a.promotionFullReduction, 0) As promotionFullReduction,
- ifnull(a.couponAmount, 0) As couponAmount,
- a.zeroCostFlag AS zeroCostFlag
- </sql>
- <select id="get" resultType="NewShopOrder" useCache="false" flushCache="true">
- select
- <include refid="shopOrderColumns"/>
- ,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,
- s.name as shopName
- from cm_shop_order a
- left join cm_order co on co.orderID = a.orderID
- left join bp_order_userinfo bou on bou.orderId = a.orderID
- left join shop s on a.shopId = s.shopId
- where a.shopOrderID = #{shopOrderID}
- </select>
- <select id="findByPayShopID" resultType="java.lang.Double">
- SELECT SUM(cpsr.payAmount)
- FROM cm_pay_shop cps
- LEFT JOIN cm_pay_shop_record cpsr ON cpsr.payShopID = cps.id
- WHERE cpsr.delFlag = 0
- AND cps.delFlag = 0
- AND cpsr.shopOrderId = #{shopOrderID}
- </select>
- <select id="findList" resultType="newShopOrder">
- SELECT
- <include refid="shopOrderColumns"/>
- FROM cm_shop_order a
- left join cm_order co on co.orderID = a.orderID
- <where>
- <if test="shopOrderNo != null and itemCount != ''">
- AND a.shopOrderNo = #{shopOrderNo}
- </if>
- <if test="orderNo != null and itemCount != ''">
- AND a.orderNo = #{orderNo}
- </if>
- <if test="orderID != null and itemCount != ''">
- AND a.orderID = #{orderID}
- </if>
- <if test="userID != null and itemCount != ''">
- AND a.userID = #{userID}
- </if>
- <if test="shopID != null and itemCount != ''">
- AND a.shopID = #{shopID}
- </if>
- <if test="payFlag != null and itemCount != ''">
- AND a.payFlag = #{payFlag}
- </if>
- </where>
- <choose>
- <when test="page !=null and page.orderBy != null and page.orderBy != ''">
- ORDER BY ${page.orderBy}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- </select>
- <select id="findListByOrderID" resultType="newShopOrder">
- SELECT<include refid="shopOrderColumns"/>,
- b.name as shopName,
- oa.id as orderArchiveId,
- co.receiptStatus,
- (SELECT SUM(num) FROM cm_order_product WHERE shoporderid=29760 AND productType = 2) as presentNum
- FROM cm_shop_order a
- left join shop b on a.shopID = b.shopID
- left join cm_order_archive oa on a.shopOrderID = oa.shopOrderId
- left join cm_order co on co.orderID = a.orderID
- WHERE a.orderID = #{orderID} ORDER BY a.shopOrderNo DESC
- </select>
- <select id="getFreightAmount" resultType="java.lang.Double">
- SELECT ifnull(SUM(cfr.freightAmount), 0)
- FROM cm_freight_rule cfr
- LEFT JOIN cm_freight_template cft ON cft.id = cfr.freightId
- LEFT JOIN product p ON p.freightTemplateId = cft.id
- WHERE productId = #{productId}
- and cft.delFlag = 0
- </select>
- <select id="getShopOrderId" resultType="com.caimei.modules.product.entity.Shop">
- select shopId, AccountOwnership, bankAccount
- from shop
- where shopId = #{shopId}
- </select>
- <select id="findCommercialCode" resultType="String">
- select commercialCode
- FROM cm_shop_order a
- left join cm_shop_splitcode css on a.shopID = css.shopId
- WHERE a.orderID = #{orderID}
- </select>
- <update id="update" parameterType="newShopOrder">
- update cm_shop_order
- <set>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- shopOrderNo = #{shopOrderNo},
- </if>
- <if test="status != null and status != ''">
- shopStatus = #{status},
- </if>
- <if test="confirmTime != null and confirmTime != ''">
- confirmTime = #{confirmTime},
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- orderID = #{orderID},
- </if>
- <if test="orderNo != null and orderNo != ''">
- orderNo = #{orderNo},
- </if>
- <if test="userID != null and userID != ''">
- userID = #{userID},
- </if>
- <if test="shopID != null and shopID != ''">
- shopID = #{shopID},
- </if>
- <if test="itemCount != null and itemCount != ''">
- itemCount = #{itemCount},
- </if>
- <if test="townID != null and itemCount != ''">
- townID = #{townID,jdbcType=INTEGER},
- </if>
- <if test="productAmount != null and productAmount != ''">
- productAmount = #{productAmount},
- </if>
- <if test="discountAmount != null and discountAmount != ''">
- discountAmount = #{discountAmount},
- </if>
- <if test="accountAmount != null and accountAmount != ''">
- accountAmount = #{accountAmount},
- </if>
- <if test="totalAmount != null and totalAmount != ''">
- totalAmount = #{totalAmount},
- </if>
- <if test="payFlag != null and payFlag != ''">
- payFlag = #{payFlag},
- </if>
- <if test="payTime != null and payTime != ''">
- payTime = #{payTime},
- </if>
- <if test="finishTime != null and finishTime != ''">
- finishTime = #{finishTime},
- </if>
- <if test="refundStatus != null and refundStatus != ''">
- refundStatus = #{refundStatus},
- </if>
- <if test="needPayAmount != null and needPayAmount != ''">
- needPayAmount = #{needPayAmount},
- </if>
- <if test="canRefundAmount != null and canRefundAmount != ''">
- canRefundAmount = #{canRefundAmount},
- </if>
- <if test="refundAmount != null and refundAmount != ''">
- refundAmount = #{refundAmount},
- </if>
- <if test="clubID != null and clubID != ''">
- clubID = #{clubID},
- </if>
- <if test="spID != null and itemCount != ''">
- spID = #{spID,jdbcType=INTEGER},
- </if>
- <if test="mainSpID != null and mainSpID != ''">
- mainSpID = #{mainSpID},
- </if>
- <if test="orderBeanAmount != null and orderBeanAmount != ''">
- orderBeanAmount = #{orderBeanAmount},
- </if>
- <if test="useBeanAmount != null and useBeanAmount != ''">
- useBeanAmount = #{useBeanAmount},
- </if>
- <if test="useBeanFlag != null and useBeanFlag != ''">
- useBeanFlag = #{useBeanFlag},
- </if>
- <if test="canRefundFlag != null and canRefundFlag != ''">
- canRefundFlag = #{canRefundFlag},
- </if>
- <if test="useBalanceFlag != null and useBalanceFlag != ''">
- useBalanceFlag = #{useBalanceFlag},
- </if>
- <if test="canRefundBeans != null and canRefundBeans != ''">
- canRefundBeans = #{canRefundBeans},
- </if>
- <if test="freePostageFee != null and freePostageFee != ''">
- freePostageFee = #{freePostageFee},
- </if>
- <if test="freePostageTicketID != null and freePostageTicketID != ''">
- freePostageTicketID = #{freePostageTicketID},
- </if>
- <if test="brokerage != null and brokerage != ''">
- brokerage = #{brokerage},
- </if>
- <if test="delFlag != null and delFlag != ''">
- delFlag = #{delFlag},
- </if>
- <if test="refundsAmount != null and refundsAmount != ''">
- refundsAmount = #{refundsAmount},
- </if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">
- orderStatusFlag = #{orderStatusFlag},
- </if>
- <if test="buyStatus != null and buyStatus != ''">
- buyStatus = #{buyStatus},
- </if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">
- deliveryTimeMills = #{deliveryTimeMills},
- </if>
- <if test="orderSubmitType != null and orderSubmitType != ''">
- orderSubmitType = #{orderSubmitType},
- </if>
- <if test="orderType != null and orderType != ''">
- orderType = #{orderType},
- </if>
- <if test="orderTime != null and orderTime != ''">
- orderTime = #{orderTime},
- </if>
- <if test="presentNum != null and presentNum != ''">
- presentNum = #{presentNum},
- </if>
- <if test="preferential != null and preferential != ''">
- preferential = #{preferential},
- </if>
- <if test="outStoreNum != null and outStoreNum != ''">
- outStoreNum = #{outStoreNum},
- </if>
- <if test="outStoreTimes != null and outStoreTimes != ''">
- outStoreTimes = #{outStoreTimes},
- </if>
- <if test="splitFlag != null and splitFlag != ''">
- splitFlag = #{splitFlag},
- </if>
- <if test="autoReceiveTimeMills != null and autoReceiveTimeMills != ''">
- autoReceiveTimeMills = #{autoReceiveTimeMills},
- </if>
- <if test="autoOverTimeMills != null and autoOverTimeMills != ''">
- autoOverTimeMills = #{autoOverTimeMills},
- </if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">
- receiveGoodsTime = #{receiveGoodsTime},
- </if>
- <if test="totalAddedValueTax != null and totalAddedValueTax != ''">
- totalAddedValueTax = #{totalAddedValueTax},
- </if>
- <if test="note != null and note != ''">
- note = #{note},
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">
- sendOutStatus = #{sendOutStatus},
- </if>
- <if test="paying != null and paying != ''">
- paying = #{paying},
- </if>
- <if test="shopProductAmount != null">
- shopProductAmount = #{shopProductAmount},
- </if>
- <if test="shopPostFee != null">
- shopPostFee = #{shopPostFee},
- </if>
- <if test="shopTaxFee != null">
- shopTaxFee = #{shopTaxFee},
- </if>
- <if test="shouldPayShopAmount != null">
- shouldPayShopAmount = #{shouldPayShopAmount},
- </if>
- <if test="payedShopAmount != null">
- payedShopAmount = #{payedShopAmount},
- </if>
- <if test="shopOtherFee != null">
- shopOtherFee = #{shopOtherFee},
- </if>
- <if test="payStatus != null">
- payStatus = #{payStatus},
- </if>
- <if test="costType != null">
- costType = #{costType},
- </if>
- <if test="proportional != null">
- proportional = #{proportional},
- </if>
- <if test="modifyShouldPayNote != null">
- modifyShouldPayNote = #{modifyShouldPayNote},
- </if>
- <if test="modifyShouldPayUserID != null">
- modifyShouldPayUserID = #{modifyShouldPayUserID},
- </if>
- <if test="modifyShouldPayDate != null">
- modifyShouldPayDate = #{modifyShouldPayDate},
- </if>
- <if test="orderPromotionsId != null">
- orderPromotionsId = #{orderPromotionsId},
- </if>
- <if test="promotionFullReduction != null">
- promotionFullReduction = #{promotionFullReduction},
- </if>
- <if test="zeroCostFlag != null">
- zeroCostFlag = #{zeroCostFlag},
- </if>
- <if test="svipShopReduction != null">
- svipShopReduction = #{svipShopReduction},
- </if>
- <if test="realPay != null">
- realPay = #{realPay},
- </if>
- <if test="eachDiscount != null">
- eachDiscount = #{eachDiscount},
- </if>
- <if test="receiptStatus != null">
- receiptStatus = #{receiptStatus},
- </if>
- <if test="receiptAmount != null">
- receiptAmount = #{receiptAmount},
- </if>
- <if test="splitCode != null">
- splitCode = #{splitCode},
- </if>
- <if test="supplierFreight != null">
- supplierFreight = #{supplierFreight},
- </if>
- <if test="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.orderId = co.orderId
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- left join shop s on s.shopID = a.shopID
- LEFT JOIN club c ON c.userID = a.userID
- <where>
- (s.shopId = 1161 OR s.AccountOwnership = 0 OR a.splitCode = 'E1807059160' or a.ordertype = 2)
- and a.shopStatus not in (4, 5)
- 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 IFNULL(SUM(cpsr.payCmAmount), 0)
- FROM cm_pay_shop cps
- LEFT JOIN cm_pay_shop_record cpsr ON cps.id = cpsr.payShopID
- WHERE cpsr.delFlag = 0
- AND cpsr.shopOrderID = 29478
- </select>
- <select id="returnedPurchaseFeeByShopOrderId" resultType="java.lang.Double">
- SELECT IFNULL(SUM(crp.returnedPurchaseFee), 0)
- FROM cm_returned_purchase crp
- LEFT JOIN cm_returned_purchase_product crpp ON crp.id = crpp.returnedID
- WHERE crp.delFlag = 0
- AND crp.status = 2
- AND crp.shopOrderId = #{shopOrderId}
- </select>
- <select id="findSplitCount" resultType="java.lang.Integer">
- SELECT COUNT(*)
- FROM cm_split_account
- WHERE shopOrderId = #{shopOrderId}
- </select>
- <select id="findPayOrderListByIDs" resultType="newShopOrder">
- select distinct<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- co.promotionFullReduction,
- 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<include refid="shopOrderColumns"/>,
- co.payTotalFee AS payTotalFee,
- co.promotionFullReduction AS promotionFullReduction,
- a.onlinePayWays,
- ifnull(a.cmAccountType,0) as cmAccountType,
- ifnull(a.cmShopOtherFee,0) as cmShopOtherFee,
- 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>
- </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 co.orderID NOT IN (SELECT orderID
- FROM cm_order_product
- WHERE productID IN
- (6060, 6061, 6062, 6063, 6064, 6065, 6066, 6067, 6068, 6069)
- GROUP BY orderID)
- GROUP BY a.shopOrderID
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="getOpenidListByPermission" resultType="java.lang.String">
- SELECT openid
- FROM `wechat_user`
- WHERE unionid = #{unionid}
- </select>
- <select id="FromUnionId" resultType="java.lang.String">
- SELECT unionID
- FROM `cm_order`
- WHERE orderID = #{orderId}
- </select>
- <select id="UnionId" resultType="java.lang.String">
- SELECT unionID
- FROM `cm_order`
- WHERE userID = #{userID}
- ORDER BY orderID DESC
- LIMIT 1
- </select>
- <select id="getProductOrder" resultType="java.lang.String">
- SELECT productID
- FROM `cm_order_product`
- WHERE orderID = #{orderid}
- </select>
- <select id="payWay" resultType="java.lang.Integer">
- SELECT cdr.payWay
- FROM cm_shop_order a
- LEFT JOIN cm_order co ON co.orderID = a.orderID
- LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- WHERE a.shopOrderID = #{shopOrderID}
- </select>
- <select id="findSettlementList" resultType="com.caimei.modules.order.entity.NewShopOrder">
- SELECT co.couponAmount AS couponAmount,
- co.userBeans AS userBeans,
- a.shopOrderID AS shopOrderID,
- a.orderID AS orderID,
- a.organizeID AS organizeID,
- a.shopOrderNo AS shopOrderNo,
- a.orderNo AS orderNo,
- a.userID AS userID,
- a.shopID AS shopID,
- a.itemCount AS itemCount,
- a.townID AS townID,
- a.productAmount AS productAmount,
- a.discountAmount AS discountAmount,
- a.accountAmount AS accountAmount,
- a.totalAmount AS totalAmount,
- a.payFlag AS payFlag,
- a.payTime AS payTime,
- a.finishTime AS finishTime,
- a.refundStatus AS refundStatus,
- a.needPayAmount AS needPayAmount,
- a.canRefundAmount AS canRefundAmount,
- a.refundAmount AS refundAmount,
- a.clubID AS clubID,
- a.spID AS spID,
- a.mainSpID AS mainSpID,
- a.orderBeanAmount AS orderBeanAmount,
- a.useBeanAmount AS useBeanAmount,
- a.useBeanFlag AS useBeanFlag,
- a.canRefundFlag AS canRefundFlag,
- a.useBalanceFlag AS useBalanceFlag,
- a.canRefundBeans AS canRefundBeans,
- a.freePostageFee AS freePostageFee,
- a.freePostageTicketID AS freePostageTicketID,
- a.brokerage AS brokerage,
- a.delFlag AS delFlag,
- a.refundsAmount AS refundsAmount,
- a.orderStatusFlag AS orderStatusFlag,
- a.buyStatus AS buyStatus,
- a.orderSubmitType AS orderSubmitType,
- a.orderType AS orderType,
- a.orderTime AS orderTime,
- a.deliveryTimeMills AS deliveryTimeMills,
- a.presentNum AS presentNum,
- a.preferential AS preferential,
- a.outStoreNum AS outStoreNum,
- IFNULL(a.outStoreTimes, 0) AS outStoreTimes,
- a.splitFlag AS splitFlag,
- a.autoReceiveTimeMills AS autoReceiveTimeMills,
- a.autoOverTimeMills AS autoOverTimeMills,
- a.receiveGoodsTime AS receiveGoodsTime,
- a.totalAddedValueTax AS totalAddedValueTax,
- a.note AS note,
- a.payStatus AS payStatus,
- a.sendOutStatus AS sendOutStatus,
- a.shopProductAmount AS shopProductAmount,
- a.shopPostFee AS shopPostFee,
- a.shopTaxFee AS shopTaxFee,
- a.shouldPayShopAmount AS shouldPayShopAmount,
- a.payedShopAmount AS payedShopAmount,
- a.shopOtherFee AS shopOtherFee,
- a.paying AS paying,
- a.costType AS costType,
- a.modifyShouldPayNote AS modifyShouldPayNote,
- a.orderPromotionsId AS orderPromotionsId,
- a.differenceType AS differenceType,
- a.differencePrice AS differencePrice,
- a.proportional AS proportional,
- a.promotionFullReduction AS promotionFullReduction,
- a.zeroCostFlag AS zeroCostFlag,
- a.settleStatus AS settleStatus,
- co.payTotalFee AS payTotalFee,
- co.status AS STATUS,
- bou.name AS buyer,
- s.name AS shopName,
- c.name AS clubName,
- a.onlinePayWays,
- ifnull(a.cmAccountType,0) as cmAccountType,
- ifnull(a.a.cmShopOtherFee,0) as cmShopOtherFee
- FROM cm_shop_order a
- LEFT JOIN cm_pay_shop_record cpsr ON a.shopOrderID = cpsr.shopOrderID
- LEFT JOIN bp_order_userinfo bou ON bou.orderId = a.orderID
- LEFT JOIN cm_order co ON co.orderID = a.orderID
- LEFT JOIN cm_receipt_order_relation cror ON cror.orderId = co.orderId
- LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
- LEFT JOIN cm_split_account csa on csa.shopOrderId = a.shopOrderID
- LEFT JOIN shop s ON s.shopID = a.shopID
- LEFT JOIN club c ON c.userID = a.userID
- WHERE co.organizeID = 0
- AND co.refundType != 2
- AND co.delFlag = 0
- AND co.orderType != 2
- AND co.receiptStatus = 3
- AND a.delFlag = 0
- AND a.refundStatus = 1
- AND a.shopID != 998
- AND (a.organizeID!=4 or a.organizeID is null)
- AND cdr.payWay = 1
- AND cror.relationType = 2
- AND a.settleStatus in (1,2)
- AND csa.settleStatus = 0
- AND cror.delFlag = 0
- AND cror.mbOrderId IS NOT NULL
- AND cror.splitStatus = 1
- AND a.splitCode != 'E1807059160'
- <if test="startTime != null and startTime != ''">
- AND (a.orderTime > #{startTime} OR a.orderTime = #{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND (a.orderTime < #{endTime} OR a.orderTime = #{endTime})
- </if>
- <if test="orderID != null and orderID != ''">
- AND a.orderID = #{orderID}
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND a.orderNo like concat('%', #{orderNo} ,'%')
- </if>
- <if test="ps != null and ps.length>0 ">
- AND a.settleStatus in
- <foreach item="item" index="index" collection="ps" open="(" close=")" separator=",">
- #{item}
- </foreach>
- </if>
- <if test="shopName != null and shopName != ''">
- AND s.name like concat('%', #{shopName} ,'%')
- </if>
- <if test="clubName != null and clubName != ''">
- AND c.name like concat('%', #{clubName} ,'%')
- </if>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND a.shopOrderID = #{shopOrderID}
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- AND a.shopOrderNo like concat('%', #{shopOrderNo} ,'%')
- </if>
- GROUP BY a.shopOrderID
- ORDER BY a.shopOrderID DESC
- </select>
- <select id="findSettleRecord" resultType="com.caimei.modules.order.entity.SettleRecord">
- select settleAmount, settleType, settleTime
- from cm_settle_record
- where shopOrderId = #{shopOrderID}
- </select>
- <select id="findListByShopOrderId" resultType="com.caimei.modules.order.entity.NewShopOrder">
- SELECT<include refid="shopOrderColumns"/>,
- b.name as shopName,
- oa.id as orderArchiveId,
- co.receiptStatus
- FROM cm_shop_order a
- left join shop b on a.shopID = b.shopID
- left join cm_order_archive oa on a.shopOrderID = oa.shopOrderId
- left join cm_order co on co.orderID = a.orderID
- WHERE a.shopOrderId = #{onlineShopOrderId}
- ORDER BY a.shopOrderNo DESC
- </select>
- <resultMap type="com.caimei.modules.order.entity.NewShopOrder" id="CmShopOrderResult">
- <result property="shopOrderID" column="shopOrderID"/>
- <result property="shopOrderNo" column="shopOrderNo"/>
- <result property="orderNo" column="orderNo"/>
- <result property="orderID" column="orderID"/>
- <result property="organizeID" column="organizeID"/>
- <result property="isColdChina" column="isColdChina"/>
- <result property="userID" column="userID"/>
- <result property="shopID" column="shopID"/>
- <result property="orderPromotionsId" column="orderPromotionsId"/>
- <result property="orderType" column="orderType"/>
- <result property="orderSubmitType" column="orderSubmitType"/>
- <result property="presentNum" column="presentNum"/>
- <result property="itemCount" column="itemCount"/>
- <result property="outStoreNum" column="outStoreNum"/>
- <result property="outStoreTimes" column="outStoreTimes"/>
- <result property="townID" column="townID"/>
- <result property="note" column="note"/>
- <result property="eachDiscount" column="eachDiscount"/>
- <result property="realPay" column="realPay"/>
- <result property="receiptAmount" column="receiptAmount"/>
- <result property="accountAmount" column="accountAmount"/>
- <result property="productAmount" column="productAmount"/>
- <result property="totalAmount" column="totalAmount"/>
- <result property="needPayAmount" column="needPayAmount"/>
- <result property="discountAmount" column="discountAmount"/>
- <result property="preferential" column="preferential"/>
- <result property="promotionFullReduction" column="promotionFullReduction"/>
- <result property="payFlag" column="payFlag"/>
- <result property="orderTime" column="orderTime"/>
- <result property="payTime" column="payTime"/>
- <result property="finishTime" column="finishTime"/>
- <result property="autoOverTimeMills" column="autoOverTimeMills"/>
- <result property="settleStatus" column="settleStatus"/>
- <result property="payStatus" column="payStatus"/>
- <result property="receiptStatus" column="receiptStatus"/>
- <result property="sendOutStatus" column="sendOutStatus"/>
- <result property="refundStatus" column="refundStatus"/>
- <result property="returnGoodsStatus" column="returnGoodsStatus"/>
- <result property="receiveGoodsTime" column="receiveGoodsTime"/>
- <result property="autoReceiveTimeMills" column="autoReceiveTimeMills"/>
- <result property="totalAddedValueTax" column="totalAddedValueTax"/>
- <result property="canRefundAmount" column="canRefundAmount"/>
- <result property="refundAmount" column="refundAmount"/>
- <result property="clubID" column="clubID"/>
- <result property="spID" column="spID"/>
- <result property="mainSpID" column="mainSpID"/>
- <result property="orderBeanAmount" column="orderBeanAmount"/>
- <result property="useBeanAmount" column="useBeanAmount"/>
- <result property="useBeanFlag" column="useBeanFlag"/>
- <result property="canRefundFlag" column="canRefundFlag"/>
- <result property="useBalanceFlag" column="useBalanceFlag"/>
- <result property="canRefundBeans" column="canRefundBeans"/>
- <result property="freePostageFee" column="freePostageFee"/>
- <result property="freePostageTicketID" column="freePostageTicketID"/>
- <result property="brokerage" column="brokerage"/>
- <result property="delFlag" column="delFlag"/>
- <result property="refundsAmount" column="refundsAmount"/>
- <result property="orderStatusFlag" column="orderStatusFlag"/>
- <result property="buyStatus" column="buyStatus"/>
- <result property="deliveryTimeMills" column="deliveryTimeMills"/>
- <result property="orderDeliveryID" column="orderDeliveryID"/>
- <result property="splitFlag" column="splitFlag"/>
- <result property="paying" column="paying"/>
- <result property="shopProductAmount" column="shopProductAmount"/>
- <result property="shopPostFee" column="shopPostFee"/>
- <result property="shopPostFlag" column="shopPostFlag"/>
- <result property="shopTaxFee" column="shopTaxFee"/>
- <result property="payCmAmount" column="payCmAmount"/>
- <result property="shouldPayShopAmount" column="shouldPayShopAmount"/>
- <result property="payedShopAmount" column="payedShopAmount"/>
- <result property="shopOtherFee" column="shopOtherFee"/>
- <result property="receiptedFlag" column="receiptedFlag"/>
- <result property="receiptedType" column="receiptedType"/>
- <result property="costType" column="costType"/>
- <result property="proportional" column="proportional"/>
- <result property="modifyShouldPayNote" column="modifyShouldPayNote"/>
- <result property="modifyShouldPayUserID" column="modifyShouldPayUserID"/>
- <result property="modifyShouldPayDate" column="modifyShouldPayDate"/>
- <result property="zeroCostFlag" column="zeroCostFlag"/>
- <result property="differenceType" column="differenceType"/>
- <result property="differencePrice" column="differencePrice"/>
- <result property="svipShopReduction" column="svipShopReduction"/>
- <result property="splitCode" column="splitCode"/>
- <result property="paySuccessCounter" column="paySuccessCounter"/>
- <result property="onlinePayWays" column="onlinePayWays"/>
- <result property="status" column="shopStatus"/>
- </resultMap>
- <sql id="selectCmShopOrderVo">
- select cm_shop_order.shopOrderID,
- cm_shop_order.shopOrderNo,
- cm_shop_order.orderNo,
- cm_shop_order.orderID,
- cm_shop_order.organizeID,
- cm_shop_order.isColdChina,
- cm_shop_order.userID,
- cm_shop_order.shopID,
- cm_shop_order.orderPromotionsId,
- cm_shop_order.orderType,
- cm_shop_order.orderSubmitType,
- cm_shop_order.presentNum,
- cm_shop_order.itemCount,
- cm_shop_order.outStoreNum,
- cm_shop_order.outStoreTimes,
- cm_shop_order.townID,
- cm_shop_order.note,
- ifnull(cm_shop_order.accountAmount, 0) AS accountAmount,
- ifnull(cm_shop_order.productAmount, 0) AS productAmount,
- ifnull(cm_shop_order.totalAmount, 0) AS totalAmount,
- ifnull(cm_shop_order.needPayAmount, 0) AS needPayAmount,
- ifnull(cm_shop_order.discountAmount, 0) AS discountAmount,
- ifnull(cm_shop_order.preferential, 0) AS preferential,
- ifnull(cm_shop_order.promotionFullReduction, 0) AS promotionFullReduction,
- cm_shop_order.payFlag,
- cm_shop_order.orderTime,
- cm_shop_order.payTime,
- cm_shop_order.finishTime,
- cm_shop_order.autoOverTimeMills,
- cm_shop_order.settleStatus,
- cm_shop_order.payStatus,
- cm_shop_order.sendOutStatus,
- cm_shop_order.refundStatus,
- cm_shop_order.shopStatus,
- cm_shop_order.returnGoodsStatus,
- cm_shop_order.receiveGoodsTime,
- cm_shop_order.autoReceiveTimeMills,
- ifnull(cm_shop_order.totalAddedValueTax, 0) AS totalAddedValueTax,
- cm_shop_order.canRefundAmount,
- cm_shop_order.refundAmount,
- cm_shop_order.clubID,
- cm_shop_order.spID,
- cm_shop_order.mainSpID,
- cm_shop_order.orderBeanAmount,
- cm_shop_order.useBeanAmount,
- cm_shop_order.useBeanFlag,
- cm_shop_order.canRefundFlag,
- cm_shop_order.useBalanceFlag,
- cm_shop_order.canRefundBeans,
- ifnull(cm_shop_order.freePostageFee, 0) AS freePostageFee,
- cm_shop_order.freePostageTicketID,
- ifnull(cm_shop_order.brokerage, 0) AS brokerage,
- cm_shop_order.delFlag,
- ifnull(cm_shop_order.refundsAmount, 0) AS refundsAmount,
- cm_shop_order.orderStatusFlag,
- cm_shop_order.buyStatus,
- cm_shop_order.deliveryTimeMills,
- cm_shop_order.confirmTime,
- cm_shop_order.updateTime,
- cm_shop_order.orderDeliveryID,
- cm_shop_order.splitFlag,
- cm_shop_order.receiptedFlag,
- cm_shop_order.receiptedType,
- cm_shop_order.paying,
- ifnull(cm_shop_order.shopProductAmount, 0) AS shopProductAmount,
- ifnull(cm_shop_order.shopPostFee, 0) AS shopPostFee,
- cm_shop_order.shopPostFlag,
- ifnull(cm_shop_order.shopTaxFee, 0) AS shopTaxFee,
- ifnull(cm_shop_order.payCmAmount, 0) AS payCmAmount,
- ifnull(cm_shop_order.shouldPayShopAmount, 0) AS shouldPayShopAmount,
- ifnull(cm_shop_order.payedShopAmount, 0) AS payedShopAmount,
- ifnull(cm_shop_order.shopOtherFee, 0) AS shopOtherFee,
- cm_shop_order.costType,
- ifnull(cm_shop_order.proportional, 0) AS proportional,
- cm_shop_order.modifyShouldPayNote,
- cm_shop_order.modifyShouldPayUserID,
- cm_shop_order.modifyShouldPayDate,
- cm_shop_order.zeroCostFlag,
- cm_shop_order.differenceType,
- ifnull(cm_shop_order.differencePrice, 0) AS differencePrice,
- ifnull(cm_shop_order.svipShopReduction, 0) AS svipShopReduction,
- ifnull(cm_shop_order.shopRefundAmount, 0) AS shopRefundAmount,
- cm_shop_order.splitCode,
- cm_shop_order.paySuccessCounter,
- cm_shop_order.onlinePayWays,
- cm_shop_order.receiptStatus,
- ifnull(cm_shop_order.receiptAmount, 0) AS receiptAmount,
- ifnull(cm_shop_order.eachDiscount, 0) AS eachDiscount,
- ifnull(cm_shop_order.realPay, 0) AS realPay,
- cm_shop_order.discountFee,
- cm_shop_order.fee
- </sql>
- <select id="getByCmShopOrder" parameterType="com.caimei.modules.order.entity.NewShopOrder"
- resultMap="CmShopOrderResult">
- <include refid="selectCmShopOrderVo"/>
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- order by cm_shop_order.orderTime desc
- limit 0,1
- </select>
- <select id="getCmShopOrderList" parameterType="com.caimei.modules.order.entity.NewShopOrder"
- resultMap="CmShopOrderResult">
- <include refid="selectCmShopOrderVo"/>
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- order by cm_shop_order.orderTime desc
- </select>
- <select id="getCmShopOrderCount" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
- select count(1)
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- </select>
- <select id="getCmShopOrderByShopOrderID" parameterType="String" resultMap="CmShopOrderResult">
- <include refid="selectCmShopOrderVo"/>
- from cm_shop_order AS cm_shop_order
- where cm_shop_order.delFlag = 0 and cm_shop_order.shopOrderID = #{shopOrderID}
- </select>
- <select id="getByIds" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
- select shopOrderID
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- </select>
- <select id="getById" parameterType="com.caimei.modules.order.entity.NewShopOrder" resultType="String">
- select shopOrderID
- from cm_shop_order AS cm_shop_order
- <where>cm_shop_order.delFlag = 0
- <if test="shopOrderID != null and shopOrderID != ''">
- and cm_shop_order.shopOrderID
- = #{shopOrderID}
- </if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('=')!=-1">
- <if test="shopOrderID.toString().toUpperCase().indexOf('NOT')!=-1">not</if>
- <if test="shopOrderID.toString().toUpperCase().indexOf('IN')!=-1">in</if>
- <foreach item="shopOrderIDIn"
- collection="shopOrderID.toString().substring(shopOrderID.toUpperCase().toString().indexOf('=')+1,shopOrderID.toString().length()).trim().split(',')"
- open="(" separator="," close=")">
- #{shopOrderIDIn}
- </foreach>
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">and cm_shop_order.shopOrderNo = #{shopOrderNo}</if>
- <if test="orderNo != null and orderNo != ''">and cm_shop_order.orderNo = #{orderNo}</if>
- <if test="orderID != null ">and cm_shop_order.orderID = #{orderID}</if>
- <if test="organizeID != null ">and cm_shop_order.organizeID = #{organizeID}</if>
- <if test="isColdChina != null ">and cm_shop_order.isColdChina = #{isColdChina}</if>
- <if test="userID != null ">and cm_shop_order.userID = #{userID}</if>
- <if test="shopID != null ">and cm_shop_order.shopID = #{shopID}</if>
- <if test="orderPromotionsId != null ">and cm_shop_order.orderPromotionsId = #{orderPromotionsId}</if>
- <if test="orderType != null ">and cm_shop_order.orderType = #{orderType}</if>
- <if test="orderSubmitType != null ">and cm_shop_order.orderSubmitType = #{orderSubmitType}</if>
- <if test="presentNum != null ">and cm_shop_order.presentNum = #{presentNum}</if>
- <if test="itemCount != null ">and cm_shop_order.itemCount = #{itemCount}</if>
- <if test="outStoreNum != null ">and cm_shop_order.outStoreNum = #{outStoreNum}</if>
- <if test="outStoreTimes != null ">and cm_shop_order.outStoreTimes = #{outStoreTimes}</if>
- <if test="townID != null ">and cm_shop_order.townID = #{townID}</if>
- <if test="note != null and note != ''">and cm_shop_order.note = #{note}</if>
- <if test="eachDiscount != null ">and cm_shop_order.eachDiscount = #{eachDiscount}</if>
- <if test="realPay != null ">and cm_shop_order.realPay = #{realPay}</if>
- <if test="receiptAmount != null ">and cm_shop_order.receiptAmount = #{receiptAmount}</if>
- <if test="accountAmount != null ">and cm_shop_order.accountAmount = #{accountAmount}</if>
- <if test="productAmount != null ">and cm_shop_order.productAmount = #{productAmount}</if>
- <if test="totalAmount != null ">and cm_shop_order.totalAmount = #{totalAmount}</if>
- <if test="needPayAmount != null ">and cm_shop_order.needPayAmount = #{needPayAmount}</if>
- <if test="discountAmount != null ">and cm_shop_order.discountAmount = #{discountAmount}</if>
- <if test="preferential != null ">and cm_shop_order.preferential = #{preferential}</if>
- <if test="promotionFullReduction != null ">and cm_shop_order.promotionFullReduction =
- #{promotionFullReduction}
- </if>
- <if test="payFlag != null and payFlag != ''">and cm_shop_order.payFlag = #{payFlag}</if>
- <if test="orderTime != null and orderTime != ''">and cm_shop_order.orderTime = #{orderTime}</if>
- <if test="payTime != null and payTime != ''">and cm_shop_order.payTime = #{payTime}</if>
- <if test="finishTime != null and finishTime != ''">and cm_shop_order.finishTime = #{finishTime}</if>
- <if test="autoOverTimeMills != null ">and cm_shop_order.autoOverTimeMills = #{autoOverTimeMills}</if>
- <if test="settleStatus != null and settleStatus != ''">and cm_shop_order.settleStatus = #{settleStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">and cm_shop_order.payStatus = #{payStatus}</if>
- <if test="receiptStatus != null and receiptStatus != ''">and cm_shop_order.receiptStatus =
- #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">and cm_shop_order.sendOutStatus =
- #{sendOutStatus}
- </if>
- <if test="refundStatus != null ">and cm_shop_order.refundStatus = #{refundStatus}</if>
- <if test="returnGoodsStatus != null ">and cm_shop_order.returnGoodsStatus = #{returnGoodsStatus}</if>
- <if test="receiveGoodsTime != null and receiveGoodsTime != ''">and cm_shop_order.receiveGoodsTime =
- #{receiveGoodsTime}
- </if>
- <if test="autoReceiveTimeMills != null ">and cm_shop_order.autoReceiveTimeMills = #{autoReceiveTimeMills}
- </if>
- <if test="totalAddedValueTax != null ">and cm_shop_order.totalAddedValueTax = #{totalAddedValueTax}</if>
- <if test="canRefundAmount != null ">and cm_shop_order.canRefundAmount = #{canRefundAmount}</if>
- <if test="refundAmount != null ">and cm_shop_order.refundAmount = #{refundAmount}</if>
- <if test="clubID != null ">and cm_shop_order.clubID = #{clubID}</if>
- <if test="spID != null ">and cm_shop_order.spID = #{spID}</if>
- <if test="mainSpID != null ">and cm_shop_order.mainSpID = #{mainSpID}</if>
- <if test="orderBeanAmount != null ">and cm_shop_order.orderBeanAmount = #{orderBeanAmount}</if>
- <if test="useBeanAmount != null ">and cm_shop_order.useBeanAmount = #{useBeanAmount}</if>
- <if test="useBeanFlag != null ">and cm_shop_order.useBeanFlag = #{useBeanFlag}</if>
- <if test="canRefundFlag != null ">and cm_shop_order.canRefundFlag = #{canRefundFlag}</if>
- <if test="useBalanceFlag != null ">and cm_shop_order.useBalanceFlag = #{useBalanceFlag}</if>
- <if test="canRefundBeans != null ">and cm_shop_order.canRefundBeans = #{canRefundBeans}</if>
- <if test="freePostageFee != null ">and cm_shop_order.freePostageFee = #{freePostageFee}</if>
- <if test="freePostageTicketID != null ">and cm_shop_order.freePostageTicketID = #{freePostageTicketID}</if>
- <if test="brokerage != null ">and cm_shop_order.brokerage = #{brokerage}</if>
- <if test="delFlag != null and delFlag != ''">and cm_shop_order.delFlag = #{delFlag}</if>
- <if test="refundsAmount != null ">and cm_shop_order.refundsAmount = #{refundsAmount}</if>
- <if test="orderStatusFlag != null and orderStatusFlag != ''">and cm_shop_order.orderStatusFlag =
- #{orderStatusFlag}
- </if>
- <if test="buyStatus != null and buyStatus != ''">and cm_shop_order.buyStatus = #{buyStatus}</if>
- <if test="deliveryTimeMills != null and deliveryTimeMills != ''">and cm_shop_order.deliveryTimeMills =
- #{deliveryTimeMills}
- </if>
- <if test="orderDeliveryID != null ">and cm_shop_order.orderDeliveryID = #{orderDeliveryID}</if>
- <if test="splitFlag != null and splitFlag != ''">and cm_shop_order.splitFlag = #{splitFlag}</if>
- <if test="paying != null and paying != ''">and cm_shop_order.paying = #{paying}</if>
- <if test="shopProductAmount != null ">and cm_shop_order.shopProductAmount = #{shopProductAmount}</if>
- <if test="shopPostFee != null ">and cm_shop_order.shopPostFee = #{shopPostFee}</if>
- <if test="shopPostFlag != null and shopPostFlag != ''">and cm_shop_order.shopPostFlag = #{shopPostFlag}
- </if>
- <if test="shopTaxFee != null ">and cm_shop_order.shopTaxFee = #{shopTaxFee}</if>
- <if test="payCmAmount != null ">and cm_shop_order.payCmAmount = #{payCmAmount}</if>
- <if test="shouldPayShopAmount != null ">and cm_shop_order.shouldPayShopAmount = #{shouldPayShopAmount}</if>
- <if test="payedShopAmount != null ">and cm_shop_order.payedShopAmount = #{payedShopAmount}</if>
- <if test="shopOtherFee != null ">and cm_shop_order.shopOtherFee = #{shopOtherFee}</if>
- <if test="receiptedFlag != null and receiptedFlag != ''">and cm_shop_order.receiptedFlag =
- #{receiptedFlag}
- </if>
- <if test="receiptedType != null and receiptedType != ''">and cm_shop_order.receiptedType =
- #{receiptedType}
- </if>
- <if test="costType != null and costType != ''">and cm_shop_order.costType = #{costType}</if>
- <if test="proportional != null ">and cm_shop_order.proportional = #{proportional}</if>
- <if test="modifyShouldPayNote != null and modifyShouldPayNote != ''">and cm_shop_order.modifyShouldPayNote
- = #{modifyShouldPayNote}
- </if>
- <if test="modifyShouldPayUserID != null ">and cm_shop_order.modifyShouldPayUserID =
- #{modifyShouldPayUserID}
- </if>
- <if test="modifyShouldPayDate != null ">and cm_shop_order.modifyShouldPayDate = #{modifyShouldPayDate}</if>
- <if test="zeroCostFlag != null ">and cm_shop_order.zeroCostFlag = #{zeroCostFlag}</if>
- <if test="differenceType != null and differenceType != ''">and cm_shop_order.differenceType =
- #{differenceType}
- </if>
- <if test="differencePrice != null ">and cm_shop_order.differencePrice = #{differencePrice}</if>
- <if test="svipShopReduction != null ">and cm_shop_order.svipShopReduction = #{svipShopReduction}</if>
- <if test="splitCode != null and splitCode != ''">and cm_shop_order.splitCode = #{splitCode}</if>
- <if test="paySuccessCounter != null ">and cm_shop_order.paySuccessCounter = #{paySuccessCounter}</if>
- <if test="onlinePayWays != null and onlinePayWays != ''">and cm_shop_order.onlinePayWays =
- #{onlinePayWays}
- </if>
- <if test="status != null and status != ''">and cm_shop_order.shopStatus = #{status}</if>
- </where>
- group by cm_shop_order.shopOrderID
- limit 0,1
- </select>
- <select id="getShopOrderlist" resultType="com.caimei.modules.order.entity.NewShopOrder">
- select cso.shopOrderID,
- cso.shopOrderNo,
- cso.orderId,
- cso.orderNo,
- cso.organizeID,
- cso.userID,
- cso.clubID,
- cso.orderType,
- bou.shouHuoRen AS receiver,
- co.orderSource,
- cso.needPayAmount,
- cso.orderTime,
- cso.confirmTime,
- cso.payStatus,
- cso.sendOutStatus,
- cso.receiptStatus,
- cso.refundStatus,
- cso.shopStatus,
- u.name AS buyer,
- (case when co.orderType = '0' then
- (select case status when 91 then '采美默认协销经理(官方账号)' else linkMan end from serviceprovider where serviceProviderID
- = co.spID)
- else
- ''
- end) AS spName,
- co.rebateFlag,
- cso.closeTime,
- (SELECT COUNT(*) FROM cm_returned_purchase
- WHERE shopOrderId = cso.shopOrderId AND status =1 AND delFLag = 0) AS returnedPurchaseStatus,
- co.closeReason AS closeReason
- from cm_shop_order cso
- left join cm_order co on cso.orderId = co.orderId
- left join bp_order_userinfo bou on bou.orderId = cso.orderId
- <if test="productName != null and productName != ''">
- LEFT JOIN cm_order_product cop ON co.orderID = cop.orderID
- LEFT JOIN product p ON cop.productID = p.productID
- </if>
- LEFT JOIN user u ON u.userID = cso.userID
- <where>
- cso.delFlag = 0
- and co.delflag = 0
- and cso.orderType != 2
- <if test="serviceProviderId != null and serviceProviderId != 0">
- and cso.orderType = 0
- and co.spID = #{serviceProviderId}
- </if>
- <if test="shopOrderNo != null and shopOrderNo != ''">
- AND cso.shopOrderNo = #{shopOrderNo}
- </if>
- <if test="shopOrderID != null and shopOrderID != ''">
- AND cso.shopOrderID = #{shopOrderID}
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND cso.orderNo = #{orderNo}
- </if>
- <if test="orderID != null and orderID != ''">
- AND cso.orderID = #{orderID}
- </if>
- <if test="buyer != null and buyer != ''">
- AND u.name LIKE concat('%',#{buyer},'%')
- </if>
- <if test="status != null">
- AND cso.shopStatus = #{status}
- </if>
- <if test="productName != null and productName != ''">
- and p.name like CONCAT('%',#{productName},'%')
- </if>
- <if test="receiptStatus != null and receiptStatus != ''">
- AND cso.receiptStatus = #{receiptStatus}
- </if>
- <if test="sendOutStatus != null and sendOutStatus != ''">
- AND cso.sendOutStatus = #{sendOutStatus}
- </if>
- <if test="payStatus != null and payStatus != ''">
- AND cso.payStatus = #{payStatus}
- </if>
- <if test="refundStatus != null and refundStatus != ''">
- AND cso.refundStatus = #{refundStatus}
- </if>
- <if test="orderType != null">
- AND cso.orderType = #{orderType}
- </if>
- <if test="spID != null and spID != ''">
- AND co.spId = #{spID}
- </if>
- <if test="rebateFlag != null and rebateFlag != ''">
- AND co.rebateFlag = #{rebateFlag}
- </if>
- <if test="orderSource != null and orderSource != ''">
- AND co.orderSource = #{orderSource}
- </if>
- <if test="organizeID != null and organizeID != ''">
- AND cso.organizeID = #{organizeID}
- </if>
- <if test="receiver != null and receiver != ''">
- AND bou.shouHuoRen LIKE concat('%',#{receiver},'%')
- </if>
- <if test="startTime != null and startTime != ''">
- AND cso.orderTime <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND cso.orderTime <![CDATA[ <= ]]> #{endTime}
- </if>
- <if test="startConfirmTime != null and startConfirmTime != ''">
- AND cso.confirmTime <![CDATA[ >= ]]> #{startConfirmTime}
- </if>
- <if test="endConfirmTime != null and endConfirmTime != ''">
- AND cso.confirmTime <![CDATA[ <= ]]> #{endConfirmTime}
- </if>
- <if test="returnedPurchaseStatus != null and returnedPurchaseStatus != ''">
- AND
- <if test="returnedPurchaseStatus == 1">
- exists
- </if>
- <if test="returnedPurchaseStatus == 0">
- not exists
- </if>
- (select 1 from cm_returned_purchase
- where status = 1 and shopOrderId = cso.shopOrderId and delFlag= 0)
- </if>
- </where>
- ORDER BY cso.shopOrderID DESC
- </select>
- <select id="findCmProfit" resultType="com.caimei.modules.order.entity.OtherFeeDto">
- select IF((SELECT SUM(cdr.receiptAmount)
- FROM cm_discern_receipt cdr
- LEFT JOIN cm_receipt_order_relation cror ON cdr.id = cror.receiptId
- WHERE cdr.receiptType IN (10, 11)
- AND cdr.receiptStatus NOT IN (1, 4, 5)
- AND cdr.delflag = 0
- AND cror.shopOrderId = acso.shopOrderId) > 0, 0,
- (SELECT acso.needpayAmount
- - SUM(IFNULL(op.costprice, 0) * (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0)))
- - SUM(IFNULL(op.organizeCostPrice, 0) * (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0)))
- - SUM(IFNULL(op.cmCostPrice, 0) * (IFNULL(op.num, 0) + IFNULL(op.presentNum, 0)))
- - (IFNULL(SUM(acso.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>
- <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>
|