12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120 |
- <?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.kmall.admin.dao.OrderDao">
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.kmall.admin.entity.OrderEntity" id="orderMap">
- <result property="id" column="id"/>
- <result property="merchOrderSn" column="merch_order_sn"/>
- <result property="orderSn" column="order_sn"/>
- <result property="userId" column="user_id"/>
- <result property="orderStatus" column="order_status"/>
- <result property="shippingStatus" column="shipping_status"/>
- <result property="payStatus" column="pay_status"/>
- <result property="consignee" column="consignee"/>
- <result property="country" column="country"/>
- <result property="province" column="province"/>
- <result property="city" column="city"/>
- <result property="district" column="district"/>
- <result property="address" column="address"/>
- <result property="mobile" column="mobile"/>
- <result property="postscript" column="postscript"/>
- <result property="shippingId" column="shipping_id"/>
- <result property="shippingName" column="shipping_name"/>
- <result property="shippingCode" column="shipping_code"/>
- <result property="shippingNo" column="shipping_no"/>
- <result property="payId" column="pay_id"/>
- <result property="payName" column="pay_name"/>
- <result property="payMobile" column="pay_mobile"/>
- <result property="shippingFee" column="shipping_fee"/>
- <result property="actualPrice" column="actual_price"/>
- <result property="integral" column="integral"/>
- <result property="integralMoney" column="integral_money"/>
- <result property="orderPrice" column="order_price"/>
- <result property="goodsPrice" column="goods_price"/>
- <result property="addTime" column="add_time"/>
- <result property="confirmTime" column="confirm_time"/>
- <result property="payTime" column="pay_time"/>
- <result property="freightPrice" column="freight_price"/>
- <result property="couponId" column="coupon_id"/>
- <result property="couponPrice" column="coupon_price"/>
- <result property="callbackStatus" column="callback_status"/>
- <result property="orderType" column="order_type"/>
- <result property="storeId" column="store_id"/>
- <result property="userName" column="username"/>
- <result property="orderType" column="order_type"/>
- <result property="activityId" column="activity_id"/>
- <result property="deliveryDate" column="delivery_date"/>
- <result property="deliveryRemark" column="delivery_remark"/>
- <result property="predictTime" column="predict_time"/>
- <result property="orderBizType" column="order_biz_type"/>
- <result property="isPaymentSend" column="is_payment_send"/>
- <result property="isEleOrderSend" column="is_ele_order_send"/>
- <result property="isCustomsSend" column="is_customs_send"/>
- <result property="payFlag" column="pay_flag"/>
- <result column="buyer_pay_check" property="buyerPayCheck"/>
- <result property="merchSn" column="merch_sn"/>
- <result property="sku" column="sku"/>
- <result property="createTime" column="create_time"/>
- <result property="modTime" column="mod_time"/>
- <result property="isOnfflineOrder" column="is_onffline_order"/>
- <result property="orderSnWx" column="order_sn_wx"/>
- <result property="isMergePay" column="is_merge_pay"/>
- <result property="payTransactionId" column="pay_transaction_id"/>
- <result property="storeName" column="store_name"/>
- <result property="moderSn" column="moder_sn"/>
- <result property="unitCode" column="unit_code"/>
- <result property="ciqProdModel" column="ciq_prod_model"/>
- <result property="oriCntCode" column="ori_cnt_code"/>
- <result property="brand" column="brand"/>
- <result column="gross_weight" property="grossWeight" />
- <result column="net_weight" property="netWeight" />
- <result property="fullCutPrice" column="full_cut_price"/>
- <result property="campMinusId" column="camp_minus_id"/>
- <result property="campName" column="camp_name"/>
- <result property="pickUpCodeSn" column="pick_up_code_sn"/>
- <result property="pickUpCodeStatus" column="pick_up_code_status"/>
- <result property="pickUpCodeSn" column="pick_up_code_sn"/>
- </resultMap>
- <select id="queryObject" resultType="com.kmall.admin.entity.OrderEntity">
- select o.*,u.username as username
- from mall_order o
- left join mall_user u on o.user_id = u.id
- where o.id = #{value}
- </select>
- <select id="queryObjectBySysUser" resultType="com.kmall.admin.entity.OrderEntity">
- select o.*,u.username as username
- from mall_order o
- left join sys_user u on o.user_id = u.user_id
- where o.id = #{value}
- </select>
- <select id="queryObjectByActivityId" resultType="com.kmall.admin.entity.OrderEntity">
- select o.*,u.username as username
- from mall_order o
- left join mall_user u on o.user_id = u.id
- where o.activity_id = #{activityId}
- </select>
- <select id="getTotalActualPrice" resultType="java.lang.Double">
- select sum(a.actual_price) 'totalActualPrice' from mall_order a where merch_order_sn = #{merchOrderSn}
- </select>
- <select id="queryObjectByMerchOrderSn" resultType="com.kmall.admin.entity.OrderEntity">
- select * from mall_order a where merch_order_sn = #{merchOrderSn}
- </select>
- <select id="queryObjectByOrderSn" resultType="com.kmall.admin.entity.OrderEntity">
- select o.*,c.pick_up_code_sn
- from mall_order o
- left join mall_pick_up_code c
- on c.order_sn = o.order_sn where o.order_sn = #{orderSn}
- </select>
- <select id="queryList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT DISTINCT
- o.order_sn,
- o.merch_order_sn,
- o.order_status,
- o.actual_price,
- o.order_biz_type,
- o.shipping_no,
- o.shipping_name,
- o.shipping_code,
- o.consignee,
- o.mobile,
- o.province,
- o.city,
- o.district,
- o.address,
- o.add_time,
- o.pay_id,
- o.pay_status,
- o.shipping_status,
- o.is_merge_pay,
- o.buyer_pay_check,
- o.order_price,
- o.moder_sn,
- o.id,
- u.username AS username,
- p.is_payment_send,
- p.is_ele_order_send,
- p.is_customs_send,
- s.store_name,
- o.full_cut_price,
- o.camp_minus_id,
- o.camp_name
- FROM
- mall_order o
- LEFT JOIN mall_user u ON o.user_id = u.id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- left join mall_store s on o.store_id = s.id
- LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
- AND r.goods_id = g.goods_id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- WHERE 1=1
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND gs.prod_barcode = #{prodBarcode}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND t.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="supplierThirdId != null and supplierThirdId != ''">
- AND r.supplier_third_id = #{supplierThirdId}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by o.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryExportList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT
- o.order_sn,
- o.merch_order_sn,
- o.order_status,
- o.actual_price,
- o.order_biz_type,
- o.shipping_no,
- o.shipping_name,
- o.shipping_code,
- o.consignee,
- o.mobile,
- o.province,
- o.city,
- o.district,
- o.address,
- o.add_time,
- o.pay_id,
- o.shipping_status,
- o.shipping_fee,
- o.moder_sn,
- o.pay_transaction_id,
- u.id_no 'idNo',
- u.username AS username,
- p.is_payment_send,
- p.is_ele_order_send,
- p.is_customs_send,
- g.sku,
- g.goods_name,
- g.number,
- g.retail_price,
- s.store_name,
- nc.NAME ori_cnt_code,
- good.ciq_prod_model,
- good.brand,
- uc.NAME unit_code,
- good.gross_weight * g.number gross_weight,
- good.net_weight * g.number net_weight,
- t2.third_party_merch_name 'supplierThirdPartyMerchName',
- t2.third_party_merch_code 'supplierThirdPartyMerchCode'
- FROM
- mall_order o
- LEFT JOIN mall_user u ON o.user_id = u.id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_store s ON o.store_id = s.id
- LEFT JOIN mall_goods good ON good.id = g.goods_id
- LEFT JOIN sys_cus_nation_code nc ON nc.CODE = good.ori_cnt_code
- LEFT JOIN sys_cus_unit_code uc ON uc.CODE = good.unit_code
- LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
- LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
- AND r.goods_id = g.goods_id
- LEFT JOIN third_merchant_biz t2 ON t2.third_merch_sn = r.supplier_third_id
- WHERE
- 1 =1
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND g.sku = #{sku}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND t.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="supplierThirdId != null and supplierThirdId != ''">
- AND r.supplier_third_id = #{supplierThirdId}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- </select>
- <select id="queryTotal" resultType="int">
- select count(DISTINCT o.id) FROM
- mall_order o
- LEFT JOIN mall_user u ON o.user_id = u.id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- left join mall_store s on o.store_id = s.id
- LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
- AND r.goods_id = g.goods_id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- WHERE 1=1
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND gs.prod_barcode = #{prodBarcode}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND t.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="supplierThirdId != null and supplierThirdId != ''">
- AND r.supplier_third_id = #{supplierThirdId}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- </select>
- <select id="queryOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT distinct
- o.id,
- o.order_sn,
- u.username as userName,
- c.pick_up_code_sn,
- o.pay_name,
- o.mobile,
- o.is_onffline_order,
- o.order_biz_type,
- o.order_status,
- o.pay_status,
- o.coupon_name,
- o.coupon_price,
- o.actual_price,
- o.order_price,
- o.pay_time,
- o.pay_flag
- from mall_order o
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_sale_record record ON record.order_sn = o.order_sn
- LEFT JOIN sys_user u ON record.saller_id = u.user_id
- LEFT JOIN mall_pick_up_code c ON o.order_sn = c.order_sn
- WHERE 1=1
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="goodsSn != null and goodsSn.trim() != ''">
- AND gs.goods_sn = #{goodsSn}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND gs.prod_barcode = #{prodBarcode}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryOffilineOrderTotal" resultType="int">
- select count(DISTINCT o.id) FROM
- mall_order o
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_sale_record record ON record.order_sn = o.order_sn
- LEFT JOIN sys_user u ON record.saller_id = u.user_id
- LEFT JOIN mall_pick_up_code c ON o.order_sn = c.order_sn
- WHERE 1=1
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="goodsSn != null and goodsSn.trim() != ''">
- AND gs.goods_sn = #{goodsSn}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND gs.prod_barcode = #{prodBarcode}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- </select>
- <insert id="save" parameterType="com.kmall.api.entity.OrderVo" useGeneratedKeys="true" keyProperty="id">
- insert into mall_order
- (
- `order_sn`,
- `user_id`,
- `order_status`,
- `shipping_status`,
- `pay_status`,
- `consignee`,
- `country`,
- `province`,
- `city`,
- `district`,
- `address`,
- `mobile`,
- `postscript`,
- `shipping_id`,
- `shipping_name`,
- `shipping_code`,
- `shipping_no`,
- `pay_id`,
- `pay_name`,
- `shipping_fee`,
- `actual_price`,
- `integral`,
- `integral_money`,
- `order_price`,
- `goods_price`,
- `add_time`,
- `confirm_time`,
- `pay_time`,
- `freight_price`,
- `coupon_id`,
- `coupon_price`,
- full_cut_price,
- camp_minus_id,
- camp_name,
- `callback_status`,
- `order_type`,
- `store_id`,
- `order_biz_type`,
- `is_onffline_order`,
- `order_sn_wx`,
- `pay_flag`,
- `merch_sn`,
- `create_time`,
- `mod_time`
- )
- values
- (
- #{orderSn},
- #{userId},
- #{orderStatus},
- #{shippingStatus},
- #{payStatus},
- #{consignee},
- #{country},
- #{province},
- #{city},
- #{district},
- #{address},
- #{mobile},
- #{postscript},
- #{shippingId},
- #{shippingName},
- #{shippingCode},
- #{shippingNo},
- #{payId},
- #{payName},
- #{shippingFee},
- #{actualPrice},
- #{integral},
- #{integralMoney},
- #{orderPrice},
- #{goodsPrice},
- #{addTime},
- #{confirmTime},
- #{payTime},
- #{freightPrice},
- #{couponId},
- #{couponPrice},
- #{fullCutPrice},
- #{campMinusId},
- #{campName},
- #{callbackStatus},
- #{orderType},
- #{storeId},
- #{orderBizType},
- #{isOnfflineOrder},
- #{orderSnWx},
- #{payFlag},
- #{merchSn},
- #{createTime},
- #{modTime}
- )
- </insert>
- <insert id="saveOrderVo" parameterType="com.kmall.api.entity.OrderVo" useGeneratedKeys="true" keyProperty="id">
- insert into mall_order
- (
- `order_sn`,
- `user_id`,
- `order_status`,
- `shipping_status`,
- `shipping_code`,
- `pay_status`,
- `consignee`,
- `country`,
- `province`,
- `city`,
- `district`,
- `address`,
- `address_id`,
- `mobile`,
- `postscript`,
- `pay_id`,
- `pay_name`,
- `shipping_fee`,
- `actual_price`,
- `cash_fee`,
- `cash_fee_type`,
- `total_fee`,
- `fee_type`,
- `rate`,
- `integral`,
- `integral_money`,
- `order_price`,
- `goods_price`,
- `add_time`,
- `confirm_time`,
- `pay_time`,
- `freight_price`,
- `coupon_id`,
- `coupon_price`,
- `full_cut_price`,
- camp_minus_id,
- camp_name,
- `order_type`,
- `activity_id`,
- `store_id`,
- `delivery_date`,
- `delivery_remark`,
- `predict_time`,
- `coupon_name`,
- `comment_count`,
- <if test="merchSn != null" >
- merch_sn,
- </if>
- <if test="merchOrderSn != null" >
- merch_order_sn,
- </if>
- <if test="isScan != null" >
- is_scan,
- </if>
- <if test="isMergePay != null" >
- is_merge_pay,
- </if>
- <if test="orderBizType != null" >
- order_biz_type,
- </if>
- <if test="payTransactionId != null" >
- pay_transaction_id,
- </if>
- <if test="payMobile != null" >
- pay_mobile,
- </if>
- <if test="buyerPayCheck != null" >
- buyer_pay_check,
- </if>
- <if test="isOnfflineOrder != null" >
- `is_onffline_order`,
- </if>
- <if test="payFlag != null" >
- pay_flag,
- </if>
- <if test="createrSn != null" >
- creater_sn,
- </if>
- <if test="createTime != null" >
- create_time,
- </if>
- <if test="moderSn != null" >
- moder_sn,
- </if>
- <if test="modTime != null" >
- mod_time
- </if>
- )
- values
- (
- #{order_sn},
- #{user_id},
- #{order_status},
- #{shipping_status},
- #{shipping_code},
- #{pay_status},
- #{consignee},
- #{country},
- #{province},
- #{city},
- #{district},
- #{address},
- #{address_id},
- #{mobile},
- #{postscript},
- #{pay_id},
- #{pay_name},
- #{shipping_fee},
- #{actual_price},
- #{cashFee},
- #{cashFeeType},
- #{totalFee},
- #{feeType},
- #{rate},
- #{integral},
- #{integral_money},
- #{order_price},
- #{goods_price},
- now(),
- #{confirm_time},
- #{pay_time},
- #{freight_price},
- #{coupon_id},
- #{coupon_price},
- #{full_cut_price},
- #{campMinusId},
- #{campName},
- #{order_type},
- #{activity_id},
- #{store_id},
- #{delivery_date},
- #{delivery_remark},
- #{predict_time},
- #{coupon_name},
- #{comment_count},
- <if test="merchSn != null" >
- #{merchSn},
- </if>
- <if test="merchOrderSn != null" >
- #{merchOrderSn},
- </if>
- <if test="isScan != null" >
- #{isScan},
- </if>
- <if test="isMergePay != null" >
- #{isMergePay},
- </if>
- <if test="orderBizType != null" >
- #{orderBizType,jdbcType=CHAR},
- </if>
- <if test="payTransactionId != null" >
- #{payTransactionId},
- </if>
- <if test="payMobile != null" >
- #{payMobile},
- </if>
- <if test="buyerPayCheck != null" >
- #{buyerPayCheck},
- </if>
- <if test="isOnfflineOrder != null" >
- #{isOnfflineOrder},
- </if>
- <if test="payFlag != null" >
- #{payFlag},
- </if>
- <if test="createrSn != null" >
- #{createrSn},
- </if>
- <if test="createTime != null" >
- #{createTime},
- </if>
- <if test="moderSn != null" >
- #{moderSn},
- </if>
- <if test="modTime != null" >
- #{modTime}
- </if>
- )
- </insert>
- <update id="update" parameterType="com.kmall.admin.entity.OrderEntity">
- update mall_order
- <set>
- <if test="orderSn != null">`order_sn` = #{orderSn},</if>
- <if test="userId != null">`user_id` = #{userId},</if>
- <if test="orderStatus != null">`order_status` = #{orderStatus},</if>
- <if test="shippingStatus != null">`shipping_status` = #{shippingStatus},</if>
- <if test="payStatus != null">`pay_status` = #{payStatus},</if>
- <if test="consignee != null">`consignee` = #{consignee},</if>
- <if test="country != null">`country` = #{country},</if>
- <if test="province != null">`province` = #{province},</if>
- <if test="city != null">`city` = #{city},</if>
- <if test="district != null">`district` = #{district},</if>
- <if test="address != null">`address` = #{address},</if>
- <if test="mobile != null">`mobile` = #{mobile},</if>
- <if test="postscript != null">`postscript` = #{postscript},</if>
- <if test="shippingId != null">`shipping_id` = #{shippingId},</if>
- <if test="shippingName != null">`shipping_name` = #{shippingName},</if>
- <if test="shippingCode != null">`shipping_code` = #{shippingCode},</if>
- <if test="shippingNo != null">`shipping_no` = #{shippingNo},</if>
- <if test="payId != null">`pay_id` = #{payId},</if>
- <if test="payName != null">`pay_name` = #{payName},</if>
- <if test="shippingFee != null">`shipping_fee` = #{shippingFee},</if>
- <if test="actualPrice != null">`actual_price` = #{actualPrice},</if>
- <if test="integral != null">`integral` = #{integral},</if>
- <if test="integralMoney != null">`integral_money` = #{integralMoney},</if>
- <if test="orderPrice != null">`order_price` = #{orderPrice},</if>
- <if test="goodsPrice != null">`goods_price` = #{goodsPrice},</if>
- <if test="addTime != null">`add_time` = #{addTime},</if>
- <if test="confirmTime != null">`confirm_time` = #{confirmTime},</if>
- <if test="payTime != null">`pay_time` = #{payTime},</if>
- <if test="freightPrice != null">`freight_price` = #{freightPrice},</if>
- <if test="couponId != null">`coupon_id` = #{couponId},</if>
- <if test="couponPrice != null">`coupon_price` = #{couponPrice},</if>
- <if test="fullCutPrice != null">`full_cut_price` = #{fullCutPrice},</if>
- <if test="campMinusId != null">`camp_minus_id` = #{campMinusId},</if>
- <if test="campName != null">`camp_name` = #{campName},</if>
- <if test="callbackStatus != null">`callback_status` = #{callbackStatus},</if>
- <if test="AliTradeNo != null">`ali_trade_no` = #{AliTradeNo},</if>
- <if test="orderType != null">`order_type` = #{orderType},</if>
- <if test="storeId != null">`store_id` = #{storeId},</if>
- <if test="payFlag != null">`pay_flag` = #{payFlag},</if>
- <if test="orderSnWx != null">`order_sn_wx` = #{orderSnWx},</if>
- <if test="orderBizType != null">`order_biz_type` = #{orderBizType},</if>
- <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
- <if test="createTime != null">`create_time` = #{createTime},</if>
- <if test="modTime != null">`mod_time` = #{modTime},</if>
- <if test="createrSn != null">`creater_sn` = #{createrSn},</if>
- <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
- </set>
- where id = #{id}
- </update>
- <delete id="delete">
- delete from mall_order where id = #{value}
- </delete>
- <delete id="deleteBatch">
- delete from mall_order where id in
- <foreach item="id" collection="array" open="(" separator="," close=")">
- #{id}
- </foreach>
- </delete>
- <update id="riderOrderUpdate" parameterType="com.kmall.admin.entity.OrderEntity">
- update mall_order
- <set>
- `order_status` = #{orderStatus},
- `shipping_status` = #{shippingStatus},
- `shipping_id` = #{shippingId},
- `shipping_name` = #{shippingName},
- `shipping_fee` = #{shippingFee},
- `shipping_no` = #{shippingNo},
- `shipping_mobile` = #{shippingMobile}
- </set>
- where id = #{id}
- </update>
- <select id="getYfkOrderUserSum" resultType="int">
- select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
- inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
- left join mall_store s on o.store_id = s.id
- where pay_status = 2
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- group by o.user_id) u
- </select>
- <select id="getOderUserSum" resultType="int">
- select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
- inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
- left join mall_store s on o.store_id = s.id
- where 1=1
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- group by o.user_id) u
- </select>
- <select id="getTodayUserOrder" resultType="int">
- select count(1) from mall_order o
- left join mall_store s on o.store_id = s.id
- where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- </select>
- <select id="getTodayUserSales" resultType="int">
- select ifnull(sum(o.actual_price),0) from mall_order o
- left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.pay_time > date_format(sysdate(), '%Y-%m-%d')
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- </select>
- <select id="getIncomeSum" resultType="int">
- select ifnull(sum(actual_price),0) from mall_order o
- left join mall_store s on o.store_id = s.id where o.pay_status = 2
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- </select>
- <select id="getPayedOrderCount" resultType="int">
- select count(1) from mall_order o
- left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.is_onffline_order = 0
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- </select>
- <select id="promOrderList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT
- s.prom_id,
- o.id,
- o.order_sn,
- o.merch_order_sn,
- o.actual_price,
- o.freight_price,
- o.activity_id,
- o.order_status,
- o.pay_status,
- store.store_name storeName,
- u.userName userName,
- o.buyer_pay_check,
- o.order_price,
- o.coupon_name couponName,
- o.add_time,
- o.shipping_status,
- (select count(1) from mall_order_goods where order_id = o.id) orderDetailCount,
- g.goods_id goodsId
- FROM
- mk_store_prom_stat s
- LEFT JOIN mk_store_prom_order_real r ON s.prom_id = r.prom_id
- LEFT JOIN mall_order o ON r.order_id = o.id
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- AND g.id = r.order_goods_id
- LEFT JOIN mall_store store ON o.store_id = store.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE
- r.order_id IS NOT NULL
- <if test="promId != null and promId != ''">
- AND s.prom_id = #{promId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND store.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by o.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryPromOrderTotal" resultType="int">
- SELECT
- count(*)
- FROM
- mk_store_prom_stat s
- LEFT JOIN mk_store_prom_order_real r ON s.prom_id = r.prom_id
- LEFT JOIN mall_order o ON r.order_id = o.id
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- AND g.id = r.order_goods_id
- LEFT JOIN mall_store store ON o.store_id = store.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE
- r.order_id IS NOT NULL
- <if test="promId != null and promId != ''">
- AND s.prom_id = #{promId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND store.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- </select>
- <select id="promOrderListExport" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT
- s.prom_id,
- o.id,
- o.order_sn,
- o.merch_order_sn,
- o.actual_price,
- g.goods_name,
- g.number,
- g.retail_price,
- o.freight_price,
- o.activity_id,
- o.order_status,
- o.pay_status,
- store.store_name storeName,
- u.userName userName,
- o.buyer_pay_check,
- o.order_price,
- o.add_time,
- o.shipping_status,
- g.goods_id goodsId
- FROM
- mk_store_prom_stat s
- LEFT JOIN mk_store_prom_order_real r ON s.prom_id = r.prom_id
- LEFT JOIN mall_order o ON r.order_id = o.id
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- AND g.id = r.order_goods_id
- LEFT JOIN mall_store store ON o.store_id = store.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE
- r.order_id IS NOT NULL
- <if test="promId != null and promId != ''">
- AND s.prom_id = #{promId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND store.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- </select>
- <select id="getActualPriceByOutProm" parameterType="map" resultType="java.lang.Double">
- SELECT
- o.actual_price - ( o.actual_price - g.retail_price * g.number ) promActualPrice
- FROM
- mk_store_prom_order_real r
- LEFT JOIN mall_order o ON r.order_id = o.id
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- AND g.id = r.order_goods_id
- WHERE 1=1
- AND g.goods_id = #{goodsId}
- AND r.order_id = #{orderId}
- <if test="statusList != null">
- AND o.order_status IN
- <foreach item="statusList" collection="statusList" open="(" separator="," close=")">
- #{statusList}
- </foreach>
- </if>
- </select>
- <select id="storeTopicOrderList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT
- s.title 'storeTopicName',
- pt.prom_type_name 'storeTopicType',
- ss.store_name 'storeName',
- s.id 'storeTopicId',
- o.id,
- o.order_sn,
- o.merch_order_sn,
- o.actual_price,
- o.freight_price,
- o.activity_id,
- o.coupon_id,
- o.coupon_name,
- o.camp_minus_id,
- o.camp_name,
- o.order_status,
- o.pay_status,
- u.userName userName,
- o.order_price,
- o.add_time,
- o.shipping_status
- FROM
- mall_order o
- INNER JOIN mall_store_topic s ON o.activity_id = s.id
- LEFT JOIN mk_store_prom_type pt ON s.prom_type_id = pt.prom_type_id
- LEFT JOIN mall_store ss ON o.store_id = ss.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE
- 1=1
- <if test="storeTopicId != null and storeTopicId != ''">
- AND s.id = #{storeTopicId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND ss.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- order by o.id DESC
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryStoreTopicOrderTotal" resultType="int">
- SELECT
- count(*)
- FROM
- mall_order o
- INNER JOIN mall_store_topic s ON o.activity_id = s.id
- LEFT JOIN mk_store_prom_type pt ON s.prom_type_id = pt.prom_type_id
- LEFT JOIN mall_store ss ON o.store_id = ss.id
- LEFT JOIN mall_user u ON o.user_id = u.id
- WHERE 1=1
- <if test="storeTopicId != null and storeTopicId != ''">
- AND s.id = #{storeTopicId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND ss.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- </select>
- <!-- 可根据自己的需求,是否要使用 -->
- <resultMap type="com.kmall.admin.dto.OrderRecognitionDto" id="orderRecognitionMap">
- <result property="id" column="id"/>
- <result property="merchOrderSn" column="merch_order_sn"/>
- <result property="orderSn" column="order_sn"/>
- <result property="userId" column="user_id"/>
- <result property="orderStatus" column="order_status"/>
- <result property="shippingStatus" column="shipping_status"/>
- <result property="payStatus" column="pay_status"/>
- <result property="consignee" column="consignee"/>
- <result property="country" column="country"/>
- <result property="province" column="province"/>
- <result property="city" column="city"/>
- <result property="district" column="district"/>
- <result property="address" column="address"/>
- <result property="mobile" column="mobile"/>
- <result property="postscript" column="postscript"/>
- <result property="shippingId" column="shipping_id"/>
- <result property="shippingName" column="shipping_name"/>
- <result property="shippingCode" column="shipping_code"/>
- <result property="shippingNo" column="shipping_no"/>
- <result property="payId" column="pay_id"/>
- <result property="payName" column="pay_name"/>
- <result property="shippingFee" column="shipping_fee"/>
- <result property="actualPrice" column="actual_price"/>
- <result property="integral" column="integral"/>
- <result property="integralMoney" column="integral_money"/>
- <result property="orderPrice" column="order_price"/>
- <result property="goodsPrice" column="goods_price"/>
- <result property="addTime" column="add_time"/>
- <result property="confirmTime" column="confirm_time"/>
- <result property="payTime" column="pay_time"/>
- <result property="freightPrice" column="freight_price"/>
- <result property="couponId" column="coupon_id"/>
- <result property="couponPrice" column="coupon_price"/>
- <result property="callbackStatus" column="callback_status"/>
- <result property="orderType" column="order_type"/>
- <result property="storeId" column="store_id"/>
- <result property="userName" column="username"/>
- <result property="orderType" column="order_type"/>
- <result property="activityId" column="activity_id"/>
- <result property="deliveryDate" column="delivery_date"/>
- <result property="deliveryRemark" column="delivery_remark"/>
- <result property="predictTime" column="predict_time"/>
- <result property="orderBizType" column="order_biz_type"/>
- <result property="isPaymentSend" column="is_payment_send"/>
- <result property="isEleOrderSend" column="is_ele_order_send"/>
- <result property="isCustomsSend" column="is_customs_send"/>
- <result property="payFlag" column="pay_flag"/>
- <result column="buyer_pay_check" property="buyerPayCheck"/>
- <result property="merchSn" column="merch_sn"/>
- <result property="sku" column="sku"/>
- <result property="createTime" column="create_time"/>
- <result property="modTime" column="mod_time"/>
- <result property="isOnfflineOrder" column="is_onffline_order"/>
- <result property="orderSnWx" column="order_sn_wx"/>
- <result property="isMergePay" column="is_merge_pay"/>
- <result property="payTransactionId" column="pay_transaction_id"/>
- <result property="storeName" column="store_name"/>
- <result property="moderSn" column="moder_sn"/>
- <result property="unitCode" column="unit_code"/>
- <result property="ciqProdModel" column="ciq_prod_model"/>
- <result property="oriCntCode" column="ori_cnt_code"/>
- <result property="brand" column="brand"/>
- <result column="gross_weight" property="grossWeight" />
- <result column="net_weight" property="netWeight" />
- <result property="fullCutPrice" column="full_cut_price"/>
- <result property="campMinusId" column="camp_minus_id"/>
- <result property="campName" column="camp_name"/>
- <result property="isTempNoti" column="is_temp_noti"/>
- <result property="isFaceCheck" column="is_face_check"/>
- <result property="tempNotiMsg" column="temp_noti_msg"/>
- <result property="recognitionReturnMsg" column="recognition_return_msg"/>
- <result property="lastFaceTime" column="last_face_time"/>
- <result property="failCount" column="fail_count"/>
- <result property="checkOperatorType" column="check_operator_type"/>
- <result property="faceLivenessId" column="faceLivenessId"/>
- </resultMap>
- <select id="queryOrderListByRecognition" resultMap="orderRecognitionMap">
- SELECT DISTINCT
- o.order_sn,
- o.merch_order_sn,
- o.order_status,
- o.actual_price,
- o.order_biz_type,
- o.shipping_no,
- o.shipping_name,
- o.shipping_code,
- o.consignee,
- o.mobile,
- o.province,
- o.city,
- o.district,
- o.address,
- o.add_time,
- o.pay_id,
- o.pay_status,
- o.shipping_status,
- o.is_merge_pay,
- o.buyer_pay_check,
- o.order_price,
- o.moder_sn,
- o.id,
- u.username AS username,
- o.user_id,
- p.is_payment_send,
- p.is_ele_order_send,
- p.is_customs_send,
- s.store_name,
- o.full_cut_price,
- o.camp_minus_id,
- o.camp_name,
- fd.is_temp_noti,
- fd.is_face_check,
- fd.temp_noti_msg,
- fd.recognition_return_msg,
- fd.fail_count,
- fd.id 'faceLivenessId',
- fd.check_operator_type,
- u.last_face_time,
- t.is_face_check 'thirdIsFaceCheck'
- FROM
- mall_order o
- LEFT JOIN mall_user u ON o.user_id = u.id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- left join mall_store s on o.store_id = s.id
- LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
- AND r.goods_id = g.goods_id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- INNER JOIN face_liveness_recognition_return_data fd on fd.order_sn = o.order_sn and fd.user_id = o.user_id
- WHERE 1=1
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND t.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="supplierThirdId != null and supplierThirdId != ''">
- AND r.supplier_third_id = #{supplierThirdId}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- <choose>
- <when test="sidx != null and sidx.trim() != ''">
- order by ${sidx} ${order}
- </when>
- <otherwise>
- order by o.id desc
- </otherwise>
- </choose>
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="queryOrderListByRecognitionTotal" resultType="int">
- SELECT count(1)
- FROM
- mall_order o
- LEFT JOIN mall_user u ON o.user_id = u.id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- left join mall_store s on o.store_id = s.id
- LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
- AND r.goods_id = g.goods_id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- INNER JOIN face_liveness_recognition_return_data fd on fd.order_sn = o.order_sn and fd.user_id = o.user_id
- WHERE 1=1
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND t.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="supplierThirdId != null and supplierThirdId != ''">
- AND r.supplier_third_id = #{supplierThirdId}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- </select>
- <select id="queryOrderByRecogTemp" resultType="com.kmall.admin.dto.SendTempDto">
- SELECT
- o.add_time 'addTime',
- u.weixin_openid 'openId',
- o.merch_order_sn 'merchOrderSn',
- o.id 'orderId',
- o.order_sn 'orderSn'
- FROM
- mall_order o
- INNER JOIN mall_user u ON o.user_id = u.id
- where o.id = #{value}
- </select>
- <select id="queryRealtimeSales" resultType="com.kmall.admin.entity.RealtimeSalesDetection">
- SELECT
- s.id AS storeId,
- o.merch_sn AS merchSn,
- m.merch_name AS merchName,
- count( distinct o.order_sn ) AS guestNumber,
- sum( og.actual_payment_amount/ (1+og.goods_rate) ) + sum(og.discounted_price)AS totalSales,
- sum( og.actual_payment_amount/ (1+og.goods_rate) ) + sum(og.discounted_price) AS actualSales,
- s.store_name AS storeName,
- max( o.add_time ) AS lastSalesTime ,
- sum( g.cost_price) AS totalCost
- FROM
- mall_order o
- LEFT JOIN mall_store s ON o.store_id = s.id
- LEFT JOIN mall_merch m ON o.merch_sn = m.merch_sn
- LEFT JOIN mall_order_goods og ON o.id = og.order_id
- LEFT JOIN mall_goods g ON og.goods_id = g.id
- LEFT JOIN mall_product_store_rela sr ON sr.goods_id = g.id
- LEFT JOIN mall_category c ON sr.category_id = c.id
- WHERE
- 1 = 1
- and (o.order_status = '300' or o.order_status = '201')
- <if test="storeId != null and storeId.trim() != ''">
- and o.store_id=#{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- and o.merch_sn=#{merchSn}
- </if>
- <choose>
- <when test="compareDate != null and compareDate != ''">
- and ( datediff ( o.add_time , #{compareDate} ) = 0 )
- </when>
- <when test="salesDate != null and salesDate != ''">
- and ( datediff ( o.add_time , #{salesDate} ) = 0 )
- </when >
- <otherwise></otherwise>
- </choose>
- <if test="categoryId != null and categoryId != ''">
- AND (c.parent_id = #{categoryId} or c.id = #{categoryId})
- </if>
- </select>
- <select id="purchaseSalesInStockDetailList" resultType="com.kmall.admin.entity.PurchaseSalesInStockDetail">
- select
- substr(msmc.create_time,1,10) as time,
- if(msmc.change_type = 1 ,'销售','期初') as type,
- sum(if((msmc.change_type = 2 or msmc.change_type = 3 ),msmc.store_change_num,0)) as addNum,
- sum(if(msmc.change_type = 1 ,msmc.store_change_num,0)) as lessNum,
- rela.stock_num as endingInventory,
- rela.stock_num as inventory,
- 0 as costPrice,
- rela.retail_price as retailPrice,
- 0 as addAmount,
- sum(if(msmc.change_type = 1 ,msmc.store_change_num,0)*rela.retail_price) as lessAmount,
- 0 as price
- from mall_product_store_rela rela
- left join mall_store_mng_change msmc on msmc.goods_id = rela.goods_id
- left join mall_goods g on g.id = msmc.goods_id
- WHERE 1=1 and msmc.creater_sn <![CDATA[ <> ]]> '定时任务'
- <if test="storeId != null and storeId != ''">
- AND rela.store_id = #{storeId}
- </if>
- <if test="goodsSn != null and goodsSn.trim() != ''">
- AND g.goods_sn = #{goodsSn}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND g.prod_barcode = #{prodBarcode}
- </if>
- <if test="startTime != null and startTime.trim() != ''">
- AND substr(msmc.create_time,1,10) <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime.trim() != ''">
- AND substr(msmc.create_time,1,10) <![CDATA[ <= ]]> #{endTime}
- </if>
- group by substr(msmc.create_time,1,10)
- <if test="offset != null and limit != null">
- limit #{offset}, #{limit}
- </if>
- </select>
- <select id="purchaseSalesInStockDetailTotal" resultType="int">
- select count(1) from ( select count(DISTINCT rela.id)
- from mall_product_store_rela rela
- left join mall_store_mng_change msmc on msmc.goods_id = rela.goods_id
- left join mall_goods g on g.id = msmc.goods_id
- WHERE 1=1 and msmc.creater_sn <![CDATA[ <> ]]> '定时任务'
- <if test="storeId != null and storeId != ''">
- AND rela.store_id = #{storeId}
- </if>
- <if test="goodsSn != null and goodsSn.trim() != ''">
- AND g.goods_sn = #{goodsSn}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND g.sku = #{sku}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND g.prod_barcode = #{prodBarcode}
- </if>
- <if test="startTime != null and startTime.trim() != ''">
- AND substr(msmc.create_time,1,10) <![CDATA[ >= ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime.trim() != ''">
- AND substr(msmc.create_time,1,10) <![CDATA[ <= ]]> #{endTime}
- </if>
- group by substr(msmc.create_time,1,10)
- ) b
- </select>
- <select id="queryTopicPriceByOrderSnAndSku" resultType="java.math.BigDecimal">
- SELECT mst.topic_price FROM mall_order mo
- inner JOIN mall_order_goods mog ON mo.id = mog.order_id
- inner JOIN mall_store_topic mst ON mog.store_topic_id=mst.id
- WHERE mo.order_sn=#{orderSn} AND mog.sku=#{sku};
- </select>
- <select id="queryExportOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT distinct
- o.id,
- o.order_sn,
- u.username as userName,
- o.pay_name,
- o.mobile,
- o.is_onffline_order,
- o.order_biz_type,
- o.order_status,
- o.pay_status,
- o.coupon_name,
- o.coupon_price,
- g.actual_payment_amount as actualPrice,
- o.order_price,
- o.pay_time,
- o.pay_flag,
- u.username AS userName,
- g.discounted_price as couponPrice ,
- s.store_name storeName,
- g.sku,
- g.goods_name as goodsName,
- g.retail_price,
- g.number
- FROM
- mall_order o
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- left join mall_store s on o.store_id = s.id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- left join mall_sale_record record on record.order_sn = o.order_sn
- LEFT JOIN sys_user u ON record.saller_id = u.user_id
- WHERE 1=1
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- </select>
- <select id="queryMasterExportOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT distinct
- o.id,
- o.order_sn,
- u.username as userName,
- o.pay_name,
- o.mobile,
- o.is_onffline_order,
- o.order_biz_type,
- o.order_status,
- o.pay_status,
- o.coupon_name,
- o.coupon_price,
- o.actual_price,
- o.order_price,
- o.pay_time,
- o.pay_flag,
- u.username AS userName,
- s.store_name storeName
- FROM
- mall_order o
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- left join mall_store s on o.store_id = s.id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- left join mall_sale_record record on record.order_sn = o.order_sn
- LEFT JOIN sys_user u ON record.saller_id = u.user_id
- WHERE 1=1
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="goodsSn != null and goodsSn.trim() != ''">
- AND gs.goods_sn = #{goodsSn}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND gs.prod_barcode = #{prodBarcode}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- </select>
- <select id="queryMasterExportList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT DISTINCT
- o.order_sn,
- o.merch_order_sn,
- o.order_status,
- o.actual_price,
- o.order_biz_type,
- o.shipping_no,
- o.shipping_name,
- o.shipping_code,
- o.consignee,
- o.mobile,
- o.province,
- o.city,
- o.district,
- o.address,
- o.add_time,
- o.pay_id,
- o.pay_status,
- o.shipping_status,
- o.is_merge_pay,
- o.buyer_pay_check,
- o.order_price,
- o.moder_sn,
- o.id,
- u.username AS username,
- p.is_payment_send,
- p.is_ele_order_send,
- p.is_customs_send,
- s.store_name,
- o.full_cut_price,
- o.camp_minus_id,
- o.camp_name
- FROM
- mall_order o
- LEFT JOIN mall_user u ON o.user_id = u.id
- LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
- left join mall_store s on o.store_id = s.id
- LEFT JOIN third_merchant_biz t ON t.third_party_merch_code = s.third_party_merch_code
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- LEFT JOIN mall_product_store_rela r ON o.store_id = r.store_id
- AND r.goods_id = g.goods_id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- WHERE 1=1
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="sku != null and sku.trim() != ''">
- AND gs.sku = #{sku}
- </if>
- <if test="prodBarcode != null and prodBarcode.trim() != ''">
- AND gs.prod_barcode = #{prodBarcode}
- </if>
- <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
- AND s.third_party_merch_code = #{thirdPartyMerchCode}
- </if>
- <if test="thirdMerchSn != null and thirdMerchSn != ''">
- AND t.third_merch_sn = #{thirdMerchSn}
- </if>
- <if test="supplierThirdId != null and supplierThirdId != ''">
- AND r.supplier_third_id = #{supplierThirdId}
- </if>
- <if test="orderBizType != null and orderBizType != ''">
- AND o.order_biz_type = #{orderBizType}
- </if>
- <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
- AND o.merch_order_sn = #{merchOrderSn}
- </if>
- <if test="merchSn != null and merchSn.trim() != ''">
- AND o.merch_sn = #{merchSn}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="shippingStatus != null and shippingStatus.trim() != ''">
- AND o.shipping_status = #{shippingStatus}
- </if>
- <if test="payStatus != null and payStatus.trim() != ''">
- AND o.pay_status = #{payStatus}
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="shippingId != null and shippingId != 0">
- AND o.shipping_id = #{shippingId}
- </if>
- <if test="orderType != null and orderType.trim() != ''">
- AND o.order_type = #{orderType}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="ids != null and ids.trim() != ''">
- AND o.id in (${ids})
- </if>
- </select>
- <select id="queryPickUpCodeList" resultType="com.kmall.admin.entity.OrderEntity">
- SELECT distinct
- o.*,
- c.pick_up_code_sn,
- c.pick_up_code_status
- FROM mall_order o
- LEFT JOIN mall_pick_up_code c ON c.order_sn = o.order_sn
- WHERE 1=1
- <if test="storeId != null and storeId != ''">
- AND o.store_id = #{storeId}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="payName != null and payName.trim() != ''">
- AND o.pay_name LIKE concat('%',#{payName},'%')
- </if>
- <if test="payMobile != null and payMobile.trim() != ''">
- AND o.pay_mobile LIKE concat('%',#{payMobile},'%')
- </if>
- <if test="startTime != null and startTime.trim() != ''">
- AND c.pick_up_code_createtime >= #{startTime}
- </if>
- <if test="endTime != null and endTime.trim() != ''">
- AND c.pick_up_code_createtime <= #{endTime}
- </if>
- order by o.id desc
- </select>
- <select id="queryExportSystemFormatList" resultType="com.kmall.admin.dto.SystemFormatDto">
- SELECT distinct
- o.id,
- o.order_sn as receiptNo,
- u.username as cashRegisterNo,
- o.pay_time as timeStampDetails,
- u.username as staffID,
- u.username as staffName,
- gs.hs_code as hsCode,
- gs.hs_code_name as hsCodeName,
- gs.goods_sn as ematouCode,
- gs.plu as plu,
- gs.mychem_id as mychemID,
- gs.english_name as productNameEN,
- gs.name as productNameCN,
- gs.prod_barcode as barcode,
- gs.ciq_prod_model as packSize,
- uc.name as productSpecification,
- b.name as brand,
- gs.daily_price as edlp,
- sr.bottom_line_price as costPrice,
- g.number as unitSold,
- g.actual_payment_amount as totalSalesInclTax,
- gs.goods_rate as taxRate,
- '专柜单品' as productCategory,
- sup.child_supplier_name as supplierName,
- o.order_status as orderStatus
- FROM
- mall_order o
- LEFT JOIN mall_order_goods g ON o.id = g.order_id
- left join mall_store s on o.store_id = s.id
- LEFT JOIN mall_goods gs ON g.goods_id = gs.id
- left join mall_sale_record record on record.order_sn = o.order_sn
- LEFT JOIN sys_user u ON record.saller_id = u.user_id
- left join sys_cus_unit_code uc on uc.code = gs.unit_code
- left join mall_product_store_rela sr on sr.goods_id=gs.id
- left join mall_brand b on b.id=sr.brand_id
- left join mall_supplier sup on gs.supplier_id = sup.id
- WHERE 1=1
- <if test="orderSn != null and orderSn.trim() != ''">
- AND o.order_sn LIKE concat('%',#{orderSn},'%')
- </if>
- <if test="orderStatus != null and orderStatus.trim() != ''">
- AND o.order_status = #{orderStatus}
- </if>
- <if test="isOnfiilineOrder != null">
- AND o.is_onffline_order = #{isOnfiilineOrder}
- </if>
- <if test="startTime != null and startTime != ''">
- AND o.add_time <![CDATA[ > ]]> #{startTime}
- </if>
- <if test="endTime != null and endTime != ''">
- AND o.add_time <![CDATA[ < ]]> #{endTime}
- </if>
- </select>
- <update id="updateOrderInfo" parameterType="map">
- UPDATE mall_order a
- <set>
- <if test="orderStatus != null">a.order_status = #{orderStatus},</if>
- <if test="payStatus != null">a.pay_status = #{payStatus},</if>
- <if test="payFlag != null">a.pay_flag = #{payFlag},</if>
- <if test="orderSnWx != null">a.order_sn_wx = #{orderSnWx},</if>
- <if test="payTransactionId != null">a.pay_transaction_id = #{payTransactionId},</if>
- <if test="payTime != null">a.pay_time = #{payTime},</if>
- <if test="totalFee != null">a.total_fee = #{totalFee},</if>
- <if test="feeType != null">a.fee_type = #{feeType},</if>
- <if test="cashFee != null">a.cash_fee = #{cashFee},</if>
- <if test="cashFeeType != null">a.cash_fee_type = #{cashFeeType},</if>
- <if test="rate != null">a.rate = #{rate},</if>
- </set>
- WHERE 1 = 1
- AND a.id = #{orderId}
- </update>
- <update id="updateOrderProcessRecord" parameterType="map">
- UPDATE mall_order_process_record a
- <set>
- <if test="payTime != null">a.pay_succ_time = #{payTime}</if>
- </set>
- WHERE 1 = 1
- AND a.order_sn = #{orderSn}
- </update>
- </mapper>
|