|
|
@@ -191,7 +191,7 @@
|
|
|
|
|
|
<select id="getTradeOrderUserPage"
|
|
|
resultType="com.yc.ship.module.trade.controller.admin.order.vo.order.TradeOrderRespVO">
|
|
|
- SELECT td.*,su.nickname auditUserName,toa.audit_time auditTime,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
|
|
|
+ SELECT td.*,toa.audit_time auditTime,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
|
|
|
@@ -200,7 +200,6 @@
|
|
|
left JOIN product_spu ps on ps.id = tdl.product_id
|
|
|
LEFT JOIN ota_distributor od on od.id = td.source_id
|
|
|
LEFT JOIN trade_order_audit toa on toa.order_id = td.id and toa.audit_status = 1
|
|
|
- left join system_users su on toa.audit_user = su.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 td.deleted = 0 and tou.deleted = 0
|
|
|
<if test="vo.orderStatus!=null and vo.orderStatus.size()>0">
|
|
|
@@ -537,444 +536,6 @@
|
|
|
|
|
|
</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">
|
|
|
@@ -1018,47 +579,6 @@
|
|
|
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">
|
|
|
@@ -1221,23 +741,6 @@
|
|
|
</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,
|
|
|
@@ -1643,9 +1146,6 @@
|
|
|
<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="getLastOrderByOrderNo" resultType="com.yc.ship.module.trade.dal.dataobject.order.TradeOrderDO">
|
|
|
- select t1.* from trade_order where order_no=#{orderNo} and delete=1 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
|
|
|
@@ -2088,15 +1588,6 @@
|
|
|
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.*
|
|
|
@@ -2128,23 +1619,6 @@
|
|
|
</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
|
|
|
@@ -2200,17 +1674,6 @@
|
|
|
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
|
|
|
@@ -2389,78 +1852,7 @@
|
|
|
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>
|
|
|
|
|
|
<select id="regionStatic" resultType="java.util.Map">
|
|
|
select t4.id,t4.`name`,t6.province,t6.city,count(DISTINCT t3.id) num from trade_order t1 inner join trade_detail t2 on t1.id = t2.order_id
|
|
|
@@ -2503,4 +1895,177 @@
|
|
|
GROUP BY t2.room_model_id, t2.floor, t2.type
|
|
|
ORDER BY floor desc
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="getOrderCount" resultType="java.util.Map">
|
|
|
+ select GROUP_CONCAT(num,'*',name) name,sum(num1) num1,sum(num2) num2,sum(num3) num3,sum(num4) num4 from (
|
|
|
+ SELECT sum(CASE WHEN tv.type='adultPlus' or tv.type='adultTake' THEN 1 ELSE 0 END) num1,
|
|
|
+ sum(CASE WHEN tv.type='babyTake' or tv.type='babyPlus' or tv.type='babyNonTake' or tv.type='childTake' or tv.type='childPlus' or tv.type='childNonTake' THEN 1 ELSE 0 END) num2,
|
|
|
+ sum(CASE WHEN tv.type='with' THEN 1 ELSE 0 END) num3,
|
|
|
+ sum(CASE WHEN tv.type='leader' THEN 1 ELSE 0 END) num4,
|
|
|
+ CONCAT(rrm.short_name,'(',tv.floor,'F)') name ,count(1) num
|
|
|
+ FROM trade_order td
|
|
|
+ INNER JOIN trade_order_user tou on td.id = tou.order_id
|
|
|
+ left JOIN trade_detail tdl on td.id = tdl.order_id and tdl.deleted = 0
|
|
|
+ left join trade_visitor tv on tdl.id = tv.detail_id
|
|
|
+ left JOIN product_spu ps on ps.id = tdl.product_id
|
|
|
+ LEFT JOIN ota_distributor od on od.id = td.source_id
|
|
|
+ left join trade_order_room_model tm on tv.room_index_id = tm.room_index_id and tm.deleted =0
|
|
|
+ left join resource_room_model rrm on tm.room_model_id = rrm.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 td.deleted = 0 and tou.deleted = 0 and td.order_status >0 and tv.type is not null
|
|
|
+ <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.voyageId != null and vo.voyageId != ''">
|
|
|
+ AND td.voyage_id = #{vo.voyageId}
|
|
|
+ </if>
|
|
|
+ <if test="vo.shipId != null and vo.shipId != ''">
|
|
|
+ AND td.ship_id = #{vo.shipId}
|
|
|
+ </if>
|
|
|
+ <if test="vo.routeId != null and vo.routeId != ''">
|
|
|
+ AND exists (select 1 from product_voyage top where top.id = td.voyage_id and top.route_id = #{vo.routeId})
|
|
|
+ </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.distributorId != null and vo.distributorId != ''">
|
|
|
+ AND td.source_id = #{vo.distributorId}
|
|
|
+ </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 rrm.short_name,tv.floor
|
|
|
+ ) p
|
|
|
+ </select>
|
|
|
</mapper>
|