Commit 608d583b by huluobin

update

parent c490f689
...@@ -5,33 +5,27 @@ ...@@ -5,33 +5,27 @@
<select id="getByOrderId" resultType="com.gogirl.domain.market.coupon.CouponsForConsumption"> <select id="getByOrderId" resultType="com.gogirl.domain.market.coupon.CouponsForConsumption">
SELECT t2.* SELECT t2.*
from order_manage t1 from order_manage t1
LEFT JOIN coupons_for_consumption t2 on t2.order_amount_type = 1 LEFT JOIN coupons_for_consumption t2 on t2.order_amount_type = 1 and t2.is_delete = 0
and t1.total_price &lt;= t2.order_amount_up and t1.total_price &lt;= t2.order_amount_up
and t1.total_price &gt;= t2.order_amount_down and t1.total_price &gt;= t2.order_amount_down
<if test="t2.order_serve_type != null"> LEFT JOIN order_serve t3 on t1.id = t3.order_id and (t2.order_serve_type = t3.serve_type_id or
LEFT JOIN order_serve t3 on t1.id = t3.order_id and t2.order_serve_type = t3.serve_type_id t2.order_serve_type is null)
</if>
where t1.id = #{orderId} where t1.id = #{orderId}
and t2.id is not null and t2.id is not null
and t1.department_id = t2.store_id and t1.department_id = t2.store_id
<if test="t2.order_serve_type != null">
and t3.id is not null and t3.id is not null
</if>
union union
SELECT t2.* SELECT t2.*
from order_manage t1 from order_manage t1
LEFT JOIN coupons_for_consumption t2 on t2.order_amount_type = 2 LEFT JOIN coupons_for_consumption t2 on t2.order_amount_type = 2 and t2.is_delete = 0
and t1.total_payment_amount &lt;= t2.order_amount_up and t1.total_payment_amount &lt;= t2.order_amount_up
and t1.total_payment_amount &gt;= t2.order_amount_down and t1.total_payment_amount &gt;= t2.order_amount_down
and t1.department_id = t2.store_id and t1.department_id = t2.store_id
<if test="t2.order_serve_type != null"> LEFT JOIN order_serve t3 on t1.id = t3.order_id and (t2.order_serve_type = t3.serve_type_id or
LEFT JOIN order_serve t3 on t1.id = t3.order_id and t2.order_serve_type = t3.serve_type_id t2.order_serve_type is null)
</if>
where t1.id = #{orderId} where t1.id = #{orderId}
and t2.id is not null and t2.id is not null
<if test="t2.order_serve_type != null">
and t3.id is not null and t3.id is not null
</if>
and t1.department_id = t2.store_id and t1.department_id = t2.store_id
order by orders order by orders
limit 1 limit 1
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment