123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235 |
- <?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.ydd.module.mapper.OrderMapper">
- <resultMap type="Order" id="OrderResult">
- <result property="id" column="id" />
- <result property="outTradeNo" column="out_trade_no" />
- <result property="productId" column="product_id" />
- <result property="productName" column="product_name" />
- <result property="weight" column="weight" />
- <result property="takeDate" column="take_date" />
- <result property="takeTime" column="take_time" />
- <result property="takeRemark" column="take_remark" />
- <result property="paymentType" column="payment_type" />
- <result property="totalAmount" column="total_amount" />
- <result property="couponAmount" column="coupon_amount" />
- <result property="payAmount" column="pay_amount" />
- <result property="couponId" column="coupon_id" />
- <result property="sendAddressId" column="send_address_id" />
- <result property="sendProvinceName" column="send_province_name" />
- <result property="sendCityName" column="send_city_name" />
- <result property="sendDistrictName" column="send_district_name" />
- <result property="sendAddress" column="send_address" />
- <result property="sendContactName" column="send_contact_name" />
- <result property="sendPhone" column="send_phone" />
- <result property="receiptAddressId" column="receipt_address_id" />
- <result property="receiptProvinceName" column="receipt_province_name" />
- <result property="receiptCityName" column="receipt_city_name" />
- <result property="receiptDistrictName" column="receipt_district_name" />
- <result property="receiptAddress" column="receipt_address" />
- <result property="receiptContactName" column="receipt_contact_name" />
- <result property="receiptPhone" column="receipt_phone" />
- <result property="deliveryType" column="delivery_type" />
- <result property="preDeliveryIds" column="pre_delivery_ids" />
- <result property="actualDeliveryId" column="actual_delivery_id" />
- <result property="useTip" column="use_tip" />
- <result property="tipAmount" column="tip_amount" />
- <result property="status" column="status" />
- </resultMap>
- <select id="queryPage" resultType="com.ydd.module.domain.Order">
- SELECT * FROM lb_order WHERE 1 = 1
- <if test="params.memberId != null and params.memberId != ''">
- AND member_id = #{params.memberId}
- </if>
- <if test="params.outTradeNo != null and params.outTradeNo != ''">
- AND out_trade_no like concat('%', #{params.outTradeNo}, '%')
- </if>
- <if test="params.productName != null and params.productName != ''">
- AND product_name like concat('%', #{params.productName}, '%')
- </if>
- <if test="params.paymentType != null and params.paymentType != ''">
- AND payment_type = #{params.paymentType}
- </if>
- <if test="params.couponId != null and params.couponId != ''">
- AND coupon_id = #{params.couponId}
- </if>
- <if test="params.sendContactName != null and params.sendContactName != ''">
- AND send_contact_name like concat('%', #{params.sendContactName}, '%')
- </if>
- <if test="params.sendPhone != null and params.sendPhone != ''">
- AND send_phone like concat('%', #{params.sendPhone}, '%')
- </if>
- <if test="params.receiptContactName != null and params.receiptContactName != ''">
- AND receipt_contact_name like concat('%', #{params.receiptContactName}, '%')
- </if>
- <if test="params.receiptPhone != null and params.receiptPhone != ''">
- AND receipt_phone like concat('%', #{params.receiptPhone}, '%')
- </if>
- <if test="params.status != null">
- AND status = #{params.status}
- </if>
- <if test="memberIds != null">
- AND member_id IN
- <foreach collection="memberIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- ORDER BY lb_order.create_time DESC
- </select>
- <select id="queryPageList" resultType="com.ydd.module.dto.SystemOrderDto">
- SELECT
- o.id,
- o.waimai_order_id,
- o.merchant_id,
- o.take_type,
- o.order_sn,
- o.take_time,
- o.create_time,
- o.delivery_status,
- o.`status`,
- o.send_contact_name,
- o.send_phone,
- o.send_province_name,
- o.send_city_name,
- o.send_district_name,
- o.send_address,
- o.send_extension,
- o.receipt_contact_name,
- o.receipt_phone,
- o.receipt_province_name,
- o.receipt_city_name,
- o.receipt_district_name,
- o.receipt_address,
- o.receipt_extension,
- o.pay_amount,
- o.payment_type,
- o.product_name,
- o.weight,
- o.take_remark,
- o.out_trade_no,
- o.delivery_name,
- o.delivery_id,
- o.shipper_name,
- o.shipper_phone,
- o.cancel_reason,
- o.agent_Id,
- o.commission,
- o.total_amount,
- o.coupon_amount,
- o.tip_amount,
- o.first_coupon,
- o.product_amount,
- o.bind_fee,
- o.deleted,
- o.refund_money,
- o.dada_dsp_type,
- o.dada_dsp_id,
- wo.`status` AS wmstatus,
- wo.total_price AS puductMoney,
- wo.caution AS wmCaution,
- wo.delivery_time AS waimaiDeliveryTime,
- wo.order_type,
- wo.order_time,
- wo.day_seq,
- m.merchant_name AS merchantName,
- b.nickname AS memberName,
- b.mobile AS memberMobile,
- p.`name` AS personnelName,
- (select `name` from lb_shop as s where s.id = o.shop_id and s.deleted = 0 limit 1) AS shopName
- FROM lb_order o
- left join lb_merchant m ON o.merchant_id = m.id
- left join lb_member b ON o.member_id = b.id
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- left join lb_personnel p on o.personnel_id = p.id
- <if test="(params.completeStartTime != null and params.completeStartTime != '') or (params.completeEndTime != null and params.completeEndTime != '')">
- LEFT JOIN lb_order_log AS ol ON o.id = ol.order_id
- </if>
- WHERE 1 = 1
- <if test="params.personnelName != null and params.personnelName != ''">
- AND p.`name` like concat('%', #{params.personnelName}, '%')
- </if>
- <if test="params.personnelId != null">
- and o.personnel_id = #{params.personnelId}
- </if>
- <if test="params.deliveryStatus != 6">
- AND o.deleted = 0
- </if>
- <if test="params.deliveryStatus == 6">
- AND o.deleted = 1
- </if>
- AND
- (
- not(
- o.delivery_status = 0
- AND o.`status` = 0
- AND wo.`status` != 0
- AND ( wo.`status` != 4 OR wo.`status` IS NULL )
- )
- or o.waimai_order_id in (select waimai_order_id from lb_order where deleted=1)
- or o.save_flag = 1
- )
- <if test="params.memberId != null and params.memberId != ''">
- AND o.member_id = #{params.memberId}
- </if>
- <if test="params.merchantId != null and params.merchantId != ''">
- AND o.merchant_id = #{params.merchantId}
- </if>
- <if test="params.merchantName != null and params.merchantName != ''">
- AND m.merchant_name like concat('%', #{params.merchantName}, '%')
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId != 100">
- AND o.delivery_id = #{params.deliveryId}
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId == 100">
- AND (wo.status = 4 and o.delivery_status != 4 and o.delivery_id is null )
- </if>
- <if test="params.createStartTime != null and params.createStartTime != ''">
- AND o.create_time >= #{params.createStartTime}
- </if>
- <if test="params.createEndTime != null and params.createEndTime != ''">
- AND #{params.createEndTime} >= o.create_time
- </if>
- <!-- <if test="params.completeStartTime != null and params.completeStartTime != ''">-->
- <!-- AND o.update_time >= #{params.completeStartTime} AND o.delivery_status = 4-->
- <!-- </if>-->
- <!-- <if test="params.completeEndTime != null and params.completeEndTime != ''">-->
- <!-- AND o.update_time <= #{params.completeEndTime} AND o.delivery_status = 4-->
- <!-- </if>-->
- <if test="params.completeStartTime != null and params.completeStartTime != ''">
- AND ol.create_time >= #{params.completeStartTime} AND ol.order_status = 4
- </if>
- <if test="params.completeEndTime != null and params.completeEndTime != ''">
- AND ol.create_time <= #{params.completeEndTime} AND ol.order_status = 4
- </if>
- <if test="params.deliveryStartTime != null and params.deliveryStartTime != ''">
- AND o.delivery_time >= #{params.deliveryStartTime}
- </if>
- <if test="params.deliveryEndTime != null and params.deliveryEndTime != ''">
- AND #{params.deliveryEndTime} >= o.delivery_time
- </if>
- <!-- <if test="params.outTradeNo != null and params.outTradeNo != ''">-->
- <!-- AND o.out_trade_no like concat('%', #{params.outTradeNo}, '%')-->
- <!-- </if>-->
- <!-- <if test="params.orderSn != null and params.orderSn != ''">-->
- <!-- AND o.order_sn like concat('%', #{params.orderSn}, '%')-->
- <!-- </if>-->
- <if test="params.orderSn != null and params.orderSn != ''">
- AND (o.order_sn like concat('%', #{params.orderSn}, '%') or o.out_trade_no like concat('%', #{params.orderSn}, '%'))
- </if>
- <if test="params.productName != null and params.productName != ''">
- AND o.product_name like concat('%', #{params.productName}, '%')
- </if>
- <if test="params.paymentType != null and params.paymentType != ''">
- AND o.payment_type = #{params.paymentType}
- </if>
- <if test="params.couponId != null and params.couponId != ''">
- AND o.coupon_id = #{params.couponId}
- </if>
- <if test="params.memberName != null and params.memberName != ''">
- AND b.nickname like concat('%', #{params.memberName}, '%')
- </if>
- <if test="params.memberMobile != null and params.memberMobile != ''">
- AND b.mobile like concat('%', #{params.memberMobile}, '%')
- </if>
- <if test="params.sendContactName != null and params.sendContactName != ''">
- AND o.send_contact_name like concat('%', #{params.sendContactName}, '%')
- </if>
- <if test="params.sendPhone != null and params.sendPhone != ''">
- AND o.send_phone like concat('%', #{params.sendPhone}, '%')
- </if>
- <if test="params.receiptContactName != null and params.receiptContactName != ''">
- AND o.receipt_contact_name like concat('%', #{params.receiptContactName}, '%')
- </if>
- <if test="params.receiptPhone != null and params.receiptPhone != ''">
- AND o.receipt_phone like concat('%', #{params.receiptPhone}, '%')
- </if>
- <if test="params.status != null">
- AND o.status = #{params.status}
- </if>
- <if test="params.deliveryStatus != null and params.deliveryStatus != 4 and params.deliveryStatus != 100 and params.deliveryStatus != 6">
- AND (o.delivery_status = #{params.deliveryStatus} and (wo.`status`!=4 or wo.`status` is null))
- </if>
- <!-- <if test="params.deliveryStatus != null and params.deliveryStatus == 0">-->
- <!-- AND ((wo.status is null or wo.status != 4) and o.delivery_status=0 and o.waimai_order_id is not null)-->
- <!-- </if>-->
- <if test="params.deliveryStatus != null and params.deliveryStatus == 4">
- AND o.delivery_status=4
- </if>
- <!-- <if test="params.deliveryStatus != null and params.deliveryStatus == 4">-->
- <!-- AND ((wo.`status` is null and o.delivery_status=4) or (wo.`status` =4 and o.delivery_status=4))-->
- <!-- </if>-->
- <!-- <if test="params.deliveryStatus != null and params.deliveryStatus == -1">-->
- <!-- AND (o.delivery_status = #{params.deliveryStatus} and wo.`status` != 4)-->
- <!-- </if>-->
- <!-- <if test="params.deliveryStatus != null and params.deliveryStatus == 1">-->
- <!-- AND (o.delivery_status = #{params.deliveryStatus} and wo.`status` != 4)-->
- <!-- </if>-->
- <if test="params.deliveryStatus != null and params.deliveryStatus == 100">
- AND (wo.status = 4 and o.delivery_status != 4)
- </if>
- <if test="params.agentId != null">
- AND
- o.agent_Id in
- <if test="agentIds.size > 0 and agentIds != null">
- <foreach collection="agentIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </if>
- <if test="params.aId != null">
- AND
- o.agent_Id in
- <if test="aIds.size > 0 and aIds != null">
- <foreach collection="aIds" index="index" item="aid" open="(" separator="," close=")">
- #{aid}
- </foreach>
- </if>
- </if>
- <if test="params.receiptProvinceName != null and params.receiptProvinceName != ''">
- AND o.receipt_province_name like concat('%', #{params.receiptProvinceName}, '%')
- </if>
- <if test="params.receiptCityName != null and params.receiptCityName != ''">
- AND o.receipt_city_name like concat('%', #{params.receiptCityName}, '%')
- </if>
- <if test="params.receiptDistrictName != null and params.receiptDistrictName != ''">
- AND o.receipt_district_name like concat('%', #{params.receiptDistrictName}, '%')
- </if>
- <if test="params.sendProvinceName != null and params.sendProvinceName != ''">
- AND o.send_province_name like concat('%', #{params.sendProvinceName}, '%')
- </if>
- <if test="params.sendCityName != null and params.sendCityName != ''">
- AND o.send_city_name like concat('%', #{params.sendCityName}, '%')
- </if>
- <if test="params.sendDistrictName != null and params.sendDistrictName != ''">
- AND o.send_district_name like concat('%', #{params.sendDistrictName}, '%')
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType != 4">
- AND wo.order_type = #{params.waimaiOrderType}
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType == 4">
- AND o.waimai_order_id is null
- </if>
- <if test="params.paymentType != null">
- AND (o.payment_type = #{params.paymentType} and o.status != 0)
- </if>
- ORDER BY o.create_time DESC
- </select>
- <select id="queryPageListNew" resultType="com.ydd.module.dto.SystemOrderDto">
- SELECT
- o.id,
- o.waimai_order_id,
- o.merchant_id,
- o.shop_id,
- o.take_type,
- o.order_sn,
- o.take_time,
- o.create_time,
- o.delivery_status,
- o.status,
- o.send_contact_name,
- o.send_phone,
- o.send_province_name,
- o.send_city_name,
- o.send_district_name,
- o.send_address,
- o.send_extension,
- o.send_street,
- o.receipt_contact_name,
- o.receipt_phone,
- o.receipt_province_name,
- o.receipt_city_name,
- o.receipt_district_name,
- o.receipt_address,
- o.receipt_extension,
- o.receipt_street,
- o.pay_amount,
- o.payment_type,
- o.product_name,
- o.weight,
- o.take_remark,
- o.out_trade_no,
- o.delivery_name,
- o.delivery_id,
- o.shipper_name,
- o.shipper_phone,
- o.cancel_reason,
- o.agent_Id,
- o.commission,
- o.total_amount,
- o.coupon_amount,
- o.tip_amount,
- o.first_coupon,
- o.product_amount,
- o.bind_fee,
- o.deleted,
- o.refund_money,
- o.dada_dsp_type,
- o.dada_dsp_id,
- o.member_id,
- o.platform_type,
- wo.status AS wmstatus,
- wo.total_price AS puductMoney,
- wo.caution AS wmCaution,
- wo.delivery_time AS waimaiDeliveryTime,
- wo.order_type,
- wo.order_time,
- case when wo.day_seq is not null then wo.day_seq
- else o.lb_day_seq
- end as day_seq
- FROM lb_order o
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- <if test="(params.completeStartTime != null and params.completeStartTime != '') or (params.completeEndTime != null and params.completeEndTime != '')">
- LEFT JOIN lb_order_log AS ol ON o.id = ol.order_id
- </if>
- WHERE 1 = 1
- <if test="params.createStartTime != null and params.createStartTime != ''">
- AND o.create_time >= #{params.createStartTime}
- </if>
- <if test="params.createEndTime != null and params.createEndTime != ''">
- AND #{params.createEndTime} >= o.create_time
- </if>
- <if test="params.completeStartTime != null and params.completeStartTime != ''">
- AND ol.create_time >= #{params.completeStartTime} AND ol.order_status = 4
- </if>
- <if test="params.completeEndTime != null and params.completeEndTime != ''">
- AND ol.create_time <= #{params.completeEndTime} AND ol.order_status = 4
- </if>
- <!-- <if test="params.completeStartTime != null and params.completeStartTime != ''">-->
- <!-- AND-->
- <!-- (-->
- <!-- (o.waimai_order_id is not null AND o.update_time >= #{params.completeStartTime} AND o.delivery_status = 4)-->
- <!-- OR-->
- <!-- (o.waimai_order_id is null AND wo.update_time >= #{params.completeStartTime} AND wo.status = 4)-->
- <!-- )-->
- <!-- </if>-->
- <!-- <if test="params.completeEndTime != null and params.completeEndTime != ''">-->
- <!-- AND-->
- <!-- (-->
- <!-- (o.waimai_order_id is not null AND o.update_time <= #{params.completeEndTime} AND o.delivery_status = 4)-->
- <!-- OR-->
- <!-- (o.waimai_order_id is null AND wo.update_time <= #{params.completeEndTime} AND wo.status = 4)-->
- <!-- )-->
- <!-- </if>-->
- <if test="params.agentIds != null and params.agentIds.size > 0">
- AND
- o.agent_Id in
- <foreach collection="params.agentIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.merchantIds != null and params.merchantIds.size > 0">
- AND
- o.merchant_id in
- <foreach collection="params.merchantIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.memberIds != null and params.memberIds.size > 0">
- AND
- o.member_id in
- <foreach collection="params.memberIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.personnelIds != null and params.personnelIds.size > 0">
- AND
- o.personnel_id in
- <foreach collection="params.personnelIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.personnelId != null">
- and o.personnel_id = #{params.personnelId}
- </if>
- <if test="params.deliveryStatus != 6">
- AND o.deleted = 0
- </if>
- <if test="params.deliveryStatus == 6">
- AND o.deleted = 1
- </if>
- AND
- (
- not(
- o.delivery_status = 0
- AND o.status = 0
- AND wo.status != 0
- AND ( wo.status != 4 OR wo.status IS NULL )
- )
- or o.waimai_order_id in (select waimai_order_id from lb_order where deleted=1)
- or o.save_flag = 1
- )
- <if test="params.memberId != null and params.memberId != ''">
- AND o.member_id = #{params.memberId}
- </if>
- <if test="params.merchantId != null and params.merchantId != ''">
- AND o.merchant_id = #{params.merchantId}
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId != 100">
- AND o.delivery_id = #{params.deliveryId}
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId == 100">
- AND (wo.status = 4 and o.delivery_status != 4 and o.delivery_id is null )
- </if>
- <if test="params.deliveryStartTime != null and params.deliveryStartTime != ''">
- AND o.delivery_time >= #{params.deliveryStartTime}
- </if>
- <if test="params.deliveryEndTime != null and params.deliveryEndTime != ''">
- AND #{params.deliveryEndTime} >= o.delivery_time
- </if>
- <if test="params.orderSn != null and params.orderSn != ''">
- AND (o.order_sn like concat('%', #{params.orderSn}, '%') or o.out_trade_no like concat('%', #{params.orderSn}, '%'))
- </if>
- <if test="params.productName != null and params.productName != ''">
- AND o.product_name like concat('%', #{params.productName}, '%')
- </if>
- <if test="params.paymentType != null and params.paymentType != ''">
- AND o.payment_type = #{params.paymentType}
- </if>
- <if test="params.couponId != null and params.couponId != ''">
- AND o.coupon_id = #{params.couponId}
- </if>
- <if test="params.sendContactName != null and params.sendContactName != ''">
- AND o.send_contact_name like concat('%', #{params.sendContactName}, '%')
- </if>
- <if test="params.sendPhone != null and params.sendPhone != ''">
- AND o.send_phone like concat('%', #{params.sendPhone}, '%')
- </if>
- <if test="params.receiptContactName != null and params.receiptContactName != ''">
- AND o.receipt_contact_name like concat('%', #{params.receiptContactName}, '%')
- </if>
- <if test="params.receiptPhone != null and params.receiptPhone != ''">
- AND o.receipt_phone like concat('%', #{params.receiptPhone}, '%')
- </if>
- <if test="params.status != null">
- AND o.status = #{params.status}
- </if>
- <if test="params.deliveryStatus != null and params.deliveryStatus != 4 and params.deliveryStatus != 100 and params.deliveryStatus != 6">
- AND (o.delivery_status = #{params.deliveryStatus} and (wo.`status`!=4 or wo.`status` is null))
- </if>
- <if test="params.deliveryStatus != null and params.deliveryStatus == 4">
- AND o.delivery_status=4
- </if>
- <if test="params.deliveryStatus != null and params.deliveryStatus == 100">
- AND (wo.status = 4 and o.delivery_status != 4)
- </if>
- <if test="params.receiptProvinceName != null and params.receiptProvinceName != ''">
- AND o.receipt_province_name like concat('%', #{params.receiptProvinceName}, '%')
- </if>
- <if test="params.receiptCityName != null and params.receiptCityName != ''">
- AND o.receipt_city_name like concat('%', #{params.receiptCityName}, '%')
- </if>
- <if test="params.receiptDistrictName != null and params.receiptDistrictName != ''">
- AND o.receipt_district_name like concat('%', #{params.receiptDistrictName}, '%')
- </if>
- <if test="params.sendProvinceName != null and params.sendProvinceName != ''">
- AND o.send_province_name like concat('%', #{params.sendProvinceName}, '%')
- </if>
- <if test="params.sendCityName != null and params.sendCityName != ''">
- AND o.send_city_name like concat('%', #{params.sendCityName}, '%')
- </if>
- <if test="params.sendDistrictName != null and params.sendDistrictName != ''">
- AND o.send_district_name like concat('%', #{params.sendDistrictName}, '%')
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType != 4">
- AND wo.order_type = #{params.waimaiOrderType}
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType == 4">
- AND o.waimai_order_id is null
- </if>
- <if test="params.paymentType != null">
- AND (o.payment_type = #{params.paymentType} and o.status != 0)
- </if>
- <if test="params.shopIds != null and params.shopIds.size > 0">
- AND
- o.shop_id in
- <foreach collection="params.shopIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- ORDER BY o.create_time DESC
- </select>
- <select id="findOneKeyList" resultType="com.ydd.module.dto.OrderDetailDto">
- SELECT
- o.id,
- o.member_id,
- o.waimai_order_id,
- o.order_sn,
- o.out_trade_no,
- o.product_id,
- o.product_name,
- o.weight,
- o.take_type,
- o.take_date,
- o.take_time,
- o.payment_type,
- o.total_amount,
- o.pay_amount,
- o.coupon_id,
- o.receipt_address_id,
- o.receipt_province_name,
- o.receipt_city_name,
- o.receipt_district_name,
- o.receipt_address,
- o.receipt_contact_name,
- o.receipt_phone,
- o.receipt_extension,
- o.receipt_city_code,
- o.receipt_lng,
- o.receipt_lat,
- o.receipt_street,
- o.send_address_id,
- o.send_province_name,
- o.send_city_name,
- o.send_district_name,
- o.send_address,
- o.send_contact_name,
- o.send_phone,
- o.send_extension,
- o.send_city_code,
- o.send_lng,
- o.send_lat,
- o.send_street,
- o.shop_id,
- o.shop_name,
- o.order_distance,
- o.delivery_status,
- o.delivery_id,
- o.delivery_logo,
- o.delivery_name,
- o.use_tip,
- o.tip_amount,
- o.take_remark,
- o.delivery_time,
- o.cancel_type,
- o.cancel_reason,
- o.merchant_id,
- o.shipper_name,
- o.shipper_phone,
- o.delivery_logo,
- o.delivery_name,
- o.agent_id,
- o.update_time,
- case when o.waimai_order_id is not null then wo.total_price
- else o.product_amount
- end as productAmount,
- wo.out_order_id,
- wo.caution,
- wo.waimai_id,
- wo.order_type,
- wo.status as wmstatus,
- wo.delivery_time exceptTime,
- wo.order_time orderTime,
- d.delay_time,
- case when wo.day_seq is not null then wo.day_seq
- else o.lb_day_seq
- end as day_seq
- FROM lb_order as o FORCE INDEX(idx_order_shop_id)
- left join lb_waimai_order as wo on o.waimai_order_id = wo.id
- LEFT JOIN lb_order_delay d on o.id = d.order_id and d.deleted = 0
- WHERE o.waimai_order_id is not null and o.deleted = 0
- <!-- <if test="memberId != null and memberId != ''">
- AND (o.member_id = #{memberId}
- <if test="spId != null and memberId != ''">
- OR o.shop_id = #{spId}
- </if>)
- </if>-->
- <if test="shopIds != null">
- AND o.shop_id IN
- <foreach collection="shopIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="oldStatus == 0">
- <if test="status != null and status != '' and status !=0 and status !=4 and status!=10">
- AND (o.delivery_status = #{status} and wo.status !=4)
- </if>
- </if>
- <if test="oldStatus == 1">
- AND (o.delivery_status in (-1,-2) and wo.status !=4)
- </if>
- <!-- <if test="status != null and status != '' and status !=0 and status !=4 and status!=10">-->
- <!-- AND (o.delivery_status = #{status} and wo.status !=4)-->
- <!-- </if>-->
- <if test="status != null and status != '' and status==4">
- AND (o.delivery_status = #{status} or wo.status = 4)
- </if>
- <if test="status == 0">
- AND (o.delivery_status = 0 and wo.status !=4 and wo.delivery_time=0)
- </if>
- <if test="status == 10">
- AND ( wo.delivery_time> 0 and wo.status !=4 and o.delivery_status = 0 )
- </if>
- <if test="searchKey != null and searchKey != ''">
- AND (o.receipt_address like concat('%', #{searchKey}, '%') or wo.out_order_id like concat('%', #{searchKey}, '%'))
- </if>
- <if test="shopId != null and shopId != ''">
- AND o.shop_id = #{shopId}
- </if>
- <if test="startDate != null and startDate!=''">
- AND DATE_FORMAT(o.create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
- </if>
- <if test="endDate != null and endDate!=''">
- AND DATE_FORMAT(o.create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
- </if>
- <if test="waimaiId != null and waimaiId != ''">
- AND wo.waimai_id = #{waimaiId}
- </if>
- <if test="status == 10">
- ORDER BY wo.delivery_time asc
- </if>
- <if test="status != 10 and status !=-2">
- ORDER BY o.create_time DESC
- </if>
- <!-- <if test="status == -2">-->
- <!-- ORDER BY o.id DESC-->
- <!-- </if>-->
- </select>
- <select id="findList" resultType="com.ydd.module.domain.Order">
- select * from lb_order
- where member_id IN
- <foreach collection="memberId" index="index" item="memberId" open="(" separator="," close=")">
- #{memberId}
- </foreach>
- and waimai_order_id is null and deleted = 0
- <if test="status != null and status != ''">
- AND delivery_status = #{status}
- </if>
- <if test="status == 0">
- AND delivery_status = 0
- </if>
- <if test="searchKey != null and searchKey != ''">
- AND (receipt_address like concat('%', #{searchKey}, '%') or order_sn like concat('%', #{searchKey}, '%'))
- </if>
- <if test="shopId != null ">
- AND shop_id = #{shopId}
- </if>
- <if test="startDate != null and startDate!=''">
- AND DATE_FORMAT(create_time,'%Y-%m-%d') >= DATE_FORMAT(#{startDate},'%Y-%m-%d')
- </if>
- <if test="endDate != null and endDate!=''">
- AND DATE_FORMAT(create_time,'%Y-%m-%d') <= DATE_FORMAT(#{endDate},'%Y-%m-%d')
- </if>
- ORDER BY create_time DESC
- </select>
- <select id="getDetail" resultType="com.ydd.module.domain.Order">
- select * from lb_order
- where member_id IN
- <foreach collection="memberId" index="index" item="memberId" open="(" separator="," close=")">
- #{memberId}
- </foreach>
- and id = #{orderId}
- </select>
- <select id="getDetailByShopId" resultType="com.ydd.module.domain.Order">
- select * from lb_order
- where shop_id IN
- <foreach collection="shopIds" index="index" item="shopIds" open="(" separator="," close=")">
- #{shopIds}
- </foreach>
- and id = #{orderId}
- </select>
- <select id="getOrderNum" resultType="java.lang.Integer">
- SELECT count(id) FROM lb_order WHERE delivery_status = 4
- <if test="shopIds != null and shopIds.size > 0">
- AND shop_id IN
- <foreach collection="shopIds" index="index" item="shopId" open="(" separator="," close=")">
- #{shopId}
- </foreach>
- </if>
- <if test="startDate != null and startDate != ''">
- AND create_time >= #{startDate}
- </if>
- </select>
- <select id="getOrderAmount" resultType="java.math.BigDecimal">
- SELECT COALESCE(SUM(pay_amount),0) FROM lb_order WHERE delivery_status = 4
- <if test="shopIds != null and shopIds.size > 0">
- AND shop_id IN
- <foreach collection="shopIds" index="index" item="shopId" open="(" separator="," close=")">
- #{shopId}
- </foreach>
- </if>
- <if test="startDate != null and startDate != ''">
- AND create_time >= #{startDate}
- </if>
- </select>
- <select id="queryTimeOutOrder" resultType="com.ydd.module.domain.Order">
- SELECT * FROM lb_order WHERE delivery_status = 1 and deleted=0 and dada_dsp_id is null and create_time <= date_sub(now(), interval #{time} minute)
- </select>
- <select id="sumOrder" resultType="com.ydd.module.domain.Order">
- <!-- SELECT-->
- <!-- COALESCE(count(id), 0) AS deliveryNum,-->
- <!-- COALESCE(sum(total_amount), 0) AS expenses,-->
- <!-- COALESCE(sum(pay_amount), 0) AS payMoney-->
- <!-- FROM lb_order-->
- <!-- WHERE deleted = 0 AND delivery_status = #{status}-->
- SELECT DISTINCT o.*
- FROM lb_order o join lb_payment p on o.order_sn = p.order_sn and p.pay_status=1
- WHERE o.deleted = 0
- <!-- <if test="shopId != null and shopId!=0">-->
- <!-- AND o.shop_id = #{shopId}-->
- <!-- </if>-->
- <if test="shopIds != null">
- AND o.shop_id IN
- <foreach collection="shopIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="startTime != null and startTime != ''">
- AND to_days(o.create_time) >= to_days(#{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND to_days(#{endTime}) >= to_days(o.create_time)
- </if>
- <if test="timeType != null and timeType == 1 and (startTime == null or startTime == '') and (endTime == null or endTime == '')">
- AND to_days(o.create_time) = to_days(NOW())
- </if>
- <if test="timeType != null and timeType == 2 and (startTime == null or startTime == '') and (endTime == null or endTime == '')">
- AND to_days(NOW()) - to_days( o.create_time) = 1
- </if>
- <if test="timeType != null and timeType == 3 and (startTime == null or startTime == '') and (endTime == null or endTime == '')">
- AND DATE_FORMAT( o.create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
- </if>
- <if test="deliveryId != null">
- AND o.delivery_id = #{deliveryId}
- </if>
- <!-- <if test="loginId != null">-->
- <!-- AND o.member_id = #{loginId}-->
- <!-- </if>-->
- </select>
- <select id="sumOrder1" resultType="com.ydd.module.dto.OrderSumDto">
- SELECT
- COALESCE(sum(total_amount), 0) AS refund
- FROM lb_order
- WHERE deleted = 0 AND delivery_status = #{status}
- <if test="shopId != null and shopId!=0">
- AND shop_id = #{shopId}
- </if>
- <if test="startTime != null and startTime != ''">
- AND to_days(create_time) >= to_days(#{startTime})
- </if>
- <if test="endTime != null and endTime != ''">
- AND to_days(#{endTime}) >= to_days(create_time)
- </if>
- <if test="timeType != null and timeType == 1 and (startTime == null or startTime == '') and (endTime == null or endTime == '')">
- AND to_days(create_time) = to_days(NOW())
- </if>
- <if test="timeType != null and timeType == 2 and (startTime == null or startTime == '') and (endTime == null or endTime == '')">
- AND to_days(NOW()) - to_days( create_time) = 1
- </if>
- <if test="timeType != null and timeType == 3 and (startTime == null or startTime == '') and (endTime == null or endTime == '')">
- AND DATE_FORMAT( create_time, '%Y%m' ) = DATE_FORMAT( CURDATE( ) , '%Y%m' )
- </if>
- <if test="loginId != null">
- AND member_id = #{loginId}
- </if>
- </select>
- <select id="getByStatus" resultType="com.ydd.module.domain.Order">
- select * from lb_order WHERE delivery_status = 4 and deleted = 0 and create_time <= '2021-06-28 21:00:00'
- </select>
- <select id="selectCountByStatusNew" resultType="com.ydd.module.dto.SystemOrderDto">
- SELECT
- o.id,
- wo.status AS wmStatus,
- o.delivery_status
- FROM lb_order AS o
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- <if test="(params.completeStartTime != null and params.completeStartTime != '') or (params.completeEndTime != null and params.completeEndTime != '')">
- LEFT JOIN lb_order_log AS ol ON o.id = ol.order_id
- </if>
- WHERE 1 = 1
- <if test="params.createStartTime != null and params.createStartTime != ''">
- AND o.create_time >= #{params.createStartTime}
- </if>
- <if test="params.createEndTime != null and params.createEndTime != ''">
- AND #{params.createEndTime} >= o.create_time
- </if>
- <if test="params.completeStartTime != null and params.completeStartTime != ''">
- AND ol.create_time >= #{params.completeStartTime} AND ol.order_status = 4
- </if>
- <if test="params.completeEndTime != null and params.completeEndTime != ''">
- AND ol.create_time <= #{params.completeEndTime} AND ol.order_status = 4
- </if>
- <!-- <if test="params.completeStartTime != null and params.completeStartTime != ''">-->
- <!-- AND-->
- <!-- (-->
- <!-- (o.waimai_order_id is not null AND o.update_time >= #{params.completeStartTime} AND o.delivery_status = 4)-->
- <!-- OR-->
- <!-- (o.waimai_order_id is null AND wo.update_time >= #{params.completeStartTime} AND wo.status = 4)-->
- <!-- )-->
- <!-- </if>-->
- <!-- <if test="params.completeEndTime != null and params.completeEndTime != ''">-->
- <!-- AND-->
- <!-- (-->
- <!-- (o.waimai_order_id is not null AND o.update_time <= #{params.completeEndTime} AND o.delivery_status = 4)-->
- <!-- OR-->
- <!-- (o.waimai_order_id is null AND wo.update_time <= #{params.completeEndTime} AND wo.status = 4)-->
- <!-- )-->
- <!-- </if>-->
- AND
- (
- not(
- o.delivery_status = 0
- AND o.`status` = 0
- AND wo.`status` != 0
- AND ( wo.`status` != 4 OR wo.`status` IS NULL )
- )
- or o.waimai_order_id in (select waimai_order_id from lb_order where deleted=1)
- or o.save_flag = 1
- )
- <if test="params.agentIds != null and params.agentIds.size > 0">
- AND
- o.agent_Id in
- <foreach collection="params.agentIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.merchantIds != null and params.merchantIds.size > 0">
- AND
- o.merchant_id in
- <foreach collection="params.merchantIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.memberIds != null and params.memberIds.size > 0">
- AND
- o.member_id in
- <foreach collection="params.memberIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.personnelIds != null and params.personnelIds.size > 0">
- AND
- o.personnel_id in
- <foreach collection="params.personnelIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.personnelId != null">
- and o.personnel_id = #{params.personnelId}
- </if>
- <if test="params.deliveryStatus != 6">
- AND o.deleted = 0
- </if>
- <if test="params.deliveryStatus == 6">
- AND o.deleted = 1
- </if>
- <if test="params.memberId != null and params.memberId != ''">
- AND o.member_id = #{params.memberId}
- </if>
- <if test="params.merchantId != null and params.merchantId != ''">
- AND o.merchant_id = #{params.merchantId}
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId != 100">
- AND o.delivery_id = #{params.deliveryId}
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId == 100">
- AND (wo.status = 4 and o.delivery_status != 4 and o.delivery_id is null )
- </if>
- <if test="params.deliveryStartTime != null and params.deliveryStartTime != ''">
- AND o.delivery_time >= #{params.deliveryStartTime}
- </if>
- <if test="params.deliveryEndTime != null and params.deliveryEndTime != ''">
- AND #{params.deliveryEndTime} >= o.delivery_time
- </if>
- <if test="params.orderSn != null and params.orderSn != ''">
- AND (o.order_sn like concat('%', #{params.orderSn}, '%') or o.out_trade_no like concat('%', #{params.orderSn}, '%'))
- </if>
- <if test="params.productName != null and params.productName != ''">
- AND o.product_name like concat('%', #{params.productName}, '%')
- </if>
- <if test="params.paymentType != null and params.paymentType != ''">
- AND o.payment_type = #{params.paymentType}
- </if>
- <if test="params.couponId != null and params.couponId != ''">
- AND o.coupon_id = #{params.couponId}
- </if>
- <if test="params.sendContactName != null and params.sendContactName != ''">
- AND o.send_contact_name like concat('%', #{params.sendContactName}, '%')
- </if>
- <if test="params.sendPhone != null and params.sendPhone != ''">
- AND o.send_phone like concat('%', #{params.sendPhone}, '%')
- </if>
- <if test="params.receiptContactName != null and params.receiptContactName != ''">
- AND o.receipt_contact_name like concat('%', #{params.receiptContactName}, '%')
- </if>
- <if test="params.receiptPhone != null and params.receiptPhone != ''">
- AND o.receipt_phone like concat('%', #{params.receiptPhone}, '%')
- </if>
- <if test="params.status != null">
- AND o.status = #{params.status}
- </if>
- <if test="params.receiptProvinceName != null and params.receiptProvinceName != ''">
- AND o.receipt_province_name like concat('%', #{params.receiptProvinceName}, '%')
- </if>
- <if test="params.receiptCityName != null and params.receiptCityName != ''">
- AND o.receipt_city_name like concat('%', #{params.receiptCityName}, '%')
- </if>
- <if test="params.receiptDistrictName != null and params.receiptDistrictName != ''">
- AND o.receipt_district_name like concat('%', #{params.receiptDistrictName}, '%')
- </if>
- <if test="params.sendProvinceName != null and params.sendProvinceName != ''">
- AND o.send_province_name like concat('%', #{params.sendProvinceName}, '%')
- </if>
- <if test="params.sendCityName != null and params.sendCityName != ''">
- AND o.send_city_name like concat('%', #{params.sendCityName}, '%')
- </if>
- <if test="params.sendDistrictName != null and params.sendDistrictName != ''">
- AND o.send_district_name like concat('%', #{params.sendDistrictName}, '%')
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType != 4">
- AND wo.order_type = #{params.waimaiOrderType}
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType == 4">
- AND o.waimai_order_id is null
- </if>
- <if test="params.paymentType != null">
- AND (o.payment_type = #{params.paymentType} and o.status != 0)
- </if>
- <if test="params.shopIds != null and params.shopIds.size > 0">
- AND
- o.shop_id in
- <foreach collection="params.shopIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="selectExportOrder" resultType="com.ydd.module.dto.OrderExportDto">
- SELECT
- o.id,
- o.order_sn,
- o.pay_amount,
- o.payment_type,
- COALESCE(o.coupon_amount+o.first_coupon,0) AS discountAmount,
- o.tip_amount,
- b.nickname AS memberName,
- b.mobile AS memberMobile,
- o.send_contact_name,
- o.send_phone,
- o.send_extension,
- o.receipt_contact_name,
- o.receipt_phone,
- o.receipt_extension,
- o.delivery_name,
- m.merchant_name AS merchantName,
- o.`status`,
- o.delivery_status,
- o.deleted,
- wo.status AS wmstatus,
- wo.order_time,
- o.create_time,
- o.waimai_order_id,
- (select create_time from lb_order_log as lol where lol.order_id = o.id and lol.order_status = 4 limit 1) AS finishTime
- FROM lb_order o
- left join lb_merchant m ON o.merchant_id = m.id
- left join lb_member b ON o.member_id = b.id
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- left join lb_personnel p on o.personnel_id = p.id
- <if test="(params.completeStartTime != null and params.completeStartTime != '') or (params.completeEndTime != null and params.completeEndTime != '')">
- LEFT JOIN lb_order_log AS ol ON o.id = ol.order_id
- </if>
- WHERE 1 = 1 AND o.create_time BETWEEN date_sub( now( ), INTERVAL 2 MONTH ) AND now( )
- AND
- (
- not(
- o.delivery_status = 0
- AND o.`status` = 0
- AND wo.`status` != 0
- AND ( wo.`status` != 4 OR wo.`status` IS NULL )
- )
- or o.waimai_order_id in (select waimai_order_id from lb_order where deleted=1)
- or o.save_flag = 1
- )
- <if test="params.personnelName != null and params.personnelName != ''">
- AND p.`name` like concat('%', #{params.personnelName}, '%')
- </if>
- <if test="params.personnelId != null">
- and o.personnel_id = #{params.personnelId}
- </if>
- <if test="params.deliveryStatus != 6">
- AND o.deleted = 0
- </if>
- <if test="params.deliveryStatus == 6">
- AND o.deleted = 1
- </if>
- <if test="params.memberId != null and params.memberId != ''">
- AND o.member_id = #{params.memberId}
- </if>
- <if test="params.merchantId != null and params.merchantId != ''">
- AND o.merchant_id = #{params.merchantId}
- </if>
- <if test="params.merchantName != null and params.merchantName != ''">
- AND m.merchant_name like concat('%', #{params.merchantName}, '%')
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId != 100">
- AND o.delivery_id = #{params.deliveryId}
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId == 100">
- AND (wo.status = 4 and o.delivery_status != 4 and o.delivery_id is null )
- </if>
- <if test="params.createStartTime != null and params.createStartTime != ''">
- AND o.create_time >= #{params.createStartTime}
- </if>
- <if test="params.createEndTime != null and params.createEndTime != ''">
- AND #{params.createEndTime} >= o.create_time
- </if>
- <if test="params.completeStartTime != null and params.completeStartTime != ''">
- AND ol.create_time >= #{params.completeStartTime} AND ol.order_status = 4
- </if>
- <if test="params.completeEndTime != null and params.completeEndTime != ''">
- AND ol.create_time <= #{params.completeEndTime} AND ol.order_status = 4
- </if>
- <if test="params.deliveryStartTime != null and params.deliveryStartTime != ''">
- AND o.delivery_time >= #{params.deliveryStartTime}
- </if>
- <if test="params.deliveryEndTime != null and params.deliveryEndTime != ''">
- AND #{params.deliveryEndTime} >= o.delivery_time
- </if>
- <if test="params.orderSn != null and params.orderSn != ''">
- AND (o.order_sn like concat('%', #{params.orderSn}, '%') or o.out_trade_no like concat('%', #{params.orderSn}, '%'))
- </if>
- <if test="params.productName != null and params.productName != ''">
- AND o.product_name like concat('%', #{params.productName}, '%')
- </if>
- <if test="params.paymentType != null and params.paymentType != ''">
- AND o.payment_type = #{params.paymentType}
- </if>
- <if test="params.couponId != null and params.couponId != ''">
- AND o.coupon_id = #{params.couponId}
- </if>
- <if test="params.memberName != null and params.memberName != ''">
- AND b.nickname like concat('%', #{params.memberName}, '%')
- </if>
- <if test="params.memberMobile != null and params.memberMobile != ''">
- AND b.mobile like concat('%', #{params.memberMobile}, '%')
- </if>
- <if test="params.sendContactName != null and params.sendContactName != ''">
- AND o.send_contact_name like concat('%', #{params.sendContactName}, '%')
- </if>
- <if test="params.sendPhone != null and params.sendPhone != ''">
- AND o.send_phone like concat('%', #{params.sendPhone}, '%')
- </if>
- <if test="params.receiptContactName != null and params.receiptContactName != ''">
- AND o.receipt_contact_name like concat('%', #{params.receiptContactName}, '%')
- </if>
- <if test="params.receiptPhone != null and params.receiptPhone != ''">
- AND o.receipt_phone like concat('%', #{params.receiptPhone}, '%')
- </if>
- <if test="params.status != null">
- AND o.status = #{params.status}
- </if>
- <if test="params.deliveryStatus != null and params.deliveryStatus != 4 and params.deliveryStatus != 100 and params.deliveryStatus != 6">
- AND (o.delivery_status = #{params.deliveryStatus} and (wo.`status`!=4 or wo.`status` is null))
- </if>
- <!-- <if test="params.deliveryStatus != null and params.deliveryStatus == 0">-->
- <!-- AND ((wo.status is null or wo.status != 4) and o.delivery_status=0 and o.waimai_order_id is not null)-->
- <!-- </if>-->
- <if test="params.deliveryStatus != null and params.deliveryStatus == 4">
- AND o.delivery_status=4
- </if>
- <if test="params.deliveryStatus != null and params.deliveryStatus == 100">
- AND (wo.status = 4 and o.delivery_status != 4)
- </if>
- <if test="agentIds != null and agentIds.size > 0">
- AND o.agent_Id in
- <foreach collection="agentIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.aId != null">
- AND
- o.agent_Id in
- <if test="aIds.size > 0 and aIds != null">
- <foreach collection="aIds" index="index" item="aid" open="(" separator="," close=")">
- #{aid}
- </foreach>
- </if>
- </if>
- <if test="params.receiptProvinceName != null and params.receiptProvinceName != ''">
- AND o.receipt_province_name like concat('%', #{params.receiptProvinceName}, '%')
- </if>
- <if test="params.receiptCityName != null and params.receiptCityName != ''">
- AND o.receipt_city_name like concat('%', #{params.receiptCityName}, '%')
- </if>
- <if test="params.receiptDistrictName != null and params.receiptDistrictName != ''">
- AND o.receipt_district_name like concat('%', #{params.receiptDistrictName}, '%')
- </if>
- <if test="params.sendProvinceName != null and params.sendProvinceName != ''">
- AND o.send_province_name like concat('%', #{params.sendProvinceName}, '%')
- </if>
- <if test="params.sendCityName != null and params.sendCityName != ''">
- AND o.send_city_name like concat('%', #{params.sendCityName}, '%')
- </if>
- <if test="params.sendDistrictName != null and params.sendDistrictName != ''">
- AND o.send_district_name like concat('%', #{params.sendDistrictName}, '%')
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType != 4">
- AND wo.order_type = #{params.waimaiOrderType}
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType == 4">
- AND o.waimai_order_id is null
- </if>
- <if test="params.paymentType != null">
- AND (o.payment_type = #{params.paymentType} and o.status != 0)
- </if>
- <if test="params.shopIds != null and params.shopIds.size > 0">
- AND
- o.shop_id in
- <foreach collection="params.shopIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- ORDER BY o.create_time DESC
- </select>
- <select id="totalConsume" resultType="java.math.BigDecimal">
- SELECT COALESCE(SUM(pay_amount) + SUM(breach_fee),0) FROM lb_order WHERE
- delivery_status = 4 and deleted = 0
- <if test="shopIds != null and shopIds.size > 0">
- AND shop_id IN
- <foreach collection="shopIds" index="index" item="shopId" open="(" separator="," close=")">
- #{shopId}
- </foreach>
- </if>
- <if test="params.balanceStartTime != null and params.balanceStartTime != ''">
- AND create_time >= #{params.balanceStartTime}
- </if>
- <if test="params.balanceEndTime != null and params.balanceEndTime != ''">
- AND #{params.balanceEndTime} > create_time
- </if>
- </select>
- <select id="totalConsumeByMemberId" resultType="java.math.BigDecimal">
- SELECT COALESCE(SUM(pay_amount) + SUM(breach_fee),0) FROM lb_order WHERE
- delivery_status = 4 and deleted = 0
- <if test="memberId != null and memberId != ''">
- AND member_id = #{memberId}
- </if>
- </select>
- <select id="selectOriginalOrderSn1" resultType="java.lang.String">
- select order_sn from lb_order
- where id = (
- select max(id) from lb_order where deleted = 0 and waimai_order_id = #{waimaiOrderId}
- )
- </select>
- <!-- <update id="autofinish">-->
- <!-- update lb_waimai_order set `status`=4 where id in(-->
- <!-- select id from (-->
- <!-- SELECT-->
- <!-- w.id-->
- <!-- FROM-->
- <!-- lb_order o join lb_waimai_order w on o.waimai_order_id = w.id-->
- <!-- WHERE-->
- <!-- delivery_status in(0,-2)-->
- <!-- AND take_type = 0-->
- <!-- AND w.create_time <= DATE_SUB(NOW(),INTERVAL 6 HOUR)-->
- <!-- and w.`status` not in(-1,4)-->
- <!-- union all-->
- <!-- SELECT-->
- <!-- w.id-->
- <!-- FROM-->
- <!-- lb_order o join lb_waimai_order w on o.waimai_order_id = w.id-->
- <!-- WHERE-->
- <!-- delivery_status in(0,-2)-->
- <!-- AND take_type in (1,2)-->
- <!-- AND o.take_time <DATE_SUB(NOW(),INTERVAL 6 HOUR)-->
- <!-- and w.`status` not in(-1,4)) t)-->
- <!--</update>-->
- <update id="autofinish">
- update lb_waimai_order set `status`=4 where id in(
- select id from (
- SELECT
- w.id
- FROM
- lb_waimai_order w straight_join lb_order o on o.waimai_order_id = w.id
- WHERE
- delivery_status in(0,-2)
- AND take_type = 0
- AND w.create_time <= DATE_SUB(NOW(),INTERVAL 6 HOUR)
- and w.`status` not in(-1,4)
- union all
- SELECT
- w.id
- FROM
- lb_waimai_order w straight_join lb_order o on o.waimai_order_id = w.id
- WHERE
- delivery_status in(0,-2)
- AND take_type in (1,2)
- AND o.take_time <DATE_SUB(NOW(),INTERVAL 6 HOUR)
- and w.`status` not in(-1,4))t)
- </update>
- <select id="getOrderList" resultType="com.ydd.module.dto.OrderListDto">
- SELECT
- o.id,
- o.waimai_order_id,
- o.order_sn,
- o.take_type,
- o.shop_id,
- o.shop_name,
- o.order_distance,
- o.receipt_address_id,
- o.receipt_province_name,
- o.receipt_city_name,
- o.receipt_district_name,
- o.receipt_address,
- o.receipt_contact_name,
- o.receipt_phone,
- o.receipt_extension,
- o.receipt_city_code,
- o.receipt_lng,
- o.receipt_lat,
- o.send_address_id,
- o.send_province_name,
- o.send_city_name,
- o.send_district_name,
- o.send_address,
- o.send_contact_name,
- o.send_phone,
- o.send_extension,
- o.send_city_code,
- o.send_lng,
- o.send_lat,
- o.delivery_status,
- o.delivery_id,
- o.take_time,
- o.take_remark,
- o.delivery_time,
- o.cancel_type,
- o.product_id,
- o.weight,
- o.product_name,
- o.pay_amount,
- o.shipper_name,
- o.shipper_phone,
- o.delivery_logo,
- o.delivery_name,
- o.platform_type,
- o.auto_delivery_minutes,
- o.send_street,
- o.receipt_street,
- case when o.waimai_order_id is not null then wo.total_price
- else o.product_amount end as productAmount,
- wo.out_order_id,
- wo.caution,
- wo.waimai_id,
- wo.order_type,
- case when wo.day_seq is not null then wo.day_seq
- else o.lb_day_seq
- end as day_seq,
- wo.status AS wmstatus,
- wo.delivery_time AS wmDeliveryTime,
- wo.order_time AS orderTime,
- (SELECT delay_time FROM lb_order_delay WHERE order_id = o.id AND deleted = 0) AS delay_time,
- case when o.take_type != 0 and o.waimai_order_id is null then UNIX_TIMESTAMP(o.delivery_time)
- else wo.delivery_time
- end as sortedTime
- FROM lb_order AS o
- <if test="params.memberType != null and params.memberType > 1">
- FORCE INDEX(idx_order_shop_id)
- </if>
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- WHERE o.deleted = 0
- <if test="params.memberType != null and params.memberType == 1">
- AND o.member_id = #{params.memberId}
- </if>
- <if test="params.memberType != null and params.memberType > 1">
- <if test="params.shopIds != null and params.shopIds.size != 0 ">
- AND (o.shop_id IN
- <foreach collection="params.shopIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- <if test="params.isHasPersonalOrder">
- OR (o.member_id = #{params.memberId} AND o.shop_id is null)
- </if>
- )
- </if>
- </if>
- <if test="params.searchType != null and params.searchType == 0">
- <if test="params.status != null">
- <if test="params.status != -1 and params.status != 0 and params.status != 4 and params.status != 10 and params.status != 94 and params.status != 93">
- AND (
- (o.waimai_order_id IS NULL AND o.delivery_status = #{params.status})
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = #{params.status} AND wo.status != 4)
- )
- </if>
- <if test="params.status == -1">
- AND
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = -1 AND o.update_time >= #{params.cancelTime})
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = -1 AND wo.status != 4 AND wo.update_time >= #{params.cancelTime})
- )
- </if>
- <if test="params.status == 0 ">
- AND (o.waimai_order_id IS NOT NULL AND o.delivery_status = 0 AND o.take_type = 0 AND wo.status != 4)
- </if>
- <if test="params.status == 4">
- AND
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = 4)
- OR (o.waimai_order_id IS NOT NULL AND wo.status = 4)
- )
- </if>
- <if test="params.status == 10">
- AND
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = 0 AND o.take_type != 0 AND o.save_flag = 1)
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = 0 AND o.take_type != 0 AND wo.status != 4)
- )
- </if>
- <if test="params.status == 94">
- AND o.create_time >= #{params.lastDayTime}
- </if>
- <if test="params.status == 93">
- AND
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = 4 AND o.update_time >= #{params.lastDayTime})
- OR (o.waimai_order_id IS NOT NULL AND wo.status = 4 AND wo.update_time >= #{params.lastDayTime})
- OR (o.waimai_order_id IS NULL AND o.delivery_status = -1 AND o.update_time >= #{params.lastDayTime})
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = -1 AND wo.status != 4 AND wo.update_time >= #{params.lastDayTime})
- )
- </if>
- </if>
- </if>
- <if test="params.searchType != null and params.searchType == 1">
- <if test="params.status != null">
- <if test="params.status == -1">
- AND (
- (o.waimai_order_id IS NULL AND o.delivery_status = -1)
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = -1 AND wo.status != 4)
- )
- </if>
- <if test="params.status == 95">
- AND
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = 0 AND o.save_flag = 1)
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = 0 AND wo.status = 0)
- )
- </if>
- <if test="params.status == 96">
- AND (
- (o.waimai_order_id IS NULL AND o.delivery_status IN (-2,1,2,3))
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status IN (-2,1,2,3) AND wo.status != 4 AND wo.status != -1)
- )
- </if>
- <if test="params.status == 97">
- AND (o.delivery_status = 4)
- </if>
- <if test="params.status == 98">
- AND (o.delivery_status != 4 AND o.waimai_order_id IS NOT NULL AND wo.status = 4)
- </if>
- <if test="params.status == 99">
- AND (
- NOT(
- o.delivery_status = 0
- AND o.status = 0
- AND wo.status != 0
- AND (wo.status != 4 OR wo.status IS NULL)
- )
- OR o.waimai_order_id IN (SELECT waimai_order_id FROM lb_order WHERE deleted=1)
- OR o.save_flag = 1
- )
- </if>
- </if>
- </if>
- <if test="params.searchType != null and params.searchType == 2">
- <if test="params.searchStatusItem != null">
- <!-- 新订单 -->
- <if test="params.searchStatusItem.newOrder">
- AND (
- (o.waimai_order_id IS NOT NULL AND o.delivery_status = 0 AND o.take_type = 0 AND wo.status != 4)
- </if>
- <!-- 预约单 -->
- <if test="params.searchStatusItem.bookingOrder">
- <if test="!params.searchStatusItem.newOrder">
- AND (
- </if>
- <if test="params.searchStatusItem.newOrder">
- OR
- </if>
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = 0 AND o.take_type != 0 AND o.save_flag = 1)
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = 0 AND o.take_type != 0 AND wo.status != 4)
- )
- </if>
- <!-- 待接单 -->
- <if test="params.searchStatusItem.toBeReceivedOrder">
- <if test="!params.searchStatusItem.newOrder and !params.searchStatusItem.bookingOrder">
- AND (
- </if>
- <if test="params.searchStatusItem.newOrder || params.searchStatusItem.bookingOrder">
- OR
- </if>
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = 1)
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = 1 AND wo.status != 4 AND wo.status != -1)
- )
- </if>
- <!-- 取货中 -->
- <if test="params.searchStatusItem.toBeDeliveredOrder">
- <if test="!params.searchStatusItem.newOrder and !params.searchStatusItem.bookingOrder
- and !params.searchStatusItem.toBeReceivedOrder">
- AND (
- </if>
- <if test="params.searchStatusItem.newOrder || params.searchStatusItem.bookingOrder
- || params.searchStatusItem.toBeReceivedOrder">
- OR
- </if>
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = 2)
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = 2 AND wo.status != 4 AND wo.status != -1)
- )
- </if>
- <!-- 配送中 -->
- <if test="params.searchStatusItem.inDeliveryOrder">
- <if test="!params.searchStatusItem.newOrder and !params.searchStatusItem.bookingOrder
- and !params.searchStatusItem.toBeReceivedOrder and !params.searchStatusItem.toBeDeliveredOrder">
- AND (
- </if>
- <if test="params.searchStatusItem.newOrder || params.searchStatusItem.bookingOrder
- || params.searchStatusItem.toBeReceivedOrder || params.searchStatusItem.toBeDeliveredOrder">
- OR
- </if>
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = 3)
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = 3 AND wo.status != 4 AND wo.status != -1)
- )
- </if>
- <!-- 异常单 -->
- <if test="params.searchStatusItem.abnormalOrder">
- <if test="!params.searchStatusItem.newOrder and !params.searchStatusItem.bookingOrder
- and !params.searchStatusItem.toBeReceivedOrder and !params.searchStatusItem.toBeDeliveredOrder
- and !params.searchStatusItem.inDeliveryOrder">
- AND (
- </if>
- <if test="params.searchStatusItem.newOrder || params.searchStatusItem.bookingOrder
- || params.searchStatusItem.toBeReceivedOrder || params.searchStatusItem.toBeDeliveredOrder
- || params.searchStatusItem.inDeliveryOrder">
- OR
- </if>
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = -2)
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = -2 AND wo.status != 4 AND wo.status != -1)
- )
- </if>
- <!-- 完成 -->
- <if test="params.searchStatusItem.finishOrder">
- <if test="!params.searchStatusItem.newOrder and !params.searchStatusItem.bookingOrder
- and !params.searchStatusItem.toBeReceivedOrder and !params.searchStatusItem.toBeDeliveredOrder
- and !params.searchStatusItem.inDeliveryOrder and !params.searchStatusItem.abnormalOrder">
- AND (
- </if>
- <if test="params.searchStatusItem.newOrder || params.searchStatusItem.bookingOrder
- || params.searchStatusItem.toBeReceivedOrder || params.searchStatusItem.toBeDeliveredOrder
- || params.searchStatusItem.inDeliveryOrder || params.searchStatusItem.abnormalOrder">
- OR
- </if>
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = 4)
- OR (o.waimai_order_id IS NOT NULL AND wo.status = 4)
- )
- </if>
- <!-- 取消 -->
- <if test="params.searchStatusItem.cancelOrder">
- <if test="!params.searchStatusItem.newOrder and !params.searchStatusItem.bookingOrder
- and !params.searchStatusItem.toBeReceivedOrder and !params.searchStatusItem.toBeDeliveredOrder
- and !params.searchStatusItem.inDeliveryOrder and !params.searchStatusItem.abnormalOrder
- and !params.searchStatusItem.finishOrder">
- AND (
- </if>
- <if test="params.searchStatusItem.newOrder || params.searchStatusItem.bookingOrder
- || params.searchStatusItem.toBeReceivedOrder || params.searchStatusItem.toBeDeliveredOrder
- || params.searchStatusItem.inDeliveryOrder || params.searchStatusItem.abnormalOrder
- || params.searchStatusItem.finishOrder">
- OR
- </if>
- (
- (o.waimai_order_id IS NULL AND o.delivery_status = -1)
- OR (o.waimai_order_id IS NOT NULL AND o.delivery_status = -1 AND wo.status != 4)
- )
- </if>
- <if test="params.searchStatusItem.newOrder || params.searchStatusItem.bookingOrder
- || params.searchStatusItem.toBeReceivedOrder || params.searchStatusItem.toBeDeliveredOrder
- || params.searchStatusItem.inDeliveryOrder || params.searchStatusItem.abnormalOrder
- || params.searchStatusItem.finishOrder || params.searchStatusItem.cancelOrder">
- )
- </if>
- </if>
- </if>
- <if test="params.searchKeyType != null and params.searchKeyType != 0 and params.searchKey != null and params.searchKey != ''">
- AND
- <if test="params.searchKeyType == 1">
- (wo.day_seq = #{params.searchKey}
- OR
- o.lb_day_seq = #{params.searchKey}
- )
- </if>
- <if test="params.searchKeyType == 2">
- o.receipt_phone LIKE concat('%', #{params.searchKey}, '%')
- </if>
- <if test="params.searchKeyType == 3">
- o.receipt_contact_name like concat('%', #{params.searchKey}, '%')
- </if>
- <if test="params.searchKeyType == 4">
- o.receipt_address LIKE concat('%', #{params.searchKey}, '%')
- </if>
- <if test="params.searchKeyType == 5">
- o.order_sn LIKE concat('%', #{params.searchKey}, '%')
- </if>
- <if test="params.searchKeyType == 6">
- wo.out_order_id LIKE concat('%', #{params.searchKey}, '%')
- </if>
- </if>
- <if test="params.searchType != null and params.searchType == 1 and params.orderType != null">
- <if test="params.orderType != 0 and params.orderType != 99">
- AND o.waimai_order_id IS NOT NULL AND wo.order_type = #{params.orderType}
- </if>
- <if test="params.orderType == 99">
- AND o.waimai_order_id IS NULL
- </if>
- </if>
- <if test="params.shopId != null and params.shopId != 0">
- AND o.shop_id = #{params.shopId}
- </if>
- <if test="params.startDate != null and params.startDate!=''">
- AND o.create_time >= #{params.startDate}
- </if>
- <if test="params.endDate != null and params.endDate!=''">
- AND o.create_time < #{params.endDate}
- </if>
- <if test="params.status == 10">
- ORDER BY sortedTime ASC, o.id DESC
- </if>
- <if test="params.status == -2">
- ORDER BY o.id DESC
- </if>
- <if test="params.status != 10 and params.status != -2">
- ORDER BY o.create_time DESC
- </if>
- </select>
- <select id="getOrderListByShopIdsAndMemberIds" resultType="com.ydd.module.dto.OrderListDto">
- SELECT
- o.id,
- o.delivery_status,
- o.take_type,
- o.waimai_order_id,
- o.save_flag,
- wo.status AS wmstatus,
- o.update_time,
- wo.update_time AS wmUpdateTime,
- wo.delivery_time AS wmDeliveryTime
- FROM lb_order AS o
- <if test="memberType != null and memberType > 1">
- FORCE INDEX(idx_order_shop_id)
- </if>
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- WHERE o.deleted = 0
- <if test="memberType != null and memberType == 1">
- AND o.member_id = #{memberId}
- </if>
- <if test="memberType != null and memberType > 1">
- <if test="shopIds != null and shopIds.size != 0 ">
- AND (o.shop_id IN
- <foreach collection="shopIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- <if test="hasPersonalOrder">
- OR (o.member_id = #{memberId} AND o.shop_id is null)
- </if>
- )
- </if>
- </if>
- </select>
- <select id="selectOrderData" resultType="com.ydd.module.dto.ProfitsSystemOrderDto">
- SELECT
- DATE_FORMAT( o.create_time, "%Y-%m-%d" ) AS date,
- o.id AS orderId,
- o.pay_amount,
- o.delivery_status,
- wo.`status` AS wmStatus,
- o.delivery_id,
- o.agent_Id,
- o.merchant_id,
- (select sum(commission) from lb_profits_detail as pd where o.id = pd.order_id and agent_id IS NOT NULL and deleted = 0 and is_source = 0) AS agentCommission,
- (select sum(commission) from lb_profits_detail as pd where o.id = pd.order_id and dsp_id IS NOT NULL and deleted = 0 and is_source = 0) AS dspCommission,
- m.merchant_name,
- a.`name` AS agentName
- FROM
- lb_order o
- LEFT JOIN lb_waimai_order wo ON o.waimai_order_id = wo.id
- LEFT JOIN lb_merchant m ON o.merchant_id = m.id
- LEFT JOIN lb_agent a ON o.agent_Id = a.id
- WHERE o.id = #{orderId}
- </select>
- <select id="getByOrderSn" resultType="com.ydd.module.domain.Order">
- select id,order_sn,delivery_status from lb_order where order_sn = #{orderSn} and deleted = 0
- </select>
- <select id="getAllOrderByOrderSn" resultType="com.ydd.module.domain.Order">
- select id,order_sn,delivery_status from lb_order where order_sn like concat('%', #{orderSn}, '%')
- </select>
- <select id="getAllOrderByOrderId" resultType="com.ydd.module.domain.Order">
- select id,order_sn,delivery_status from lb_order where id = #{orderId}
- </select>
- <select id="queryDadaPageList" resultType="com.ydd.module.dto.DadaOrderListDto">
- SELECT
- o.id,
- o.waimai_order_id,
- o.merchant_id,
- o.take_type,
- o.order_sn,
- o.take_time,
- o.create_time,
- o.delivery_status,
- o.status,
- o.send_contact_name,
- o.send_phone,
- o.send_province_name,
- o.send_city_name,
- o.send_district_name,
- o.send_address,
- o.send_extension,
- o.send_street,
- o.receipt_contact_name,
- o.receipt_phone,
- o.receipt_province_name,
- o.receipt_city_name,
- o.receipt_district_name,
- o.receipt_address,
- o.receipt_extension,
- o.receipt_street,
- o.pay_amount,
- o.payment_type,
- o.product_name,
- o.weight,
- o.take_remark,
- o.out_trade_no,
- o.delivery_name,
- o.delivery_id,
- o.shipper_name,
- o.shipper_phone,
- o.cancel_reason,
- o.agent_Id,
- o.commission,
- o.total_amount,
- o.coupon_amount,
- o.tip_amount,
- o.first_coupon,
- o.bind_fee,
- o.deleted,
- o.refund_money,
- o.dada_dsp_id,
- o.dada_dsp_type,
- o.shop_id,
- o.member_id,
- o.platform_type,
- wo.status AS wmstatus,
- case when o.waimai_order_id is not null then wo.total_price
- else o.product_amount end as productAmount,
- wo.caution AS wmCaution,
- wo.delivery_time AS waimaiDeliveryTime,
- wo.order_type,
- wo.order_time,
- case when wo.day_seq is not null then wo.day_seq
- else o.lb_day_seq
- end as day_seq,
- (select name from lb_dsp_waimai where parent_id is not null and type = wo.order_type) AS dspWaimaiName
- FROM lb_order o
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- <if test="(params.completeStartTime != null and params.completeStartTime != '') or (params.completeEndTime != null and params.completeEndTime != '')">
- LEFT JOIN lb_order_log AS ol ON o.id = ol.order_id
- </if>
- WHERE 1 = 1 AND o.dada_dsp_id is not null
- <if test="params.deliveryStatus != 6">
- AND o.deleted = 0
- </if>
- <if test="params.deliveryStatus == 6">
- AND o.deleted = 1
- </if>
- AND
- (
- not(
- o.delivery_status = 0
- AND o.status = 0
- AND wo.status != 0
- AND ( wo.status != 4 OR wo.status IS NULL )
- )
- or o.waimai_order_id in (select waimai_order_id from lb_order where deleted=1)
- or o.save_flag = 1
- )
- <if test="params.dadaDspId != null and params.dadaDspId != ''">
- AND o.dada_dsp_id = #{params.dadaDspId}
- </if>
- <if test="params.createStartTime != null and params.createStartTime != ''">
- AND o.create_time >= #{params.createStartTime}
- </if>
- <if test="params.createEndTime != null and params.createEndTime != ''">
- AND #{params.createEndTime} >= o.create_time
- </if>
- <if test="params.merchantIds != null and params.merchantIds.size > 0 ">
- AND o.merchant_id IN
- <foreach collection="params.merchantIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.shopIds != null and params.shopIds.size > 0 ">
- AND o.shop_id IN
- <foreach collection="params.shopIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.completeStartTime != null and params.completeStartTime != ''">
- AND ol.create_time >= #{params.completeStartTime} AND ol.order_status = 4
- </if>
- <if test="params.completeEndTime != null and params.completeEndTime != ''">
- AND ol.create_time <= #{params.completeEndTime} AND ol.order_status = 4
- </if>
- <if test="params.orderSn != null and params.orderSn != ''">
- AND (o.order_sn like concat('%', #{params.orderSn}, '%') or o.out_trade_no like concat('%', #{params.orderSn}, '%'))
- </if>
- <if test="params.sendContactName != null and params.sendContactName != ''">
- AND o.send_contact_name like concat('%', #{params.sendContactName}, '%')
- </if>
- <if test="params.sendPhone != null and params.sendPhone != ''">
- AND o.send_phone like concat('%', #{params.sendPhone}, '%')
- </if>
- <if test="params.receiptContactName != null and params.receiptContactName != ''">
- AND o.receipt_contact_name like concat('%', #{params.receiptContactName}, '%')
- </if>
- <if test="params.receiptPhone != null and params.receiptPhone != ''">
- AND o.receipt_phone like concat('%', #{params.receiptPhone}, '%')
- </if>
- <if test="params.deliveryStatus != null and params.deliveryStatus != 4 and params.deliveryStatus != 100 and params.deliveryStatus != 6">
- AND (o.delivery_status = #{params.deliveryStatus} and (wo.`status`!=4 or wo.`status` is null))
- </if>
- <if test="params.deliveryStatus != null and params.deliveryStatus == 4">
- AND o.delivery_status=4
- </if>
- <if test="params.deliveryStatus != null and params.deliveryStatus == 100">
- AND (wo.status = 4 and o.delivery_status != 4)
- </if>
- <if test="params.sendProvinceName != null and params.sendProvinceName != ''">
- AND o.send_province_name like concat('%', #{params.sendProvinceName}, '%')
- </if>
- <if test="params.sendCityName != null and params.sendCityName != ''">
- AND o.send_city_name like concat('%', #{params.sendCityName}, '%')
- </if>
- <if test="params.sendDistrictName != null and params.sendDistrictName != ''">
- AND o.send_district_name like concat('%', #{params.sendDistrictName}, '%')
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType != 4">
- AND wo.order_type = #{params.waimaiOrderType}
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType == 4">
- AND o.waimai_order_id is null
- </if>
- ORDER BY o.create_time DESC
- </select>
- <select id="selectDadaCountByStatus" resultType="com.ydd.module.dto.SystemOrderDto">
- SELECT
- o.delivery_status,
- wo.status AS wmStatus,
- o.waimai_order_id,
- o.order_sn,
- o.payment_type
- FROM lb_order AS o
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- <if test="(params.completeStartTime != null and params.completeStartTime != '') or (params.completeEndTime != null and params.completeEndTime != '')">
- LEFT JOIN lb_order_log AS ol ON o.id = ol.order_id
- </if>
- WHERE 1 = 1 AND o.dada_dsp_id is not null
- AND
- (
- not(
- o.delivery_status = 0
- AND o.status = 0
- AND wo.status != 0
- AND (wo.status != 4 OR wo.status IS NULL)
- )
- or o.waimai_order_id in (select waimai_order_id from lb_order where deleted=1)
- or o.save_flag = 1
- )
- <if test="params.dadaDspId != null and params.dadaDspId != ''">
- AND o.dada_dsp_id = #{params.dadaDspId}
- </if>
- <if test="params.createStartTime != null and params.createStartTime != ''">
- AND o.create_time >= #{params.createStartTime}
- </if>
- <if test="params.createEndTime != null and params.createEndTime != ''">
- AND #{params.createEndTime} >= o.create_time
- </if>
- <if test="params.merchantIds != null and params.merchantIds.size > 0 ">
- AND o.merchant_id IN
- <foreach collection="params.merchantIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.shopIds != null and params.shopIds.size > 0 ">
- AND o.shop_id IN
- <foreach collection="params.shopIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- <if test="params.completeStartTime != null and params.completeStartTime != ''">
- AND ol.create_time >= #{params.completeStartTime} AND ol.order_status = 4
- </if>
- <if test="params.completeEndTime != null and params.completeEndTime != ''">
- AND ol.create_time <= #{params.completeEndTime} AND ol.order_status = 4
- </if>
- <if test="params.orderSn != null and params.orderSn != ''">
- AND (o.order_sn like concat('%', #{params.orderSn}, '%') or o.out_trade_no like concat('%', #{params.orderSn}, '%'))
- </if>
- <if test="params.sendContactName != null and params.sendContactName != ''">
- AND o.send_contact_name like concat('%', #{params.sendContactName}, '%')
- </if>
- <if test="params.sendPhone != null and params.sendPhone != ''">
- AND o.send_phone like concat('%', #{params.sendPhone}, '%')
- </if>
- <if test="params.receiptContactName != null and params.receiptContactName != ''">
- AND o.receipt_contact_name like concat('%', #{params.receiptContactName}, '%')
- </if>
- <if test="params.receiptPhone != null and params.receiptPhone != ''">
- AND o.receipt_phone like concat('%', #{params.receiptPhone}, '%')
- </if>
- <if test="params.sendProvinceName != null and params.sendProvinceName != ''">
- AND o.send_province_name like concat('%', #{params.sendProvinceName}, '%')
- </if>
- <if test="params.sendCityName != null and params.sendCityName != ''">
- AND o.send_city_name like concat('%', #{params.sendCityName}, '%')
- </if>
- <if test="params.sendDistrictName != null and params.sendDistrictName != ''">
- AND o.send_district_name like concat('%', #{params.sendDistrictName}, '%')
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType != 4">
- AND wo.order_type = #{params.waimaiOrderType}
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType == 4">
- AND o.waimai_order_id is null
- </if>
- </select>
- <select id="selectCountByStatus" resultType="com.ydd.module.dto.SystemOrderDto">
- SELECT
- o.delivery_status,
- wo.`status` AS wmStatus,
- o.waimai_order_id,
- o.order_sn,
- o.payment_type
- FROM lb_order AS o
- left join lb_merchant m ON o.merchant_id = m.id
- left join lb_member b ON o.member_id = b.id
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- left join lb_personnel p on o.personnel_id = p.id
- <if test="(params.completeStartTime != null and params.completeStartTime != '') or (params.completeEndTime != null and params.completeEndTime != '')">
- LEFT JOIN lb_order_log AS ol ON o.id = ol.order_id
- </if>
- WHERE 1 = 1
- AND
- (
- not(
- o.delivery_status = 0
- AND o.`status` = 0
- AND wo.`status` != 0
- AND ( wo.`status` != 4 OR wo.`status` IS NULL )
- )
- or o.waimai_order_id in (select waimai_order_id from lb_order where deleted=1)
- or o.save_flag = 1
- )
- <if test="params.personnelName != null and params.personnelName != ''">
- AND p.`name` like concat('%', #{params.personnelName}, '%')
- </if>
- <if test="params.personnelId != null">
- and o.personnel_id = #{params.personnelId}
- </if>
- <if test="params.deliveryStatus != 6">
- AND o.deleted = 0
- </if>
- <if test="params.deliveryStatus == 6">
- AND o.deleted = 1
- </if>
- <if test="params.memberId != null and params.memberId != ''">
- AND o.member_id = #{params.memberId}
- </if>
- <if test="params.merchantId != null and params.merchantId != ''">
- AND o.merchant_id = #{params.merchantId}
- </if>
- <if test="params.merchantName != null and params.merchantName != ''">
- AND m.merchant_name like concat('%', #{params.merchantName}, '%')
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId != 100">
- AND o.delivery_id = #{params.deliveryId}
- </if>
- <if test="params.deliveryId != null and params.deliveryId != '' and params.deliveryId == 100">
- AND (wo.status = 4 and o.delivery_status != 4 and o.delivery_id is null )
- </if>
- <if test="params.createStartTime != null and params.createStartTime != ''">
- AND o.create_time >= #{params.createStartTime}
- </if>
- <if test="params.createEndTime != null and params.createEndTime != ''">
- AND #{params.createEndTime} >= o.create_time
- </if>
- <!-- <if test="params.completeStartTime != null and params.completeStartTime != ''">-->
- <!-- AND o.update_time >= #{params.completeStartTime} AND o.delivery_status = 4-->
- <!-- </if>-->
- <!-- <if test="params.completeEndTime != null and params.completeEndTime != ''">-->
- <!-- AND o.update_time <= #{params.completeEndTime} AND o.delivery_status = 4-->
- <!-- </if>-->
- <if test="params.completeStartTime != null and params.completeStartTime != ''">
- AND ol.create_time >= #{params.completeStartTime} AND ol.order_status = 4
- </if>
- <if test="params.completeEndTime != null and params.completeEndTime != ''">
- AND ol.create_time <= #{params.completeEndTime} AND ol.order_status = 4
- </if>
- <if test="params.deliveryStartTime != null and params.deliveryStartTime != ''">
- AND o.delivery_time >= #{params.deliveryStartTime}
- </if>
- <if test="params.deliveryEndTime != null and params.deliveryEndTime != ''">
- AND #{params.deliveryEndTime} >= o.delivery_time
- </if>
- <!-- <if test="params.outTradeNo != null and params.outTradeNo != ''">-->
- <!-- AND o.out_trade_no like concat('%', #{params.outTradeNo}, '%')-->
- <!-- </if>-->
- <!-- <if test="params.orderSn != null and params.orderSn != ''">-->
- <!-- AND o.order_sn like concat('%', #{params.orderSn}, '%')-->
- <!-- </if>-->
- <if test="params.orderSn != null and params.orderSn != ''">
- AND (o.order_sn like concat('%', #{params.orderSn}, '%') or o.out_trade_no like concat('%', #{params.orderSn}, '%'))
- </if>
- <if test="params.productName != null and params.productName != ''">
- AND o.product_name like concat('%', #{params.productName}, '%')
- </if>
- <if test="params.paymentType != null and params.paymentType != ''">
- AND o.payment_type = #{params.paymentType}
- </if>
- <if test="params.couponId != null and params.couponId != ''">
- AND o.coupon_id = #{params.couponId}
- </if>
- <if test="params.memberName != null and params.memberName != ''">
- AND b.nickname like concat('%', #{params.memberName}, '%')
- </if>
- <if test="params.memberMobile != null and params.memberMobile != ''">
- AND b.mobile like concat('%', #{params.memberMobile}, '%')
- </if>
- <if test="params.sendContactName != null and params.sendContactName != ''">
- AND o.send_contact_name like concat('%', #{params.sendContactName}, '%')
- </if>
- <if test="params.sendPhone != null and params.sendPhone != ''">
- AND o.send_phone like concat('%', #{params.sendPhone}, '%')
- </if>
- <if test="params.receiptContactName != null and params.receiptContactName != ''">
- AND o.receipt_contact_name like concat('%', #{params.receiptContactName}, '%')
- </if>
- <if test="params.receiptPhone != null and params.receiptPhone != ''">
- AND o.receipt_phone like concat('%', #{params.receiptPhone}, '%')
- </if>
- <if test="params.status != null">
- AND o.status = #{params.status}
- </if>
- <!-- <if test="params.deliveryStatus != null and params.deliveryStatus != 0 and params.deliveryStatus != 4 and params.deliveryStatus != 100 and params.deliveryStatus != 6">-->
- <!-- AND (o.delivery_status = #{params.deliveryStatus} and (wo.`status`!=4 or wo.`status` is null))-->
- <!-- </if>-->
- <!-- <if test="params.deliveryStatus != null and params.deliveryStatus == 0">-->
- <!-- AND ((wo.status is null or wo.status != 4) and o.delivery_status=0 and o.waimai_order_id is not null)-->
- <!-- </if>-->
- <!-- <if test="params.deliveryStatus != null and params.deliveryStatus == 4">-->
- <!-- AND o.delivery_status=4-->
- <!-- </if>-->
- <!-- <if test="params.deliveryStatus != null and params.deliveryStatus == 100">-->
- <!-- AND (wo.status = 4 and o.delivery_status != 4)-->
- <!-- </if>-->
- <if test="params.agentId != null">
- AND
- o.agent_Id in
- <if test="agentIds.size > 0 and agentIds != null">
- <foreach collection="agentIds" index="index" item="item" open="(" separator="," close=")">
- #{item}
- </foreach>
- </if>
- </if>
- <if test="params.aId != null">
- AND
- o.agent_Id in
- <if test="aIds.size > 0 and aIds != null">
- <foreach collection="aIds" index="index" item="aid" open="(" separator="," close=")">
- #{aid}
- </foreach>
- </if>
- </if>
- <if test="params.receiptProvinceName != null and params.receiptProvinceName != ''">
- AND o.receipt_province_name like concat('%', #{params.receiptProvinceName}, '%')
- </if>
- <if test="params.receiptCityName != null and params.receiptCityName != ''">
- AND o.receipt_city_name like concat('%', #{params.receiptCityName}, '%')
- </if>
- <if test="params.receiptDistrictName != null and params.receiptDistrictName != ''">
- AND o.receipt_district_name like concat('%', #{params.receiptDistrictName}, '%')
- </if>
- <if test="params.sendProvinceName != null and params.sendProvinceName != ''">
- AND o.send_province_name like concat('%', #{params.sendProvinceName}, '%')
- </if>
- <if test="params.sendCityName != null and params.sendCityName != ''">
- AND o.send_city_name like concat('%', #{params.sendCityName}, '%')
- </if>
- <if test="params.sendDistrictName != null and params.sendDistrictName != ''">
- AND o.send_district_name like concat('%', #{params.sendDistrictName}, '%')
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType != 4">
- AND wo.order_type = #{params.waimaiOrderType}
- </if>
- <if test="params.waimaiOrderType != null and params.waimaiOrderType == 4">
- AND o.waimai_order_id is null
- </if>
- <if test="params.paymentType != null">
- AND (o.payment_type = #{params.paymentType} and o.status != 0)
- </if>
- </select>
- <select id="getOrderInfoByOrderId" resultType="com.ydd.module.dto.OrderInfoDto">
- SELECT
- o.id as orderId,
- o.waimai_order_id,
- o.order_sn,
- o.take_type,
- o.member_id,
- o.shop_id,
- o.shop_name,
- o.order_distance,
- o.receipt_address_id,
- o.receipt_province_name,
- o.receipt_city_name,
- o.receipt_district_name,
- o.receipt_address,
- o.receipt_contact_name,
- o.receipt_phone,
- o.receipt_extension,
- o.receipt_city_code,
- o.receipt_lng,
- o.receipt_lat,
- o.send_address_id,
- o.send_province_name,
- o.send_city_name,
- o.send_district_name,
- o.send_address,
- o.send_contact_name,
- o.send_phone,
- o.send_extension,
- o.send_city_code,
- o.send_lng,
- o.send_lat,
- o.delivery_status,
- o.delivery_id,
- o.take_time,
- o.take_remark,
- o.delivery_time,
- o.cancel_type,
- o.product_id,
- o.weight,
- o.product_name,
- o.pay_amount,
- o.payment_type,
- o.shipper_name,
- o.shipper_phone,
- o.delivery_logo,
- o.delivery_name,
- o.refund_money,
- o.out_trade_no,
- o.order_distance,
- o.total_amount,
- o.tip_amount,
- o.coupon_amount,
- o.first_coupon,
- o.auto_delivery_minutes,
- o.send_street,
- o.receipt_street,
- o.platform_type,
- case when o.waimai_order_id is not null then wo.total_price
- else o.product_amount end as productAmount,
- wo.out_order_id,
- case when wo.day_seq is not null then wo.day_seq
- else o.lb_day_seq
- end as day_seq,
- wo.caution,
- wo.waimai_id,
- wo.order_type,
- wo.status AS wmstatus,
- wo.delivery_time AS wmDeliveryTime,
- wo.order_time AS orderTime
- FROM lb_order AS o
- LEFT JOIN lb_waimai_order AS wo ON o.waimai_order_id = wo.id
- WHERE o.id = #{orderId} and o.deleted = 0
- </select>
- <select id="getSubsidyList" resultType="com.ydd.module.dto.SubsidyStatisticsDto">
- SELECT
- sum(original) as originalAmount,
- sum(reala) as realAmount,
- sum(coup) as couponAmount,
- (sum(original) - sum(reala)) as subsidyAmount,
- delivery_name as deliveryName,
- tim as date,
- sum(commission) as commission,
- if(sum(original) - sum(reala) >0,-(sum(original) - sum(reala)+sum(commission)),abs(sum(original) - sum(reala))-sum(commission)) as profit
- FROM
- (
- SELECT
- o.max_amount original,
- o.pay_amount - o.tip_amount reala,
- o.pay_amount realb,
- (select SUM(if(agent_id is not null,commission,0)) from lb_profits_detail d where d.order_id= o.id)commission,
- o.coupon_amount coup,
- o.delivery_name,
- DATE_FORMAT(o.create_time, '%Y-%m-%d') tim
- FROM
- lb_order o
- WHERE
- o.id in(select DISTINCT order_id from lb_profits_detail d where d.create_time >= #{params.startTime}
- AND d.create_time < #{params.endTime} and origin_source=0)
- and o.delivery_status = 4
- and o.payment_type!=5
- and o.dada_dsp_id is null
- ) t
- GROUP BY deliveryName,date
- ORDER BY date DESC
- </select>
- <select id="countPersonalOrder" resultType="java.lang.Integer">
- SELECT
- count(id)
- FROM
- lb_order
- WHERE
- member_id = #{memberId}
- AND shop_id is null
- AND delivery_status IN (0, 1, 2, 3, -1, -2)
- AND create_time >= #{lastDayTime};
- </select>
- </mapper>
|