123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391 |
- <?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.yc.ship.module.trade.dal.mysql.order.TradeOrderMapper">
- <resultMap id="MiddleWareDtoResultMap" type="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- <id property="id" column="id"/>
- <result property="orderNo" column="order_no"/>
- <result property="bindId" column="bindId"/>
- <result property="sourceName" column="source_name"/>
- <result property="externalOrderNo" column="external_order_no"/>
- <result property="externalOriginOrderNo" column="external_origin_order_no"/>
- <result property="routePlanId" column="route_plan_id"/>
- <result property="routePlanName" column="route_plan_name"/>
- <result property="visitorType" column="visitor_type"/>
- <result property="travelDate" column="travel_date"/>
- <result property="sellMethod" column="sell_method"/>
- <result property="sourceName" column="source_name"/>
- <result property="sellerId" column="seller_id"/>
- <result property="memberId" column="member_id"/>
- <result property="amount" column="amount"/>
- <result property="payAmount" column="pay_amount"/>
- <result property="paymentStatus" column="pay_status"/>
- <result property="paymentType" column="payment_type"/>
- <result property="orderStatus" column="order_status"/>
- <result property="paymentDate" column="payment_date"/>
- <result property="areaManagerId" column="area_manager_id"/>
- <result property="storeName" column="store_name"/>
- <result property="contactName" column="contactName"/>
- <result property="shareName" column="share_name"/>
- <result property="isBind" column="is_bind"/>
- <result property="credentialNo" column="credentialNo"/>
- <result property="city" column="city"/>
- <result property="province" column="province"/>
- <result property="county" column="county"/>
- <result property="createTime" column="create_time"/>
- <result property="mobile" column="mobile"/>
- <result property="auditState" column="audit_state"/>
- <result property="storeId" column="store_id"/>
- <result property="sourceId" column="source_id"/>
- <result property="isMarketing" column="is_marketing"/>
- <result property="isMarketingUse" column="is_marketing_use"/>
- <result property="remark" column="remark"/>
- <result property="dispatchStatus" column="dispatch_status"/>
- <result property="isInvoice" column="is_invoice"/>
- <result property="isChangeOrder" column="is_change_order"/>
- <result property="refundAmount" column="refund_amount"/>
- <result property="confirmType" column="confirm_type"/>
- <result property="travelStatus" column="travel_status"/>
- <result property="finishStatus" column="finish_status"/>
- <result property="agencyGroupId" column="agency_group_id"/>
- <collection property="orderPayList" resultMap="orderPayList"/>
- <collection property="insuranceList" resultMap="insuranceResultMap"/>
- <collection property="contractList" resultMap="contractResultMap"/>
- </resultMap>
- <resultMap id="MiddleWareDtoResultMap2" type="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderPdaRespVO">
- <id property="id" column="id"/>
- <result property="orderNo" column="order_no"/>
- <result property="bindId" column="bindId"/>
- <result property="sourceName" column="source_name"/>
- <result property="externalOrderNo" column="external_order_no"/>
- <result property="externalOriginOrderNo" column="external_origin_order_no"/>
- <result property="routePlanId" column="route_plan_id"/>
- <result property="routePlanName" column="route_plan_name"/>
- <result property="visitorType" column="visitor_type"/>
- <result property="travelDate" column="travel_date"/>
- <result property="sellMethod" column="sell_method"/>
- <result property="sourceName" column="source_name"/>
- <result property="sellerId" column="seller_id"/>
- <result property="memberId" column="member_id"/>
- <result property="amount" column="amount"/>
- <result property="payAmount" column="pay_amount"/>
- <result property="paymentStatus" column="pay_status"/>
- <result property="paymentType" column="payment_type"/>
- <result property="orderStatus" column="order_status"/>
- <result property="paymentDate" column="payment_date"/>
- <result property="areaManagerId" column="area_manager_id"/>
- <result property="storeName" column="store_name"/>
- <result property="contactName" column="contactName"/>
- <result property="shareName" column="share_name"/>
- <result property="isBind" column="is_bind"/>
- <result property="credentialNo" column="credentialNo"/>
- <result property="city" column="city"/>
- <result property="province" column="province"/>
- <result property="county" column="county"/>
- <result property="createTime" column="create_time"/>
- <result property="mobile" column="mobile"/>
- <result property="auditState" column="audit_state"/>
- <result property="storeId" column="store_id"/>
- <result property="sourceId" column="source_id"/>
- <result property="isMarketing" column="is_marketing"/>
- <result property="isMarketingUse" column="is_marketing_use"/>
- <result property="remark" column="remark"/>
- <result property="dispatchStatus" column="dispatch_status"/>
- <result property="isInvoice" column="is_invoice"/>
- <result property="isChangeOrder" column="is_change_order"/>
- <result property="refundAmount" column="refund_amount"/>
- <result property="confirmType" column="confirm_type"/>
- <result property="travelStatus" column="travel_status"/>
- <result property="finishStatus" column="finish_status"/>
- <result property="agencyGroupId" column="agency_group_id"/>
- <collection property="orderPayList" resultMap="orderPayList"/>
- <collection property="insuranceList" resultMap="insuranceResultMap"/>
- <collection property="contractList" resultMap="contractResultMap"/>
- </resultMap>
- <resultMap id="orderPayList" type="com.yc.ship.module.trade.api.dto.TradeOrderPayDTO">
- <id property="id" column="payId"/>
- <result property="orderId" column="id"/>
- <result property="payAmount" column="payAmount"/>
- <result property="paymentNo" column="payment_no"/>
- <result property="payStatus" column="pay_status"/>
- <result property="paymentType" column="payment_type"/>
- <result property="paymentDate" column="payment_date"/>
- </resultMap>
- <resultMap id="insuranceResultMap" type="com.yc.ship.module.trade.dal.dataobject.insurance.InsuranceDO">
- <id property="id" column="insuranceId"/>
- <result property="orderId" column="id"/>
- <result property="policyNo" column="policy_no"/>
- <result property="proposalNo" column="proposal_no"/>
- <result property="insuranceNo" column="insurance_no"/>
- <result property="insuranceStatus" column="insurance_status"/>
- <result property="insuredNum" column="insured_num"/>
- <result property="insuranceEffectDate" column="insurance_effect_date"/>
- <result property="electronicPolicy" column="electronic_policy"/>
- </resultMap>
- <resultMap id="contractResultMap" type="com.yc.ship.module.trade.dal.dataobject.contract.ContractDO">
- <id property="id" column="contractId"/>
- <result property="orderId" column="id"/>
- <result property="contractNo" column="contract_no"/>
- <result property="status" column="status"/>
- <result property="touristsCount" column="tourists_count"/>
- <result property="contractUrl" column="contract_url"/>
- <result property="operateName" column="operate_name"/>
- <result property="signerName" column="signer_name"/>
- <result property="signerMobile" column="signer_mobile"/>
- <result property="signingTime" column="signing_time"/>
- <result property="signingUrl" column="signing_url"/>
- <result property="viewUrl" column="view_url"/>
- </resultMap>
- <resultMap id="RefundResultMap" type="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- <id property="id" column="id"/>
- <result property="orderNo" column="order_no"/>
- <result property="sourceName" column="source_name"/>
- <result property="externalOrderNo" column="external_order_no"/>
- <result property="routePlanId" column="route_plan_id"/>
- <result property="visitorType" column="visitor_type"/>
- <result property="travelDate" column="travel_date"/>
- <result property="sellMethod" column="sell_method"/>
- <result property="sourceName" column="source_name"/>
- <result property="sellerId" column="seller_id"/>
- <result property="memberId" column="member_id"/>
- <result property="amount" column="amount"/>
- <result property="payAmount" column="pay_amount"/>
- <result property="orderStatus" column="order_status"/>
- <result property="paymentDate" column="payment_date"/>
- <result property="contactName" column="contact_name"/>
- <result property="credentialNo" column="credential_no"/>
- <result property="mobile" column="mobile"/>
- <result property="remark" column="remark"/>
- <collection property="tradeDetailList" resultMap="tradeDetailResultMap"/>
- </resultMap>
- <resultMap id="tradeDetailResultMap" type="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeDetailRespVO">
- <id property="orderId" column="id"/>
- <result property="id" column="detailId"/>
- <result property="voucherCode" column="voucher_code"/>
- <result property="voucherStatus" column="voucher_status"/>
- <result property="productName" column="product_name"/>
- <result property="specType" column="spec_type"/>
- <collection property="visitors" resultMap="visitorResultMap"/>
- </resultMap>
- <resultMap id="visitorResultMap" type="com.yc.ship.module.trade.dal.dataobject.order.TradeVisitorDO">
- <id property="detailId" column="detailId"/>
- <result property="id" column="visitorId"/>
- <result property="credentialNo" column="credential_no"/>
- <result property="credentialType" column="credential_type"/>
- <result property="name" column="name"/>
- </resultMap>
- <select id="getCategoryTreeList" resultType="com.yc.ship.module.product.api.dto.CategoryRespDTO">
- SELECT id,parent_id parentId,cate_name cateName,sort_num sortNum from product_category WHERE type = 1 AND use_status = 1 AND deleted = 0 AND tenant_id = #{tenantId} order by sort_num
- </select>
- <select id="getCategoryOTATreeList" resultType="com.yc.ship.module.product.api.dto.CategoryRespDTO">
- SELECT id,parent_id parentId,cate_name cateName,sort_num sortNum from product_category WHERE type = 1 AND use_status = 1 AND deleted = 0
- </select>
- <select id="getTradeOrderUserPage"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT td.*,tou.contact_name,tou.credential_no,tou.mobile,count(tdl.id) num,sum(CASE WHEN tdl.voucher_status in (1,2,3,4,6,8,9) THEN 1 ELSE 0 END) realnum,(tr.origin_amount-tr.refund_amount) feeAmount,tdl.product_name,tdl.spec_type,ifnull(tr.origin_amount-tr.refund_amount,0) realAmount
- ,tr.refund_amount refundAmount,
- ps.product_tag productTag,ps.product_tag2 productTag2,ps.product_tag3 productTag3,ps.product_tag4 productTag4
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- INNER JOIN product_spu ps on ps.id = tdl.product_id
- LEFT JOIN ota_distributor od on od.id = td.source_id
- LEFT JOIN (select m2.order_id,sum(m2.refund_amount) refund_amount,sum(m2.origin_amount) origin_amount from trade_refund m2 where m2.refund_status = 6 and m2.refund_method !=2 GROUP BY m2.order_id) tr on td.id = tr.order_id
- where 1= 1
- <if test="vo.orderStatus!=null and vo.orderStatus.size()>0">
- and td.order_status in
- <foreach collection="vo.orderStatus" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.tenantId!=null">
- AND td.tenant_id = #{vo.tenantId}
- </if>
- <choose>
- <when test="vo.orderNo != null and vo.orderNo.length() == 4">
- AND td.order_no like concat('%',#{vo.orderNo})
- </when>
- <when test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.externalOriginOrderNo != null and vo.externalOriginOrderNo != ''">
- AND td.external_origin_order_no = #{vo.externalOriginOrderNo}
- </if>
- <if test="vo.memberId != null and vo.memberId != ''">
- AND td.member_id = #{vo.memberId}
- </if>
- <if test="vo.dispatchStatus != null">
- AND td.dispatch_status = #{vo.dispatchStatus}
- </if>
- <if test="vo.payType != null">
- AND exists (select 1 from trade_order_pay top where top.order_id = td.id and top.payment_type = #{vo.payType})
- </if>
- <if test="vo.otaCateId != null and vo.otaCateId != ''">
- AND od.ota_category_id = #{vo.otaCateId}
- </if>
- <if test="vo.otaCateIds!=null and vo.otaCateIds.size()>0">
- and od.ota_category_id in
- <foreach collection="vo.otaCateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.otaId != null and vo.otaId != ''">
- AND td.source_id = #{vo.otaId}
- </if>
- <if test="vo.storeId != null and vo.storeId != ''">
- AND td.store_id = #{vo.storeId}
- </if>
- <if test="vo.productTag != null and vo.productTag != ''">
- AND ps.product_tag = #{vo.productTag}
- </if>
- <if test="vo.productTag2 != null and vo.productTag2 != ''">
- AND ps.product_tag2 = #{vo.productTag2}
- </if>
- <if test="vo.productTag3 != null and vo.productTag3 != ''">
- AND ps.product_tag3 = #{vo.productTag3}
- </if>
- <if test="vo.productTag4 != null and vo.productTag4 != ''">
- AND ps.product_tag4 = #{vo.productTag4}
- </if>
- <if test="vo.cateIds!=null and vo.cateIds.size()>0 and (vo.planIds==null or vo.planIds.size()==0)">
- AND tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.externalOrderNo != null and vo.externalOrderNo != ''">
- AND td.external_order_no = #{vo.externalOrderNo}
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- AND exists (select tv.id from trade_visitor tv where tv.detail_id = tdl.id and tv.credential_no = #{vo.credentialNo})
- </if>
- <if test="vo.userName != null and vo.userName != ''">
- AND exists (select tv.id from trade_visitor tv where tv.detail_id = tdl.id and tv.name = #{vo.userName})
- </if>
- <choose>
- <when test="vo.mobile != null and vo.mobile.length() == 4">
- AND tou.mobile like concat('%',#{vo.mobile})
- </when>
- <when test="vo.mobile != null and vo.mobile != ''">
- AND tou.mobile = #{vo.mobile}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.contactName != null and vo.contactName != ''">
- AND tou.contact_name = #{vo.contactName}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.orderDateStart != null and vo.orderDateStart != ''">
- AND td.create_time <![CDATA[ >= ]]> #{vo.orderDateStart}
- </if>
- <if test="vo.orderDateEnd != null and vo.orderDateEnd != ''">
- AND td.create_time <![CDATA[ <= ]]> #{vo.orderDateEnd}
- </if>
- <if test="vo.orderDate != null and vo.orderDate != ''">
- AND td.create_time = #{vo.orderDate}
- </if>
- <if test="vo.sellerId != null and vo.sellerId != ''">
- AND td.seller_id = #{vo.sellerId}
- </if>
- <if test="vo.shareName != null and vo.shareName != ''">
- AND td.share_name like concat('%',#{vo.shareName},'%')
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND tdl.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.sellMethod != null and vo.sellMethod != ''">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.isFullPay == 0">
- AND td.is_full_pay = #{vo.isFullPay}
- </if>
- <if test="vo.isComment != null">
- AND td.is_comment = #{vo.isComment}
- </if>
- <if test="vo.sourceId != null and vo.sourceId != ''">
- AND td.source_id = #{vo.sourceId}
- </if>
- <if test="vo.sourceName != null and vo.sourceName != ''">
- AND td.source_name like concat('%',#{vo.sourceName}, '%')
- </if>
- <if test="vo.travelStatus != null">
- AND td.travel_status = #{vo.travelStatus}
- </if>
- <if test="vo.orderRefundDateStart != null and vo.orderRefundDateEnd != ''">
- AND exists (select 1 from trade_refund tr where tr.order_id=td.id and tr.refund_status = 6 and tr.refund_time BETWEEN #{vo.orderRefundDateStart} and #{vo.orderRefundDateEnd} )
- </if>
- GROUP BY td.id
- ORDER BY td.create_time DESC
- </select>
- <select id="getTradeOrderUserCount" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderCountRespVO">
- SELECT count(DISTINCT td.id) orderNum,sum(if(tdl.voucher_status in (1,2,3,4,6,8,9), quantity_of_one,0)) totalNum,
- sum(if(tdl.spec_type='full' and tdl.voucher_status in (1,2,3,4,6,8,9), quantity_of_one,0)) fullNum,
- sum(if(tdl.spec_type='half' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) halfNum,
- sum(if(tdl.spec_type='free' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) freeNum,
- sum(if(tdl.spec_type='common' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) commonNum,
- sum(if(tdl.spec_type='car_seat' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) carSeatNum,
- sum(if(tdl.spec_type='car_yd' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) carYdNum,
- sum(if(tdl.spec_type='other' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) otherNum,
- sum(if(tdl.spec_type='carrying_children' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) carryingChildrenNum,
- sum(tdl.actual_price) totalPayAmount
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- INNER JOIN product_spu ps on ps.id = tdl.product_id
- LEFT JOIN ota_distributor od on od.id = td.source_id
- where 1= 1
- <if test="vo.orderStatus!=null and vo.orderStatus.size()>0">
- and td.order_status in
- <foreach collection="vo.orderStatus" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.tenantId!=null">
- AND td.tenant_id = #{vo.tenantId}
- </if>
- <choose>
- <when test="vo.orderNo != null and vo.orderNo.length() == 4">
- AND td.order_no like concat('%',#{vo.orderNo})
- </when>
- <when test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.externalOriginOrderNo != null and vo.externalOriginOrderNo != ''">
- AND td.external_origin_order_no = #{vo.externalOriginOrderNo}
- </if>
- <if test="vo.memberId != null and vo.memberId != ''">
- AND td.member_id = #{vo.memberId}
- </if>
- <if test="vo.productTag != null and vo.productTag != ''">
- AND ps.product_tag = #{vo.productTag}
- </if>
- <if test="vo.productTag2 != null and vo.productTag2 != ''">
- AND ps.product_tag2 = #{vo.productTag2}
- </if>
- <if test="vo.productTag3 != null and vo.productTag3 != ''">
- AND ps.product_tag3 = #{vo.productTag3}
- </if>
- <if test="vo.productTag4 != null and vo.productTag4 != ''">
- AND ps.product_tag4 = #{vo.productTag4}
- </if>
- <if test="vo.dispatchStatus != null">
- AND td.dispatch_status = #{vo.dispatchStatus}
- </if>
- <if test="vo.payType != null">
- AND exists (select 1 from trade_order_pay top where top.order_id = td.id and top.payment_type = #{vo.payType})
- </if>
- <if test="vo.otaCateId != null and vo.otaCateId != ''">
- AND od.ota_category_id = #{vo.otaCateId}
- </if>
- <if test="vo.planIds!=null and vo.planIds.size()>0 and vo.cateIds!=null and vo.cateIds.size()>0">
- AND (td.route_plan_id in
- <foreach collection="vo.planIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- or tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- )
- </if>
- <if test="vo.cateIds!=null and vo.cateIds.size()>0 and (vo.planIds==null or vo.planIds.size()==0)">
- AND tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.planIds!=null and vo.planIds.size()>0 and (vo.cateIds==null or vo.cateIds.size()==0)">
- and td.route_plan_id in
- <foreach collection="vo.planIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.otaId != null and vo.otaId != ''">
- AND td.source_id = #{vo.otaId}
- </if>
- <if test="vo.otaCateIds!=null and vo.otaCateIds.size()>0">
- and od.ota_category_id in
- <foreach collection="vo.otaCateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.storeId != null and vo.storeId != ''">
- AND td.store_id = #{vo.storeId}
- </if>
- <if test="vo.externalOrderNo != null and vo.externalOrderNo != ''">
- AND td.external_order_no = #{vo.externalOrderNo}
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- AND exists (select tv.id from trade_visitor tv where tv.detail_id = tdl.id and tv.credential_no = #{vo.credentialNo})
- </if>
- <if test="vo.userName != null and vo.userName != ''">
- AND exists (select tv.id from trade_visitor tv where tv.detail_id = tdl.id and tv.name = #{vo.userName})
- </if>
- <choose>
- <when test="vo.mobile != null and vo.mobile.length() == 4">
- AND tou.mobile like concat('%',#{vo.mobile})
- </when>
- <when test="vo.mobile != null and vo.mobile != ''">
- AND tou.mobile = #{vo.mobile}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.contactName != null and vo.contactName != ''">
- AND tou.contact_name = #{vo.contactName}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.orderDateStart != null and vo.orderDateStart != ''">
- AND td.create_time <![CDATA[ >= ]]> #{vo.orderDateStart}
- </if>
- <if test="vo.orderDateEnd != null and vo.orderDateEnd != ''">
- AND td.create_time <![CDATA[ <= ]]> #{vo.orderDateEnd}
- </if>
- <if test="vo.orderDate != null and vo.orderDate != ''">
- AND td.create_time = #{vo.orderDate}
- </if>
- <if test="vo.sellerId != null and vo.sellerId != ''">
- AND td.seller_id = #{vo.sellerId}
- </if>
- <if test="vo.shareName != null and vo.shareName != ''">
- AND td.share_name like concat('%',#{vo.shareName},'%')
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND tdl.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.sellMethod != null and vo.sellMethod != ''">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.isFullPay == 0">
- AND td.is_full_pay = #{vo.isFullPay}
- </if>
- <if test="vo.isComment != null">
- AND td.is_comment = #{vo.isComment}
- </if>
- <if test="vo.sourceId != null and vo.sourceId != ''">
- AND td.source_id = #{vo.sourceId}
- </if>
- <if test="vo.sourceName != null and vo.sourceName != ''">
- AND td.source_name like concat('%',#{vo.sourceName}, '%')
- </if>
- <if test="vo.travelStatus != null">
- AND td.travel_status = #{vo.travelStatus}
- </if>
- <if test="vo.orderRefundDateStart != null and vo.orderRefundDateEnd != ''">
- AND exists (select 1 from trade_refund tr where tr.order_id=td.id and tr.refund_status = 6 and tr.refund_time BETWEEN #{vo.orderRefundDateStart} and #{vo.orderRefundDateEnd} )
- </if>
- </select>
- <select id="getOtcTradeOrderUserPage"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT td.*,tou.contact_name,tou.credential_no,tou.mobile,count(tdl.id) num,
- sum(CASE WHEN tdl.voucher_status in (1,2,3,4,6,8,9) THEN 1 ELSE 0 END) realnum,tdl.product_name,
- tdl.spec_type,if(td.is_change_order = 0,ifnull(tr.origin_amount-tr.refund_amount,0),if(td.order_status>=6,td.pay_amount,0)-ifnull(tr.refund_amount,0)) realAmount,ifnull(td.plat_amount,0) platAmount,
- if(td.is_change_order = 0,ifnull(td.pay_amount - tr.origin_amount+tr.refund_amount,td.pay_amount),tr.refund_amount) refundAmount, SUM(IF(tv.credential_no IS NULL and tdl.voucher_status in (1,2,3,4,6,8,9) ,1,0)) notRealNum
- <if test="vo.otcType==null or vo.otcType ==0">
- ,(td.amount - td.pay_amount) saleAmount
- </if>
- <if test="vo.otcType!=null and vo.otcType ==1">
- ,obt.discountAmount saleAmount
- </if>
- ,ps.product_tag productTag,ps.product_tag2 productTag2,ps.product_tag3 productTag3,ps.product_tag4 productTag4,
- (
- select GROUP_CONCAT(specTypeInfo)
- from (
- select CONCAT(tdt.spec_type,'*',count(*)) specTypeInfo
- from
- trade_detail tdt
- where tdt.order_id = td.id
- and tdt.voucher_status in (1,2,3,6,8,9)
- GROUP BY tdt.spec_type
- ) t
- ) allSpecTypeInfo
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- INNER JOIN product_spu ps on ps.id = tdl.product_id
- LEFT JOIN trade_visitor tv on tv.detail_id = tdl.id
- left JOIN product_route_plan rt on rt.id = td.route_plan_id
- LEFT JOIN (select m2.order_id,sum(m2.refund_amount) refund_amount,sum(m2.origin_amount) origin_amount from trade_refund m2 where m2.refund_status = 6 and m2.refund_method !=2 GROUP BY m2.order_id) tr on td.id = tr.order_id
- <if test="vo.otcType!=null and vo.otcType ==1">
- left join (select tod.order_id, sum(tod.custom) discountAmount from trade_order_bind tod where deleted=0 and type in (7,8)
- group by tod.order_id
- ) obt ON obt.order_id = td.id
- </if>
- where 1= 1
- <if test="vo.tenantId!=null">
- AND td.tenant_id = #{vo.tenantId}
- </if>
- <if test="vo.orderStatus!=null and vo.orderStatus.size()>0">
- and td.order_status in
- <foreach collection="vo.orderStatus" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.groupNo!=null and vo.groupNo!=''">
- AND td.group_no = #{vo.groupNo}
- </if>
- <choose>
- <when test="vo.orderNo != null and vo.orderNo.length() == 4">
- AND td.order_no like concat('%',#{vo.orderNo})
- </when>
- <when test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.externalOrderNos != null and vo.externalOrderNos != '' and vo.externalOrderNos.size()>0 ">
- and td.external_order_no in
- <foreach collection="vo.externalOrderNos" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.memberId != null and vo.memberId != ''">
- AND td.member_id = #{vo.memberId}
- </if>
- <if test="vo.productTag != null and vo.productTag != ''">
- AND ps.product_tag = #{vo.productTag}
- </if>
- <if test="vo.productTag2 != null and vo.productTag2 != ''">
- AND ps.product_tag2 = #{vo.productTag2}
- </if>
- <if test="vo.productTag3 != null and vo.productTag3 != ''">
- AND ps.product_tag3 = #{vo.productTag3}
- </if>
- <if test="vo.productTag4 != null and vo.productTag4 != ''">
- AND ps.product_tag4 = #{vo.productTag4}
- </if>
- <if test="vo.storeId != null and vo.storeId != ''">
- AND td.store_id = #{vo.storeId}
- </if>
- <if test="vo.storeIds!=null and vo.storeIds.size()>0">
- and td.store_id in
- <foreach collection="vo.storeIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.externalOrderNo != null and vo.externalOrderNo != ''">
- AND td.external_order_no = #{vo.externalOrderNo}
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- and tv.credential_no = #{vo.credentialNo}
- </if>
- <if test="vo.userName != null and vo.userName != ''">
- AND tv.name = #{vo.userName}
- </if>
- <choose>
- <when test="vo.mobile != null and vo.mobile.length() == 4">
- AND tou.mobile like concat('%',#{vo.mobile})
- </when>
- <when test="vo.mobile != null and vo.mobile != ''">
- AND tou.mobile = #{vo.mobile}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.contactName != null and vo.contactName != ''">
- AND tou.contact_name = #{vo.contactName}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.orderDateStart != null and vo.orderDateStart != ''">
- AND td.create_time <![CDATA[ >= ]]> #{vo.orderDateStart}
- </if>
- <if test="vo.orderDateEnd != null and vo.orderDateEnd != ''">
- AND td.create_time <![CDATA[ <= ]]> #{vo.orderDateEnd}
- </if>
- <if test="vo.orderDate != null and vo.orderDate != ''">
- AND td.create_time = #{vo.orderDate}
- </if>
- <if test="vo.sellerId != null and vo.sellerId != ''">
- AND td.seller_id = #{vo.sellerId}
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND tdl.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.sellMethod != null and vo.sellMethod != ''">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.isFullPay == 0">
- AND td.is_full_pay = #{vo.isFullPay}
- </if>
- <if test="vo.isComment != null">
- AND td.is_comment = #{vo.isComment}
- </if>
- <if test="vo.sourceId != null and vo.sourceId != ''">
- AND td.source_id = #{vo.sourceId}
- </if>
- <if test="vo.shareName != null and vo.shareName != ''">
- AND td.share_name like concat('%',#{vo.shareName},'%')
- </if>
- <if test="vo.sourceName != null and vo.sourceName != ''">
- AND td.source_name like concat('%',#{vo.sourceName}, '%')
- </if>
- <if test="vo.travelStatus != null">
- AND td.travel_status = #{vo.travelStatus}
- </if>
- <if test="vo.orderRefundDateStart != null and vo.orderRefundDateEnd != ''">
- AND exists (select 1 from trade_refund tr where tr.order_id=td.id and tr.refund_status = 6 and tr.refund_time BETWEEN #{vo.orderRefundDateStart} and #{vo.orderRefundDateEnd} )
- </if>
- GROUP BY td.id
- ORDER BY td.create_time DESC
- </select>
- <select id="getOtcTradeOrderUserCount" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderCountRespVO">
- SELECT count(DISTINCT td.id) orderNum,sum(tdl.quantity_of_one) totalNum,
- sum(if(tdl.spec_type='full' and tdl.voucher_status in (1,2,3,4,6,8,9), quantity_of_one,0)) fullNum,
- sum(if(tdl.spec_type='half' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) halfNum,
- sum(if(tdl.spec_type='free' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) freeNum,
- sum(if(tdl.spec_type='common' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) commonNum,
- sum(if(tdl.spec_type='car_seat' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) carSeatNum,
- sum(if(tdl.spec_type='car_yd' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) carYdNum,
- sum(if(tdl.spec_type='other' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) otherNum,
- sum(if(tdl.spec_type='carrying_children' and tdl.voucher_status in (1,2,3,4,6,8,9),quantity_of_one,0)) carryingChildrenNum
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- INNER JOIN product_spu ps on ps.id = tdl.product_id
- where 1= 1
- <if test="vo.tenantId!=null">
- AND td.tenant_id = #{vo.tenantId}
- </if>
- <if test="vo.orderStatus!=null and vo.orderStatus.size()>0">
- and td.order_status in
- <foreach collection="vo.orderStatus" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.groupNo!=null and vo.groupNo!=''">
- AND td.group_no = #{vo.groupNo}
- </if>
- <choose>
- <when test="vo.orderNo != null and vo.orderNo.length() == 4">
- AND td.order_no like concat('%',#{vo.orderNo})
- </when>
- <when test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.externalOrderNos != null and vo.externalOrderNos != '' and vo.externalOrderNos.size()>0 ">
- and td.external_order_no in
- <foreach collection="vo.externalOrderNos" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.memberId != null and vo.memberId != ''">
- AND td.member_id = #{vo.memberId}
- </if>
- <if test="vo.storeId != null and vo.storeId != ''">
- AND td.store_id = #{vo.storeId}
- </if>
- <if test="vo.storeIds!=null and vo.storeIds.size()>0">
- and td.store_id in
- <foreach collection="vo.storeIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.externalOrderNo != null and vo.externalOrderNo != ''">
- AND td.external_order_no = #{vo.externalOrderNo}
- </if>
- <if test="vo.productTag != null and vo.productTag != ''">
- AND ps.product_tag = #{vo.productTag}
- </if>
- <if test="vo.productTag2 != null and vo.productTag2 != ''">
- AND ps.product_tag2 = #{vo.productTag2}
- </if>
- <if test="vo.productTag3 != null and vo.productTag3 != ''">
- AND ps.product_tag3 = #{vo.productTag3}
- </if>
- <if test="vo.productTag4 != null and vo.productTag4 != ''">
- AND ps.product_tag4 = #{vo.productTag4}
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- AND exists (select tv.id from trade_visitor tv where tv.detail_id = tdl.id and tv.credential_no = #{vo.credentialNo})
- </if>
- <if test="vo.userName != null and vo.userName != ''">
- AND exists (select tv.id from trade_visitor tv where tv.detail_id = tdl.id and tv.name = #{vo.userName})
- </if>
- <choose>
- <when test="vo.mobile != null and vo.mobile.length() == 4">
- AND tou.mobile like concat('%',#{vo.mobile})
- </when>
- <when test="vo.mobile != null and vo.mobile != ''">
- AND tou.mobile = #{vo.mobile}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.contactName != null and vo.contactName != ''">
- AND tou.contact_name = #{vo.contactName}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.orderDateStart != null and vo.orderDateStart != ''">
- AND td.create_time <![CDATA[ >= ]]> #{vo.orderDateStart}
- </if>
- <if test="vo.orderDateEnd != null and vo.orderDateEnd != ''">
- AND td.create_time <![CDATA[ <= ]]> #{vo.orderDateEnd}
- </if>
- <if test="vo.orderDate != null and vo.orderDate != ''">
- AND td.create_time = #{vo.orderDate}
- </if>
- <if test="vo.sellerId != null and vo.sellerId != ''">
- AND td.seller_id = #{vo.sellerId}
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND tdl.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.sellMethod != null and vo.sellMethod != ''">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.isFullPay == 0">
- AND td.is_full_pay = #{vo.isFullPay}
- </if>
- <if test="vo.isComment != null">
- AND td.is_comment = #{vo.isComment}
- </if>
- <if test="vo.sourceId != null and vo.sourceId != ''">
- AND td.source_id = #{vo.sourceId}
- </if>
- <if test="vo.shareName != null and vo.shareName != ''">
- AND td.share_name like concat('%',#{vo.shareName},'%')
- </if>
- <if test="vo.sourceName != null and vo.sourceName != ''">
- AND td.source_name like concat('%',#{vo.sourceName}, '%')
- </if>
- <if test="vo.travelStatus != null">
- AND td.travel_status = #{vo.travelStatus}
- </if>
- <if test="vo.orderRefundDateStart != null and vo.orderRefundDateEnd != ''">
- AND exists (select 1 from trade_refund tr where tr.order_id=td.id and tr.refund_status = 6 and tr.refund_time BETWEEN #{vo.orderRefundDateStart} and #{vo.orderRefundDateEnd} )
- </if>
- </select>
- <select id="getTransOrderPage"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeTranOrderRespVO">
- SELECT td.*, oac.name transDistributorName, tou.contact_name,tou.credential_no,tou.mobile,COUNT(tdl.id) num,tdl.product_name,tdl.spec_type
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- inner join otc_agency_cooperate oac on oac.id = td.trans_distributor_id
- left join trade_visitor tv on tdl.id = tv.detail_id
- where 1= 1 AND td.trans_distributor_id is not null
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- <if test="vo.memberId != null and vo.memberId != ''">
- AND td.member_id = #{vo.memberId}
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- AND tv.credential_no = #{vo.credentialNo}
- </if>
- <if test="vo.mobile != null and vo.mobile != ''">
- AND tou.mobile = #{vo.mobile}
- </if>
- <if test="vo.contactName != null and vo.contactName != ''">
- AND tou.contact_name = #{vo.contactName}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.orderDateStart != null and vo.orderDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.orderDateStart}
- </if>
- <if test="vo.orderDateEnd != null and vo.orderDateEnd != ''">
- AND td.create_time <![CDATA[ <= ]]> #{vo.orderDateEnd}
- </if>
- <if test="vo.orderDate != null and vo.orderDate != ''">
- AND td.create_time = #{vo.orderDate}
- </if>
- <if test="vo.sellerId != null and vo.sellerId != ''">
- AND td.seller_id = #{vo.sellerId}
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND tdl.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.transDistributorName != null and vo.transDistributorName != ''">
- AND oac.name like concat('%',#{vo.transDistributorName}, '%')
- </if>
- <if test="vo.sellMethod != null and vo.sellMethod != ''">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- GROUP BY td.id
- ORDER BY td.create_time DESC
- </select>
- <select id="getTotalTransOrder" resultType="java.util.Map">
- SELECT sum(pay_amount) payAmount,sum(trans_amount) transAmount from (
- SELECT td.id,td.pay_amount,td.trans_amount
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- inner join otc_agency_cooperate oac on oac.id = td.trans_distributor_id
- left join trade_visitor tv on tdl.id = tv.detail_id
- where 1= 1 AND td.trans_distributor_id is not null
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- <if test="vo.memberId != null and vo.memberId != ''">
- AND td.member_id = #{vo.memberId}
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- AND tv.credential_no = #{vo.credentialNo}
- </if>
- <if test="vo.mobile != null and vo.mobile != ''">
- AND tou.mobile = #{vo.mobile}
- </if>
- <if test="vo.contactName != null and vo.contactName != ''">
- AND tou.contact_name = #{vo.contactName}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.orderDateStart != null and vo.orderDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.orderDateStart}
- </if>
- <if test="vo.orderDateEnd != null and vo.orderDateEnd != ''">
- AND td.create_time <![CDATA[ <= ]]> #{vo.orderDateEnd}
- </if>
- <if test="vo.orderDate != null and vo.orderDate != ''">
- AND td.create_time = #{vo.orderDate}
- </if>
- <if test="vo.sellerId != null and vo.sellerId != ''">
- AND td.seller_id = #{vo.sellerId}
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND tdl.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.transDistributorName != null and vo.transDistributorName != ''">
- AND oac.name like concat('%',#{vo.transDistributorName}, '%')
- </if>
- <if test="vo.sellMethod != null and vo.sellMethod != ''">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- GROUP BY td.id
- ) p
- </select>
- <select id="getPaidOrderPage"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT td.*, op.pay_amount payAmount, op.refund_amount refundAmount, op.pay_status paymentStatus, op.payment_type paymentType, op.payment_date paymentDate
- FROM trade_order td
- INNER JOIN trade_order_pay op on op.order_id = td.id
- where td.order_status <![CDATA[ >= ]]> 6 and td.order_status <![CDATA[ <= ]]> 11
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- <if test="vo.payType != null">
- AND op.payment_type = #{vo.payType}
- </if>
- <if test="vo.storeId != null and vo.storeId != ''">
- AND td.store_id = #{vo.storeId}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.orderDateStart != null and vo.orderDateStart != ''">
- AND op.payment_date <![CDATA[ >= ]]> #{vo.orderDateStart}
- </if>
- <if test="vo.orderDateEnd != null and vo.orderDateEnd != ''">
- AND op.payment_date <![CDATA[ <= ]]> #{vo.orderDateEnd}
- </if>
- <if test="vo.orderDate != null and vo.orderDate != ''">
- AND td.create_time = #{vo.orderDate}
- </if>
- <if test="vo.sellerId != null and vo.sellerId != ''">
- AND td.seller_id = #{vo.sellerId}
- </if>
- <if test="vo.sellMethod != null and vo.sellMethod != ''">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- ORDER BY td.create_time DESC
- </select>
- <select id="getCanBindOrder"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT o.*, u.contact_name, u.credential_no, u.mobile, COUNT(d.id) num, d.product_name, d.spec_type
- FROM trade_order o
- INNER JOIN trade_detail d ON d.order_id = o.id
- INNER JOIN trade_order_user u on o.id = u.order_id,
- ( SELECT o.*, d.product_id
- FROM trade_order o
- INNER JOIN trade_detail d ON d.order_id = o.id
- WHERE o.id = #{vo.orderId}
- AND not EXISTS ( SELECT 1 FROM trade_order_bind b WHERE b.deleted = 0 AND o.id= b.bind_id)
- AND o.order_status > 5 AND o.deleted = 0
- GROUP BY o.id) t
- WHERE
- o.order_status > 5 AND o.deleted = 0
- AND o.is_bind IS NULL and o.id != #{vo.orderId}
- AND DATE_FORMAT( o.travel_date, '%Y-%m-%d' ) = DATE_FORMAT( t.travel_date, '%Y-%m-%d' )
- AND d.product_id = t.product_id
- AND ((t.route_plan_id is NULL) or (t.route_plan_id is not NULL AND o.route_plan_id = t.route_plan_id))
- <if test="vo.mobile != null and vo.mobile != ''">
- AND u.mobile = #{vo.mobile}
- </if>
- <if test="vo.sourceId != null and vo.sourceId != ''">
- AND o.source_id = #{vo.sourceId}
- </if>
- GROUP BY o.id ORDER BY o.create_time DESC
- </select>
- <select id="getBoundOrder"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT o.*, u.contact_name, u.credential_no, u.mobile, COUNT(d.id) num, d.product_name, d.spec_type
- FROM trade_order o
- INNER JOIN trade_detail d ON d.order_id = o.id
- INNER JOIN trade_order_user u on o.id = u.order_id
- WHERE
- o.order_status > 5 AND o.deleted = 0
- AND EXISTS ( select * from (
- select bind_id id from trade_order_bind where order_id = #{bindOrderId} and deleted = 0 union all
- select order_id id from trade_order_bind where bind_id = #{bindOrderId} and deleted = 0 ) m where m.id =o.id)
- GROUP BY o.id ORDER BY o.create_time DESC
- </select>
- <select id="getRefundDetailPage"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeDetailRespVO">
- SELECT td.*,tv.credential_no,tv.`name`,tv.mobile,tor.order_no
- FROM trade_detail td
- INNER JOIN trade_visitor tv on tv.detail_id = td.id
- LEFT JOIN trade_order tor on tor.id = td.order_id
- where 1= 1
- <if test="vo.name != null and vo.name != ''">
- AND tv.name = #{vo.name}
- </if>
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND tor.order_no = #{vo.orderNo}
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- AND tv.credential_no = #{vo.credentialNo}
- </if>
- <if test="vo.mobile != null and vo.mobile != ''">
- AND tv.mobile = #{vo.mobile}
- </if>
- <if test="vo.orderStatus != null and vo.orderStatus != ''">
- AND tor.order_status = #{vo.orderStatus}
- </if>
- </select>
- <select id="getRefundRecordPage"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.refund.RefundRespVO">
- SELECT tr.*,td.order_no, ou.mobile,td.travel_date, ou.contact_name ,tdl.product_name
- FROM trade_refund tr
- INNER JOIN trade_order td on tr.order_id = td.id
- inner join trade_order_user ou on ou.order_id = td.id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id and tdl.deleted = 0
- where 1= 1
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- <if test="vo.refundStatus!=null and vo.refundStatus.size()>0">
- and tr.refund_status in
- <foreach collection="vo.refundStatus" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.refundMethod != null and vo.refundMethod != ''">
- AND tr.refund_method = #{vo.refundMethod}
- </if>
- <if test="vo.refundUserId!=null and vo.refundUserId.size()>0">
- and tr.refund_user in
- <foreach collection="vo.refundUserId" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.refundChannel != null">
- AND tr.refund_channel = #{vo.refundChannel}
- </if>
- <if test="vo.mobile != null and vo.mobile != ''">
- AND ou.mobile = #{vo.mobile}
- </if>
- <if test="vo.sourceId != null and vo.sourceId != ''">
- AND td.source_id = #{vo.sourceId}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.refundTime != null and vo.refundTime != ''">
- AND td.refund_time = #{vo.refundTime}
- </if>
- <if test="vo.refundTimeStart != null and vo.refundTimeStart != ''">
- AND td.refund_time <![CDATA[ >= ]]> #{vo.refundTimeStart}
- </if>
- <if test="vo.refundTimeEnd != null and vo.refundTimeEnd != ''">
- AND td.refund_time <![CDATA[ <= ]]> #{vo.refundTimeEnd}
- </if>
- <if test="vo.cateIds!=null and vo.cateIds.size()>0 and vo.planIds==null">
- AND tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.planIds!=null and vo.planIds.size()>0 and (vo.cateIds==null or vo.cateIds.size()==0)">
- and td.route_plan_id in
- <foreach collection="vo.planIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- group by tr.id
- ORDER BY tr.create_time DESC
- </select>
- <select id="getOrderInfo" resultMap="MiddleWareDtoResultMap">
- SELECT td.id,td.pay_amount,td.order_no,td.external_order_no,td.visitor_type,td.travel_date,td.sell_method,td.source_id,td.source_name,td.store_id,td.seller_id,td.member_id,td.amount,td.order_status,td.remark,td.share_name,td.create_time,td.is_marketing,td.is_marketing_use,
- tou.contact_name contactName,tou.credential_no credentialNo,tou.mobile,tou.county,tou.province,tou.city,td.agency_group_id,
- top.id payId,top.pay_amount payAmount,top.pay_status,top.payment_type,top.payment_date,top.payment_no,
- td.store_name,td.is_invoice, td.confirm_type, td.travel_status, tr.refund_amount,td.finish_status,
- ti.id insuranceId,ti.policy_no,ti.proposal_no,ti.insurance_no,ti.insurance_status,ti.insured_num,ti.insurance_effect_date,ti.electronic_policy,
- tc.id contractId,tc.contract_no,tc.`status`,tc.tourists_count,tc.contract_url,tc.operate_name,tc.signer_name,tc.signer_mobile,tc.signing_time
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- left JOIN trade_order_pay top on td.id = top.order_id AND top.pay_status = 1 and top.deleted = 0
- left JOIN trade_insurance ti on td.id = ti.order_id
- left JOIN trade_contract tc on td.id = tc.order_id
- LEFT JOIN (select m2.order_id,sum(m1.refund_amount) refund_amount from trade_refund_detail m1
- inner join trade_refund m2 on m1.refund_id = m2.id where m2.order_id = #{id} and m1.refund_status = 6 GROUP BY m2.order_id) tr on td.id = tr.order_id
- where 1= 1
- AND td.id = #{id}
- </select>
- <select id="getPdaOrderInfo" resultMap="MiddleWareDtoResultMap2">
- SELECT td.id,td.pay_amount,td.order_no,td.external_order_no,td.external_origin_order_no,td.route_plan_id,rt.name route_plan_name,td.visitor_type,td.travel_date,td.sell_method,td.source_id,td.source_name,td.store_id,td.seller_id,td.member_id,td.amount,td.order_status,td.remark,td.share_name,td.create_time,td.is_bind,td.area_manager_id,td.is_marketing,td.is_marketing_use,
- tou.contact_name contactName,tou.credential_no credentialNo,tou.mobile,tou.county,tou.province,tou.city,td.is_change_order,td.agency_group_id,
- top.id payId,top.pay_amount payAmount,top.pay_status,top.payment_type,top.payment_date,top.payment_no,
- td.store_name,td.dispatch_status,td.is_invoice, td.confirm_type, td.travel_status, tr.refund_amount,td.finish_status,
- ti.id insuranceId,ti.policy_no,ti.proposal_no,ti.insurance_no,ti.insurance_status,ti.insured_num,ti.insurance_effect_date,ti.electronic_policy,
- tc.id contractId,tc.contract_no,tc.`status`,tc.tourists_count,tc.contract_url,tc.operate_name,tc.signer_name,tc.signer_mobile,tc.signing_time,tc.signing_url,tc.view_url
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- left JOIN trade_order_pay top on td.id = top.order_id AND top.pay_status = 1 and top.deleted = 0
- left JOIN trade_insurance ti on td.id = ti.order_id
- left JOIN trade_contract tc on td.id = tc.order_id
- left JOIN product_route_plan rt on rt.id = td.route_plan_id
- LEFT JOIN (select m2.order_id,sum(m1.refund_amount) refund_amount from trade_refund_detail m1
- inner join trade_refund m2 on m1.refund_id = m2.id where m2.order_id = #{id} and m1.refund_status = 6 GROUP BY m2.order_id) tr on td.id = tr.order_id
- where 1= 1
- AND td.id = #{id}
- </select>
- <select id="selectBindOrderPage" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT td.id,td.pay_amount,td.order_no,td.external_order_no,td.route_plan_id,td.visitor_type,td.travel_date,td.sell_method,td.source_name,td.seller_id,td.member_id,td.amount,td.order_status,td.remark,td.share_name,td.create_time,td.is_bind,td.area_manager_id,
- tou.contact_name contactName,tou.credential_no credentialNo,tou.mobile,
- td.store_name,pma.audit_state
- FROM
- trade_order td
- INNER JOIN trade_order_user tou ON td.id = tou.order_id
- INNER JOIN trade_order_bind tob on tob.order_id = td.id
- LEFT JOIN product_marketing_audit pma on pma.order_id = td.id
- WHERE
- tob.type = 7 AND tob.deleted = 0 and td.order_status in (6,8)
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- ORDER BY td.id
- </select>
- <select id="getMarketingApplyOrderPage" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT td.id,td.pay_amount,td.order_no,td.external_order_no,td.route_plan_id,td.visitor_type,td.travel_date,td.sell_method,td.source_name,td.source_id,td.seller_id,td.member_id,td.amount,td.order_status,td.remark,td.share_name,td.create_time,td.is_bind,td.area_manager_id,td.agency_group_id,
- tou.contact_name contactName,tou.credential_no credentialNo,tou.mobile,
- td.store_name,td.store_id,pma.audit_state,pma.use_audit_state,pma.type auditType,pma.id marketingAuditId,pma.is_execute,pma.error_text,pmk.name marketingName,pmk.policy_type policyType,pma.remark auditRemark,pma.file_url fileUrl
- FROM
- product_marketing_audit pma
- INNER JOIN trade_order td on pma.order_id = td.id
- inner join trade_detail ttd on td.id = ttd.order_id
- INNER JOIN trade_order_user tou ON td.id = tou.order_id
- LEFT JOIN product_marketing pmk ON pmk.id = pma.marketing_id
- WHERE 1 = 1 AND td.order_status != 11 and
- pma.travel_id in (SELECT DISTINCT travel_id FROM product_marketing_pm WHERE user_id = #{vo.userId} and deleted = 0)
- <if test="vo.ids.size()>0">
- and pma.travel_id in
- <foreach collection="vo.ids" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- <if test="vo.policyType != null and vo.policyType != ''">
- AND pmk.policy_type = #{vo.policyType}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND ttd.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.marketingName != null and vo.marketingName != ''">
- AND pmk.name like concat('%',#{vo.marketingName}, '%')
- </if>
- <if test="vo.isExecute != null and vo.isExecute != ''">
- AND pma.is_execute = #{vo.isExecute}
- </if>
- <if test="vo.distributorId != null and vo.distributorId != ''">
- AND pma.agency_id = #{vo.distributorId}
- </if>
- <if test="vo.storeId != null and vo.storeId != ''">
- AND pma.store_id = #{vo.storeId}
- </if>
- <if test="vo.orderStartTime != null and vo.orderStartTime != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.orderStartTime}
- </if>
- <if test="vo.orderEndTime != null and vo.orderEndTime != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.orderEndTime}
- </if>
- <if test="vo.auditState != null ">
- AND pma.audit_state = #{vo.auditState}
- </if>
- GROUP BY pma.id,td.id
- order by pma.create_time desc
- </select>
- <select id="getStoresMarketingOrderPage" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeMarketOrderRespVO">
- SELECT td.id,td.pay_amount,td.order_no,td.external_order_no,td.route_plan_id,td.visitor_type,td.travel_date,td.sell_method,td.source_name,td.source_id,td.seller_id,td.member_id,td.amount,td.order_status,td.remark,td.share_name,td.create_time,td.is_bind,td.area_manager_id,td.agency_group_id,
- tou.contact_name contactName,tou.credential_no credentialNo,tou.mobile,
- td.store_name,td.store_id,pma.audit_state,pma.use_audit_state,pma.type auditType,pma.id marketingAuditId,pma.remark auditRemark,pma.is_execute,pma.error_text,pma.file_url fileUrl,if(pms.id is null,null, pmk.`name`) marketingName,if(pms.id is null,null, pmk.policy_type) policyType
- FROM
- product_marketing_audit pma
- INNER JOIN trade_order td on pma.order_id = td.id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- INNER JOIN trade_order_user tou ON td.id = tou.order_id
- LEFT JOIN product_marketing_pool_spu pms on td.id = pms.order_id
- LEFT JOIN product_marketing pmk ON pmk.id = pma.marketing_id
- WHERE 1 = 1
- <if test="vo.storeId != null">
- and pma.store_id = #{vo.storeId}
- </if>
- <if test="vo.distributorId != null">
- and td.source_id = #{vo.distributorId}
- </if>
- <if test="vo.ids.size()>0">
- and pma.travel_id in
- <foreach collection="vo.ids" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.isExecute != null">
- and pma.is_execute = #{vo.isExecute}
- </if>
- <if test="vo.policyType != null and vo.policyType != ''">
- AND pmk.policy_type = #{vo.policyType}
- </if>
- <if test="vo.marketingName != null and vo.marketingName != ''">
- AND pmk.name like concat('%',#{vo.marketingName}, '%')
- </if>
- <if test="vo.auditState != null">
- and pma.audit_state = #{vo.auditState}
- </if>
- <if test="vo.useAuditState != null">
- and pma.use_audit_state = #{vo.useAuditState}
- </if>
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- GROUP BY pma.id
- order by pma.create_time desc
- </select>
- <select id="getStoresMarketingOrderDesc" resultType="java.util.Map">
- SELECT td.id,td.pay_amount,td.order_no,td.external_order_no,td.route_plan_id,td.visitor_type,td.travel_date,td.sell_method,td.source_name,td.source_id,td.seller_id,td.member_id,td.amount,td.order_status,td.remark,td.share_name,td.create_time,td.is_bind,td.area_manager_id,td.agency_group_id,
- tou.contact_name contactName,tou.credential_no credentialNo,tou.mobile,
- td.store_name,td.store_id,pma.audit_state,pma.use_audit_state,pma.type auditType,pma.id marketingAuditId,pma.remark auditRemark,pma.is_execute,pma.error_text,pma.file_url fileUrl
- FROM
- product_marketing_audit pma
- INNER JOIN trade_order td on pma.order_id = td.id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- INNER JOIN trade_order_user tou ON td.id = tou.order_id
- LEFT JOIN product_marketing pmk ON pmk.id = pma.marketing_id
- WHERE 1 = 1
- <if test="vo.storeId != null">
- and pma.store_id = #{vo.storeId}
- </if>
- <if test="vo.ids.size()>0">
- and pma.travel_id in
- <foreach collection="vo.ids" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.isExecute != null">
- and pma.is_execute = #{vo.isExecute}
- </if>
- <if test="vo.policyType != null and vo.policyType != ''">
- AND pmk.policy_type = #{vo.policyType}
- </if>
- <if test="vo.marketingName != null and vo.marketingName != ''">
- AND pmk.name like concat('%',#{vo.marketingName}, '%')
- </if>
- <if test="vo.auditState != null">
- and pma.audit_state = #{vo.auditState}
- </if>
- <if test="vo.useAuditState != null">
- and pma.use_audit_state = #{vo.useAuditState}
- </if>
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- GROUP BY pma.id
- order by pma.create_time desc
- </select>
- <select id="selectBindMarketing" resultType="java.lang.Long">
- SELECT tob.bind_id
- FROM
- trade_order_bind tob
- WHERE
- tob.type = 7 AND tob.deleted = 0 AND tob.order_id = #{orderId}
- </select>
- <select id="selectBindUseMarketing" resultType="java.lang.Long">
- SELECT tob.bind_id
- FROM
- trade_order_bind tob
- WHERE
- tob.type = 8 AND tob.deleted = 0 AND tob.order_id = #{orderId}
- </select>
- <select id="getRefundOrderInfo" resultMap="RefundResultMap">
- SELECT td.id,td.order_no,td.external_order_no,td.route_plan_id,td.visitor_type,td.travel_date,td.sell_method,td.source_name,td.seller_id,td.member_id,td.amount,td.pay_amount,td.order_status,td.payment_date,td.remark,
- tou.contact_name contactName,tou.credential_no credentialNo,tou.mobile,
- tdl.id detailId,tdl.voucher_code,tdl.voucher_status,tdl.product_name,tdl.spec_type,
- tv.id visitorId,tv.credential_no,tv.credential_type,tv.`name`
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- INNER JOIN trade_visitor tv on tdl.id = tv.detail_id
- where 1= 1
- <if test="id != null and id != ''">
- AND td.id = #{id}
- </if>
- </select>
- <select id="getPageRefundRecord"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.refund.RefundRecordRespVO">
- SELECT trr.*,td.order_no, td.id orderId, td.travel_date
- FROM trade_refund_record trr
- left join trade_order_pay top on trr.order_pay_id = top.id
- left join trade_refund tr on trr.refund_id = tr.id
- left join trade_order td on td.id = top.order_id
- where 1= 1
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- <if test="vo.refundNo != null and vo.refundNo != ''">
- AND trr.refund_no = #{vo.refundNo}
- </if>
- <if test="vo.paymentNo != null and vo.paymentNo != ''">
- AND trr.payment_no = #{vo.paymentNo}
- </if>
- <if test="vo.refundStatus != null and vo.refundStatus != ''">
- AND trr.refund_status = #{vo.refundStatus}
- </if>
- <if test="vo.refundId != null and vo.refundId != ''">
- AND trr.refund_id = #{vo.refundId}
- </if>
- <if test="vo.openId != null and vo.openId != ''">
- AND trr.openId = #{vo.openId}
- </if>
- <if test="vo.sourceId != null and vo.sourceId != ''">
- AND td.source_id = #{vo.sourceId}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.travel_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.travel_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.refundTime != null and vo.refundTime != ''">
- AND trr.refund_time = #{vo.refundTime}
- </if>
- <if test="vo.refundTimeStart != null and vo.refundTimeStart != ''">
- AND trr.refund_time <![CDATA[ >= ]]> #{vo.refundTimeStart}
- </if>
- <if test="vo.refundTimeEnd != null and vo.refundTimeEnd != ''">
- AND trr.refund_time <![CDATA[ <= ]]> #{vo.refundTimeEnd}
- </if>
- ORDER BY trr.create_time DESC
- </select>
- <select id="getPrintTemp"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.otc.PrintRespVO">
- SELECT pt.* FROM print_temp pt where pt.template_code = #{printTemp}
- </select>
- <select id="queryCanInvoicedOrderPage"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT
- o.order_no,
- o.travel_date,
- o.order_status,
- o.amount,
- o.create_time,
- o.external_order_no,
- o.id,
- o.is_invoice,
- o.item_id,
- o.payment_date,
- o.remark,
- o.route_plan_id,
- o.seller_id,
- o.sell_method,
- o.share_name,
- o.source_id,
- o.source_name,
- o.store_id,
- o.store_name,
- o.visitor_type,
- ps.cost_price,
- tou.contact_name,
- tou.credential_no,
- tou.mobile,
- td.product_name,
- count(
- DISTINCT
- CASE
- WHEN (
- td.voucher_status in (3,6,7,8)
- OR ( td.voucher_status = 9 AND td.check_status = 1 )
- ) THEN
- td.id ELSE null
- END
- ) AS num,
- o.pay_amount - SUM( ifnull(trd.refund_amount,0) ) - SUM(
- CASE
- WHEN ( td.voucher_status in (1,2) )
- AND DATE_FORMAT( td.validity_end_date, '%Y-%c-%d' ) >= DATE_FORMAT( NOW( ), '%Y-%c-%d' ) THEN
- td.actual_price ELSE 0
- END
- ) AS pay_amount
- FROM
- trade_order o
- INNER JOIN trade_detail td ON td.order_id = o.id
- LEFT JOIN trade_refund_detail trd ON trd.trade_detail_id = td.id
- AND trd.refund_status = 6
- INNER JOIN trade_order_user tou ON o.id = tou.order_id
- INNER JOIN product_spu ps ON ps.id = td.product_id
- LEFT JOIN trade_invoice_detail i ON i.order_no = o.order_no
- LEFT JOIN trade_invoice ii ON i.invoice_id = ii.id AND ii.invoice_status IN (1,3)
- LEFT JOIN (select order_id,payment_type from trade_order_pay where pay_status=1 GROUP BY order_id) op ON op.order_id = o.id
- LEFT JOIN ota_bill_order obo ON obo.order_id = o.id
- LEFT JOIN ota_bill_store obs ON obs.id = obo.bill_store_id AND obs.bill_status=1
- where td.validity_end_date >= DATE_SUB(NOW(), INTERVAL #{canInvoicedDay} DAY)
- and o.is_invoice in (0,2)
- and o.order_status in (7,8,9,11,12)
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND o.order_no = #{vo.orderNo}
- </if>
- <if test="vo.sourceId != null and vo.sourceId != ''">
- AND o.source_id = #{vo.sourceId}
- </if>
- <if test="vo.storeId != null and vo.storeId != ''">
- AND o.store_id = #{vo.storeId}
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- AND tou.credential_no = #{vo.credentialNo}
- </if>
- <if test="vo.mobile != null and vo.mobile != ''">
- AND tou.mobile = #{vo.mobile}
- </if>
- <if test="vo.contactName != null and vo.contactName != ''">
- AND tou.contact_name = #{vo.contactName}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND o.travel_date = #{vo.travelDate}
- </if>
- <if test="vo.sellerId != null and vo.sellerId != ''">
- AND o.seller_id = #{vo.sellerId}
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND td.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.sellMethod != null and vo.sellMethod != ''">
- AND o.sell_method = #{vo.sellMethod}
- </if>
- <if test="vo.travelDateStart != null and vo.travelDateStart != ''">
- AND td.use_date <![CDATA[ >= ]]> #{vo.travelDateStart}
- </if>
- <if test="vo.travelDateEnd != null and vo.travelDateEnd != ''">
- AND td.use_date <![CDATA[ <= ]]> #{vo.travelDateEnd}
- </if>
- <if test="vo.orderDateStart != null and vo.orderDateStart != ''">
- AND o.payment_date <![CDATA[ >= ]]> #{vo.orderDateStart}
- </if>
- <if test="vo.orderDateEnd != null and vo.orderDateEnd != ''">
- AND o.payment_date <![CDATA[ <= ]]> #{vo.orderDateEnd}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND td.product_name like concat('%',#{vo.productName}, '%')
- </if>
- AND ii.id IS NULL
- AND (op.payment_type != 6 OR (o.is_bill=2 AND obs.id IS NOT NULL))
- AND date_format(NOW(), '%Y-%m-%d') > date_format(o.travel_date, '%Y-%m-%d')
- GROUP BY
- o.order_no
- HAVING
- SUM(CASE WHEN td.voucher_status IN (1,2) AND td.validity_end_date >= CURDATE() THEN 1 ELSE 0 END) = 0
- AND pay_amount > 0
- ORDER BY
- o.travel_date DESC
- </select>
- <select id="getOrderByVoucherCode"
- resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- SELECT o.* FROM trade_order o
- inner join trade_detail d on d.order_id = o.id
- where (o.order_status = 6 or o.order_status = 7) and d.voucher_code = #{voucherCode} limit 1
- </select>
- <select id="getOrderByExternalOrderNo" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- select t1.* from trade_order t1 inner join trade_supplier_order t2 on t1.id = t2.order_id where t2.trade_no=#{tradeNo} limit 1
- </select>
- <select id="getOtcOrderByExternalOrderNo" resultType="java.util.Map">
- select t2.* from trade_order t1 inner join trade_supplier_order t2 on t1.id = t2.order_id where t1.order_no=#{tradeNo} limit 1
- </select>
- <select id="getTradeOrderByVoucherCode" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- SELECT o.* FROM trade_order o inner join trade_detail d on d.order_id = o.id where d.voucher_code = #{voucherCode} limit 1
- </select>
- <select id="getOrderByCardNo"
- resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- SELECT
- o.*
- FROM
- trade_order o
- INNER JOIN trade_detail d ON d.order_id = o.id
- INNER JOIN trade_visitor v ON v.detail_id = d.id
- WHERE
- o.travel_date >= CURDATE()
- and d.voucher_status in (1,2,3,4,8,9)
- and v.credential_no = #{cardNo}
- </select>
- <select id="getOrderByDetailBase"
- resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- SELECT o.* FROM trade_order o
- inner join trade_detail d on d.order_id = o.id
- inner join trade_detail_base tdb on tdb.detail_id = d.id
- where (o.order_status = 6 or o.order_status = 7) and tdb.id = #{baseId} limit 1
- </select>
- <select id="getAccountOrderPage"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT td.*,tou.contact_name,tou.credential_no,tou.mobile,COUNT(tdl.id) num,tdl.product_name,tdl.spec_type
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id
- INNER JOIN trade_detail tdl on td.id = tdl.order_id
- where 1= 1 AND td.order_status NOT IN (-2, -1, 0, 1, 2, 12) AND td.is_account = 0
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </if>
- <if test="vo.contactName != null and vo.contactName != ''">
- AND tou.contact_name = #{vo.contactName}
- </if>
- <if test="vo.travelDate != null and vo.travelDate != ''">
- AND td.travel_date = #{vo.travelDate}
- </if>
- GROUP BY td.id
- ORDER BY td.create_time DESC
- </select>
- <update id="updateOrderStatus">
- UPDATE trade_order SET order_status = #{orderStatus} WHERE id = #{orderId} and order_status != #{orderStatus}
- </update>
- <update id="updateOrderIsAccount">
- UPDATE trade_order SET is_account = #{isAccount} WHERE id = #{orderId}
- </update>
- <resultMap id="OrderAndDetailResultMap" type="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderPdaRespVO">
- <id property="id" column="id"/>
- <result property="orderNo" column="order_no"/>
- <result property="sourceName" column="source_name"/>
- <result property="externalOrderNo" column="external_order_no"/>
- <result property="routePlanId" column="route_plan_id"/>
- <result property="visitorType" column="visitor_type"/>
- <result property="travelDate" column="travel_date"/>
- <result property="sellMethod" column="sell_method"/>
- <result property="sourceName" column="source_name"/>
- <result property="sellerId" column="seller_id"/>
- <result property="memberId" column="member_id"/>
- <result property="amount" column="amount"/>
- <result property="payAmount" column="pay_amount"/>
- <result property="orderStatus" column="order_status"/>
- <result property="paymentDate" column="payment_date"/>
- <result property="contactName" column="contact_name"/>
- <result property="credentialNo" column="credential_no"/>
- <result property="mobile" column="mobile"/>
- <result property="remark" column="remark"/>
- <collection property="tradeDetailList" resultMap="tradeDetailMap"/>
- </resultMap>
- <resultMap id="tradeDetailMap" type="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeDetailRespVO">
- <result property="id" column="detailId"/>
- <result property="orderId" column="order_id"/>
- <result property="voucherCode" column="voucher_code"/>
- <result property="voucherStatus" column="voucher_status"/>
- <result property="useDate" column="use_date"/>
- <result property="validityStartDate" column="validity_start_date"/>
- <result property="validityEndDate" column="validity_end_date"/>
- <result property="usageDays" column="usage_days"/>
- <result property="checkStatus" column="check_status"/>
- <result property="takeStatus" column="take_status"/>
- <result property="refundStatus" column="refund_status"/>
- <result property="verifyTime" column="verify_time"/>
- <result property="activateStatus" column="activate_status"/>
- <result property="activateDays" column="activate_days"/>
- <result property="activateTime" column="activate_time"/>
- <result property="productId" column="product_id"/>
- <result property="productName" column="product_name"/>
- <result property="specType" column="spec_type"/>
- <collection property="detailBaseList" resultMap="tradeDetailBaseResMap"/>
- </resultMap>
- <resultMap id="tradeDetailBaseResMap" type="com.yc.ship.module.trade.controller.admin.order.vo.order.DetailBaseRespVO">
- <result property="id" column="detail_base_id"/>
- <result property="detailId" column="detailId"/>
- <result property="productBaseId" column="product_base_id"/>
- <result property="productBaseName" column="product_base_name"/>
- <result property="productBaseType" column="product_base_type"/>
- <result property="productResourceId" column="product_resource_id"/>
- <result property="productResourceName" column="product_resource_name"/>
- <result property="supplierProductId" column="supplier_product_id"/>
- <result property="supplierId" column="supplier_id"/>
- <result property="supplierName" column="supplier_name"/>
- <result property="isSystemDirect" column="is_system_direct"/>
- <result property="useStatus" column="use_status"/>
- <result property="checkStatus" column="base_check_status"/>
- <result property="verifyTime" column="base_verify_time"/>
- <result property="price" column="base_price"/>
- <result property="usageCount" column="usage_count"/>
- <result property="productResourcePrice" column="product_resource_price"/>
- <result property="projectId" column="project_id"/>
- <result property="projectName" column="project_name"/>
- <result property="specificationId" column="specification_id"/>
- <result property="specificationName" column="specification_name"/>
- <result property="specType" column="base_spec_type"/>
- <result property="supplierVoucherCode" column="supplier_voucher_code"/>
- <result property="platSupplierOrderId" column="plat_supplier_order_id"/>
- </resultMap>
- <select id="getOrderAndDetailInfo" resultMap="OrderAndDetailResultMap">
- SELECT distinct td.id,td.order_no,td.external_order_no,td.route_plan_id,td.visitor_type,td.travel_date,td.sell_method,td.source_name,td.seller_id,td.member_id,td.amount,td.pay_amount,td.order_status,td.payment_date,td.remark,
- tou.contact_name,tou.credential_no,tou.mobile,
- tdl.id detailId,tdl.voucher_code,tdl.voucher_status,tdl.product_name,tdl.spec_type,tdl.validity_start_date,tdl.validity_end_date,
- tdb.id detail_base_id,tdb.detail_id,tdb.product_base_id,tdb.product_base_name,tdb.product_base_type,tdb.product_resource_id,tdb.product_resource_name,tdb.supplier_product_id,tdb.supplier_id,
- tdb.supplier_name,tdb.is_system_direct,tdb.use_status,tdb.check_status base_check_status,tdb.verify_time base_verify_time,tdb.price base_price,tdb.usage_count,tdb.product_resource_price,tdb.project_id,tdb.project_name,
- tdb.specification_id,tdb.specification_name,tdb.spec_type base_spec_type,tdb.supplier_voucher_code,tdb.plat_supplier_order_id
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id and td.deleted = 0
- INNER JOIN trade_detail tdl on td.id = tdl.order_id and tdl.deleted = 0
- INNER JOIN trade_visitor tv on tv.detail_id = tdl.id and tv.deleted = 0
- inner join trade_detail_base tdb on tdl.id = tdb.detail_id
- where 1= 1 and td.order_status >= 6 and td.order_status <![CDATA[ <= ]]> 9
- and td.sell_method != 3 and td.sell_method != 4
- and tdl.validity_start_date <![CDATA[ <= ]]> NOW()
- and tdl.validity_end_date <![CDATA[ >= ]]> NOW()
- <if test="channelId != null and channelId != ''">
- and tdb.product_base_id in (select product_id from product_check_channel where channel_id=#{channelId} and deleted = 0)
- </if>
- <if test="orderNo != null and orderNo != ''">
- AND td.order_no = #{orderNo}
- </if>
- <choose>
- <when test="phone != null and phone.length() == 4">
- AND tou.mobile like concat('%',#{phone})
- </when>
- <when test="phone != null and phone != ''">
- AND tou.mobile = #{phone}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <choose>
- <when test="cardNo != null and cardNo.length() == 4">
- AND tv.credential_no like concat('%',#{cardNo})
- </when>
- <when test="cardNo != null and cardNo != ''">
- AND tv.credential_no = #{cardNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- ORDER BY td.travel_date DESC
- </select>
- <select id="getPlatOrderNo" resultType="java.lang.String">
- select t3.order_no from trade_order t1
- inner join trade_supplier_order t2 on t1.id = t2.order_id
- inner join trade_order t3 on t2.trade_no = t3.external_order_no
- where t1.order_no = #{orderNo}
- </select>
- <select id="getCheckOrder" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT td.id,td.order_no,td.external_order_no,td.route_plan_id,td.travel_status,plan.name as route_plan_name,td.visitor_type,td.travel_date,
- td.sell_method,td.source_name,td.seller_id,td.member_id,td.amount,td.pay_amount,td.order_status,
- td.payment_date,td.remark, tou.contact_name,tou.credential_no,tou.mobile,td.is_add_order
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id and td.deleted = 0
- INNER JOIN trade_detail tdl on td.id = tdl.order_id and tdl.deleted = 0
- left join product_route_plan plan on td.route_plan_id = plan.id
- <if test="vo.type != null and vo.dispatchId == null and vo.type == 'boat'">
- left join dispatch_operate_plan_boat_order_detail_base dopbodb on td.id = dopbodb.order_id and dopbodb.deleted = 0
- </if>
- <if test="vo.type != null and vo.dispatchId == null and vo.type == 'car'">
- left join dispatch_car_dispatch_order_detail_base dcdodb on td.id = dcdodb.order_id and dcdodb.deleted = 0
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- INNER JOIN trade_visitor tv on tv.detail_id = tdl.id and tv.deleted = 0
- </if>
- where 1=1
- <choose>
- <when test="vo.orderStatus != null">
- AND td.order_status = #{vo.orderStatus}
- </when>
- <otherwise>
- and td.order_status in (6,7,8,9,10,13)
- </otherwise>
- </choose>
- <choose>
- <when test="vo.travelDate != null and vo.travelDate != ''">
- AND DATE_FORMAT(tdl.validity_start_date, '%Y-%m-%d') <![CDATA[ <= ]]> #{vo.travelDate}
- AND DATE_FORMAT(tdl.validity_end_date, '%Y-%m-%d') <![CDATA[ >= ]]> #{vo.travelDate}
- </when>
- <otherwise>
- and tdl.validity_start_date <![CDATA[ <= ]]> NOW()
- and tdl.validity_end_date <![CDATA[ >= ]]> NOW()
- </otherwise>
- </choose>
- <choose>
- <when test="vo.orderNo != null and vo.orderNo.length() == 4">
- AND td.order_no like concat('%',#{vo.orderNo})
- </when>
- <when test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <choose>
- <when test="vo.phone != null and vo.phone.length() == 4">
- AND tou.mobile like concat('%',#{vo.phone})
- </when>
- <when test="vo.phone != null and vo.phone != ''">
- AND tou.mobile = #{vo.phone}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <choose>
- <when test="vo.credentialNo != null and vo.credentialNo.length() == 4">
- AND tv.credential_no like concat('%',#{vo.credentialNo})
- </when>
- <when test="vo.credentialNo != null and vo.credentialNo != ''">
- AND tv.credential_no = #{vo.credentialNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.type != null and vo.dispatchId != null and vo.type == 'boat'">
- AND td.id in (SELECT DISTINCT order_id FROM dispatch_operate_plan_boat_order_detail_base
- WHERE plan_id = #{vo.dispatchId} and deleted = 0)
- </if>
- <if test="vo.type != null and vo.dispatchId != null and vo.type == 'car'">
- AND td.id in (SELECT DISTINCT order_id FROM dispatch_car_dispatch_order_detail_base
- WHERE car_dispatch_id = #{vo.dispatchId} and deleted = 0)
- </if>
- <if test="vo.travelStatus != null">
- AND td.travel_status = #{vo.travelStatus}
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND tdl.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.sellMethod != null">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- <if test="vo.planIds!=null and vo.planIds.size()>0 and vo.cateIds!=null and vo.cateIds.size()>0">
- AND (td.route_plan_id in
- <foreach collection="vo.planIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- or tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- )
- </if>
- <if test="vo.cateIds!=null and vo.cateIds.size()>0 and vo.planIds==null">
- AND tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.planIds!=null and vo.planIds.size()>0 and (vo.cateIds==null or vo.cateIds.size()==0)">
- and td.route_plan_id in
- <foreach collection="vo.planIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- group by td.id
- ORDER BY td.create_time DESC
- </select>
- <select id="countCheckOrder" resultType="java.lang.Integer">
- SELECT count(DISTINCT td.id) num FROM trade_order td
- INNER JOIN trade_detail tdl ON td.id = tdl.order_id
- INNER JOIN trade_order_user tou ON td.id = tou.order_id
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- INNER JOIN trade_visitor tv on tv.detail_id = tdl.id and tv.deleted = 0
- </if>
- where 1=1
- <choose>
- <when test="vo.orderStatus != null">
- AND td.order_status = #{vo.orderStatus}
- </when>
- <otherwise>
- and td.order_status in (6,7,8,9,10,13)
- </otherwise>
- </choose>
- <choose>
- <when test="vo.travelDate != null and vo.travelDate != ''">
- AND DATE_FORMAT(tdl.validity_start_date, '%Y-%m-%d') <![CDATA[ <= ]]> #{vo.travelDate}
- AND DATE_FORMAT(tdl.validity_end_date, '%Y-%m-%d') <![CDATA[ >= ]]> #{vo.travelDate}
- </when>
- <otherwise>
- and tdl.validity_start_date <![CDATA[ <= ]]> NOW()
- and tdl.validity_end_date <![CDATA[ >= ]]> NOW()
- </otherwise>
- </choose>
- <choose>
- <when test="vo.orderNo != null and vo.orderNo.length() == 4">
- AND td.order_no like concat('%',#{vo.orderNo})
- </when>
- <when test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <choose>
- <when test="vo.phone != null and vo.phone.length() == 4">
- AND tou.mobile like concat('%',#{vo.phone})
- </when>
- <when test="vo.phone != null and vo.phone != ''">
- AND tou.mobile = #{vo.phone}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <choose>
- <when test="vo.credentialNo != null and vo.credentialNo.length() == 4">
- AND tv.credential_no like concat('%',#{vo.credentialNo})
- </when>
- <when test="vo.credentialNo != null and vo.credentialNo != ''">
- AND tv.credential_no = #{vo.credentialNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.type != null and vo.dispatchId != null and vo.type == 'boat'">
- AND td.id in (SELECT DISTINCT order_id FROM dispatch_operate_plan_boat_order_detail_base
- WHERE plan_id = #{vo.dispatchId} and deleted = 0)
- </if>
- <if test="vo.type != null and vo.dispatchId != null and vo.type == 'car'">
- AND td.id in (SELECT DISTINCT order_id FROM dispatch_car_dispatch_order_detail_base
- WHERE car_dispatch_id = #{vo.dispatchId} and deleted = 0)
- </if>
- <if test="vo.travelStatus != null">
- AND td.travel_status = #{vo.travelStatus}
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND tdl.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.sellMethod != null">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- <if test="vo.planIds!=null and vo.planIds.size()>0 and vo.cateIds!=null and vo.cateIds.size()>0">
- AND (td.route_plan_id in
- <foreach collection="vo.planIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- or tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- )
- </if>
- <if test="vo.cateIds!=null and vo.cateIds.size()>0 and vo.planIds==null">
- AND tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.planIds!=null and vo.planIds.size()>0 and (vo.cateIds==null or vo.cateIds.size()==0)">
- and td.route_plan_id in
- <foreach collection="vo.planIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- </select>
- <select id="selectStoreMachineProductList"
- resultType="java.lang.Long">
- SELECT t1.product_id FROM otc_agency_store_machine_product t1
- where 1=1
- <if test="vo.storeId != null and vo.storeId != ''">
- AND t1.store_id = #{vo.storeId}
- </if>
- <if test="vo.machineId != null and vo.machineId != ''">
- AND t1.machine_id = #{vo.machineId}
- </if>
- </select>
- <select id="orderListByOta" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- SELECT
- t1.*
- FROM
- trade_order t1
- inner join trade_detail t3 on t1.id = t3.order_id
- inner join trade_visitor t4 on t3.id = t4.detail_id
- INNER JOIN trade_order_user t2 ON t2.order_id = t1.id
- WHERE
- t1.sell_method = 0
- AND t1.order_status in (6,7,8,9,10,13)
- AND t1.tenant_id = #{tenantId}
- AND t1.travel_date = #{travelDate}
- <if test="credentialNo != null and credentialNo != ''">
- AND t4.credential_no = #{credentialNo}
- </if>
- <if test="mobile != null and mobile != ''">
- AND t2.mobile = #{mobile}
- </if>
- ORDER BY
- t1.payment_date DESC
- </select>
- <select id="transCooperateList"
- resultType="com.yc.ship.module.otc.api.agency.dto.CooperateRespDTO">
- SELECT t1.* FROM otc_agency_cooperate t1
- where t1.deleted=0
- <if test="vo.transDistributorId != null ">
- AND t1.id = #{vo.transDistributorId}
- </if>
- </select>
- <select id="orderList" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- SELECT
- t1.*
- FROM
- trade_order t1
- INNER JOIN trade_order_user t2 ON t2.order_id = t1.id
- INNER JOIN trade_detail td on t1.id = td.order_id
- INNER JOIN trade_visitor v on v.detail_id = td.id
- WHERE
- 1 = 1
- <if test="orderStatus!=null and orderStatus.size()>0">
- AND t1.order_status in
- <foreach collection="orderStatus" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- AND t1.tenant_id = #{tenantId}
- AND t1.travel_date = #{travelDate}
- <if test="credentialNo != null and credentialNo != ''">
- AND v.credential_no = #{credentialNo}
- </if>
- <if test="mobile != null and mobile != ''">
- AND t2.mobile = #{mobile}
- </if>
- group by t1.id
- ORDER BY
- t1.payment_date DESC
- </select>
- <select id="countDirectOrderByOrderId" resultType="java.lang.Integer">
- select count(o.id) total
- from trade_supplier_order so
- inner join trade_order o on so.supplier_order_no = o.order_no
- where so.order_id = #{orderId} and o.is_direct = 1
- </select>
- <select id="queryRelatedOrderId" resultType="java.lang.Long">
- SELECT td.order_id FROM trade_detail td
- INNER JOIN trade_detail_base db ON db.supplier_voucher_code=td.voucher_code
- WHERE db.order_id=#{orderId} GROUP BY td.order_id
- UNION ALL
- SELECT db.order_id FROM trade_detail_base db
- INNER JOIN trade_detail td ON db.supplier_voucher_code=td.voucher_code
- WHERE td.order_id=#{orderId} GROUP BY db.order_id
- </select>
- <select id="queryOneByOrderNo" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- SELECT DISTINCT o2.*
- FROM trade_order o
- INNER JOIN trade_detail d on d.order_id = o.id
- INNER JOIN trade_detail_base db ON db.detail_id = d.id
- INNER JOIN trade_detail d2 ON db.supplier_voucher_code = d2.voucher_code
- INNER JOIN trade_order o2 ON d2.order_id = o2.id
- WHERE o.order_no = #{orderNo}
- union all
- SELECT o.* FROM trade_order o WHERE o.sell_method in (0,1,6,7) and o.order_no = #{orderNo}
- </select>
- <select id="updateAppletProductSellNum">
- update applet_product t1 inner JOIN applet_product_group t2 ON t1.id = t2.applet_product_id
- and t2.deleted =0
- set t1.sell_num = t1.sell_num+#{sellNum} where t2.product_id = #{productId}
- </select>
- <select id="selectCanBindOrderList" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- SELECT o.id,o.is_bind
- FROM trade_order o
- INNER JOIN trade_detail d ON d.order_id = o.id
- INNER JOIN trade_order_user u on o.id = u.order_id
- WHERE
- o.order_status > 5 AND o.deleted = 0
- AND (o.is_bind IS NULL or o.is_bind = 0 ) and o.id != #{vo.orderId}
- AND o.travel_date = #{vo.travelDate}
- AND d.product_id = #{vo.productId}
- <if test="vo.routePlanId !=null">
- And o.route_plan_id = #{vo.routePlanId}
- </if>
- AND u.mobile = #{vo.mobile}
- GROUP BY o.id
- </select>
- <update id="deleteOrderById">
- delete from trade_order where id = #{orderId}
- </update>
- <select id="getInvoiceOrderCount" resultType="java.lang.Integer">
- select count(1) num from trade_invoice t1 inner join trade_invoice_detail t2 on t1.id = t2.invoice_id
- and t1.invoice_status in (1,3)
- where t2.order_no = #{orderNo} and t1.deleted = 0
- </select>
- <select id="selectPlatPayAmountByOriginOrderNo" resultType="java.util.Map">
- select sum(tod.pay_amount) totalPayAmount
- from trade_order tod
- where tod.external_origin_order_no =#{originOrderNo} and tod.order_status>=6
- </select>
- <select id="queryOrderStatusError" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
- SELECT o.* FROM trade_order o
- INNER JOIN (
- SELECT d.order_id, sum(d.voucher_status = 3) checkNum, COUNT(*) totalNum
- FROM trade_detail d
- INNER JOIN trade_order o on o.id = d.order_id and o.order_status in (7, 13) GROUP BY d.order_id) t on
- t.order_id = o.id
- WHERE t.checkNum = t.totalNum
- ORDER BY o.travel_date DESC
- </select>
- <select id="selectChangeCountByOrderId" resultType="java.lang.Integer">
- select count(*) totalCount
- from trade_order tod
- inner join trade_order_bind tb on tod.id = tb.order_id and tb.type = 2 and tb.deleted =0
- inner join trade_order tod1 on tod1.id = tb.bind_id
- where tod.id = #{orderId} and tod1.order_status>=6
- </select>
- <update id="updateOrderFinishStatus">
- update trade_order tod,
- (select tod.id
- from trade_order tod
- inner join trade_detail td on tod.id = td.order_id
- where tod.sell_method in
- <foreach collection="sellMethodList" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- and tod.order_status >=6
- and td.validity_end_date = #{endDate}
- and not EXISTS (
- select 1
- from trade_detail td1
- where td1.validity_end_date > #{endDate} and td1.order_id = tod.id and td1.refund_status != 1
- )
- ) t
- set tod.finish_status = 1
- where tod.id = t.id
- </update>
- <select id="getSupplierCheckOrder" resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
- SELECT td.id,td.order_no,td.external_order_no,td.route_plan_id,plan.name as route_plan_name,td.visitor_type,td.travel_date,
- td.sell_method,td.source_name,td.seller_id,td.member_id,td.amount,td.pay_amount,td.order_status,
- td.payment_date,td.remark, tou.contact_name,tou.credential_no,tou.mobile
- FROM trade_order td
- INNER JOIN trade_order_user tou on td.id = tou.order_id and td.deleted = 0
- INNER JOIN trade_detail tdl on td.id = tdl.order_id and tdl.deleted = 0
- INNER JOIN trade_detail_base tdb on tdb.detail_id = tdl.id
- left join product_route_plan plan on td.route_plan_id = plan.id
- <if test="vo.type != null and vo.dispatchId == null and vo.type == 'boat'">
- inner join dispatch_operate_plan_boat_order_detail_base dopbodb on td.id = dopbodb.order_id and dopbodb.deleted = 0
- </if>
- <if test="vo.type != null and vo.dispatchId == null and vo.type == 'car'">
- inner join dispatch_car_dispatch_order_detail_base dcdodb on td.id = dcdodb.order_id and dcdodb.deleted = 0
- </if>
- <if test="vo.credentialNo != null and vo.credentialNo != ''">
- INNER JOIN trade_visitor tv on tv.detail_id = tdl.id and tv.deleted = 0
- </if>
- where supplier_id in (
- select t2.id from product_supplier_user t1 inner join product_supplier t2 on t1.supplier_id = t2.id
- where t1.user_id=#{vo.userId} and t1.deleted =0
- )
- <choose>
- <when test="vo.orderStatus != null">
- AND td.order_status = #{vo.orderStatus}
- </when>
- <otherwise>
- and td.order_status in (6,7,8,9,10,13)
- </otherwise>
- </choose>
- <choose>
- <when test="vo.travelDate != null and vo.travelDate != ''">
- AND DATE_FORMAT(tdl.validity_start_date, '%Y-%m-%d') <![CDATA[ <= ]]> #{vo.travelDate}
- AND DATE_FORMAT(tdl.validity_end_date, '%Y-%m-%d') <![CDATA[ >= ]]> #{vo.travelDate}
- </when>
- <otherwise>
- and tdl.validity_start_date <![CDATA[ <= ]]> NOW()
- and tdl.validity_end_date <![CDATA[ >= ]]> NOW()
- </otherwise>
- </choose>
- <choose>
- <when test="vo.orderNo != null and vo.orderNo.length() == 4">
- AND td.order_no like concat('%',#{vo.orderNo})
- </when>
- <when test="vo.orderNo != null and vo.orderNo != ''">
- AND td.order_no = #{vo.orderNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <choose>
- <when test="vo.phone != null and vo.phone.length() == 4">
- AND tou.mobile like concat('%',#{vo.phone})
- </when>
- <when test="vo.phone != null and vo.phone != ''">
- AND tou.mobile = #{vo.phone}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <choose>
- <when test="vo.credentialNo != null and vo.credentialNo.length() == 4">
- AND tv.credential_no like concat('%',#{vo.credentialNo})
- </when>
- <when test="vo.credentialNo != null and vo.credentialNo != ''">
- AND tv.credential_no = #{vo.credentialNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.type != null and vo.dispatchId != null and vo.type == 'boat'">
- AND td.id in (SELECT DISTINCT order_id FROM dispatch_operate_plan_boat_order_detail_base
- WHERE plan_id = #{vo.dispatchId} and deleted = 0)
- </if>
- <if test="vo.type != null and vo.dispatchId != null and vo.type == 'car'">
- AND td.id in (SELECT DISTINCT order_id FROM dispatch_car_dispatch_order_detail_base
- WHERE car_dispatch_id = #{vo.dispatchId} and deleted = 0)
- </if>
- <if test="vo.voucherCode != null and vo.voucherCode != ''">
- AND tdl.voucher_code = #{vo.voucherCode}
- </if>
- <if test="vo.checkType != null and vo.checkType == 1">
- AND tdb.use_status in (1,2)
- </if>
- <if test="vo.checkType != null and vo.checkType == 2">
- AND tdb.use_status in (3,6,8)
- </if>
- <if test="vo.productName != null and vo.productName != ''">
- AND tdl.product_name like concat('%',#{vo.productName}, '%')
- </if>
- <if test="vo.sellMethod != null">
- AND td.sell_method = #{vo.sellMethod}
- </if>
- <if test="vo.planIds!=null and vo.planIds.size()>0 and vo.cateIds!=null and vo.cateIds.size()>0">
- AND (td.route_plan_id in
- <foreach collection="vo.planIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- or tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- )
- </if>
- <if test="vo.cateIds!=null and vo.cateIds.size()>0 and vo.planIds==null">
- AND tdl.product_id in
- <foreach collection="vo.cateIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- <if test="vo.planIds!=null and vo.planIds.size()>0 and (vo.cateIds==null or vo.cateIds.size()==0)">
- and td.route_plan_id in
- <foreach collection="vo.planIds" item="item" separator="," open="(" close=")">
- #{item}
- </foreach>
- </if>
- group by td.id
- ORDER BY td.create_time DESC
- </select>
- <select id="getOtaTradeOrderPage"
- resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeDetailRespVO">
- SELECT td.*,tor.order_no,pbr.check_start_date,pbr.check_end_date
- FROM trade_detail td
- LEFT JOIN product_basic_rule pbr on td.product_id = pbr.id
- LEFT JOIN trade_order tor on tor.id = td.order_id
- where 1= 1 AND
- EXISTS (select * from product_sale_channel sc where sc.product_id = td.product_id and sc.channel_id = 0)
- <if test="vo.productName != null and vo.productName != ''">
- AND td.product_name = #{vo.productName}
- </if>
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND tor.order_no = #{vo.orderNo}
- </if>
- <if test="vo.orderStatus != null and vo.orderStatus != ''">
- AND tor.order_status = #{vo.orderStatus}
- </if>
- <if test="vo.paymentDateStart != null">
- AND tor.payment_date <![CDATA[ >= ]]> #{vo.paymentDateStart}
- </if>
- <if test="vo.paymentDateEnd != null">
- AND tor.payment_date <![CDATA[ <= ]]> #{vo.paymentDateEnd}
- </if>
- <if test="vo.type == 1">
- AND tor.source_id = #{distributorId}
- </if>
- GROUP BY td.voucher_code
- ORDER BY td.create_time DESC
- </select>
- <select id="getSupplierOrderPage"
- resultType="com.yc.ship.module.trade.controller.admin.supplier.vo.SupplierOrderRespVO">
- SELECT ts.*,tr.order_no,tt.pay_amount payAmount
- FROM trade_supplier_order ts
- inner join trade_order tr on ts.order_id = tr.id
- left join trade_order tt on ts.supplier_order_no=tt.order_no
- where 1= 1 And ts.tenant_id = #{vo.tenantId}
- <choose>
- <when test="vo.orderNo != null and vo.orderNo.length() == 4">
- AND tr.order_no like concat('%',#{vo.orderNo})
- </when>
- <when test="vo.orderNo != null and vo.orderNo != ''">
- AND tr.order_no = #{vo.orderNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <choose>
- <when test="vo.tradeNo != null and vo.tradeNo.length() == 4">
- AND ts.trade_no like concat('%',#{vo.tradeNo})
- </when>
- <when test="vo.tradeNo != null and vo.tradeNo != ''">
- AND ts.trade_no = #{vo.tradeNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <choose>
- <when test="vo.supplierOrderNo != null and vo.supplierOrderNo.length() == 4">
- AND ts.supplier_order_no like concat('%',#{vo.supplierOrderNo})
- </when>
- <when test="vo.supplierOrderNo != null and vo.supplierOrderNo != ''">
- AND ts.supplier_order_no = #{vo.supplierOrderNo}
- </when>
- <otherwise>
- </otherwise>
- </choose>
- <if test="vo.supplierName != null and vo.supplierName != ''">
- AND ts.supplier_name like concat('%',#{vo.supplierName},'%')
- </if>
- <if test="vo.orderStatus != null and vo.orderStatus != ''">
- AND ts.order_status = #{vo.orderStatus}
- </if>
- <if test="vo.useDate != null and vo.useDate != ''">
- AND ts.use_date = #{vo.useDate}
- </if>
- <if test="vo.sourceId != null and vo.sourceId != ''">
- AND tr.source_id = #{vo.sourceId}
- </if>
- ORDER BY ts.create_time DESC
- </select>
- <select id="getSupplierRefundPage"
- resultType="com.yc.ship.module.trade.controller.admin.supplier.vo.SupplierRefundRespVO">
- SELECT ts.*,tr.order_no
- FROM trade_supplier_refund ts
- inner join trade_order tr on ts.order_id = tr.id
- where 1= 1
- <if test="vo.orderNo != null and vo.orderNo != ''">
- AND tr.order_no = #{vo.orderNo}
- </if>
- <if test="vo.supplierName != null and vo.supplierName != ''">
- AND ts.supplier_name = #{vo.supplierName}
- </if>
- <if test="vo.supplierOrderNo != null and vo.supplierOrderNo != ''">
- AND ts.supplier_order_no = #{vo.supplierOrderNo}
- </if>
- <if test="vo.refundStatus != null and vo.refundStatus != ''">
- AND ts.refund_status = #{vo.refundStatus}
- </if>
- order by ts.create_time desc
- </select>
- </mapper>
|