|
|
|
@@ -320,21 +320,36 @@ |
|
|
|
</collection> |
|
|
|
</resultMap> |
|
|
|
|
|
|
|
<sql id="allAdminCouponOrderColumns"> |
|
|
|
<sql id="allAdminCouponOrderListColumns"> |
|
|
|
co.id,co.tenant_id,co.coupon_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, |
|
|
|
c.title,c.sale_price,c.use_price,c.price,c.unit, |
|
|
|
m.name as merchant_name |
|
|
|
</sql> |
|
|
|
|
|
|
|
<sql id="allAdminCouponOrderDetailColumns"> |
|
|
|
co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, |
|
|
|
c.type,c.title,c.sale_price,c.use_price,c.price,c.unit, |
|
|
|
bu.name, bu.phone as bphone, cu.phone, m.name as merchant_name |
|
|
|
bu.name, bu.phone as bphone, |
|
|
|
cu.phone, |
|
|
|
m.name as merchant_name |
|
|
|
</sql> |
|
|
|
|
|
|
|
<select id="findListOfAdmin" parameterType="com.iformall.domain.vo.WxCouponOrderBVo" resultMap="BVoResultMap"> |
|
|
|
select <include refid="allAdminCouponOrderColumns" /> |
|
|
|
from wx_coupon_order co |
|
|
|
inner JOIN wx_coupon c on c.id = co.coupon_id |
|
|
|
inner JOIN wx_c_user cu on cu.id = co.c_user_id |
|
|
|
left JOIN wx_merchant_b_user bu on bu.id = co.b_user_id |
|
|
|
left JOIN wx_merchant m on m.id = bu.merchant_id |
|
|
|
where 1 = 1 |
|
|
|
|
|
|
|
select <include refid="allAdminCouponOrderListColumns" /> |
|
|
|
from wx_coupon_merchant cm, |
|
|
|
(select tco.id as tcoid, |
|
|
|
(select count(*) from wx_coupon_merchant tcm |
|
|
|
where tcm.product_id = tco.coupon_id) as mc |
|
|
|
from wx_coupon_order tco) com, |
|
|
|
wx_coupon c, |
|
|
|
wx_merchant m, |
|
|
|
wx_coupon_order co |
|
|
|
where com.mc = 1 |
|
|
|
and com.tcoid = co.id |
|
|
|
and cm.product_id = c.id |
|
|
|
and cm.status = 0 |
|
|
|
and c.id = co.coupon_id |
|
|
|
and m.id = cm.merchant_id |
|
|
|
<if test=" null != tenantId "> |
|
|
|
and co.tenant_id = #{tenantId} |
|
|
|
</if> |
|
|
|
@@ -360,6 +375,28 @@ |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="findDetailOfAdmin" parameterType="java.lang.Long" resultMap="BVoResultMap"> |
|
|
|
select <include refid="allAdminCouponOrderDetailColumns" /> |
|
|
|
from wx_coupon_merchant cm, |
|
|
|
(select tco.id as tcoid, |
|
|
|
(select count(*) from wx_coupon_merchant tcm |
|
|
|
where tcm.product_id = tco.coupon_id) as mc |
|
|
|
from wx_coupon_order tco) com, |
|
|
|
wx_coupon c, |
|
|
|
wx_c_user cu, |
|
|
|
wx_merchant m, |
|
|
|
wx_coupon_order co |
|
|
|
left join wx_merchant_b_user bu on co.b_user_id = bu.id |
|
|
|
where co.id = #{id} |
|
|
|
and com.mc = 1 |
|
|
|
and com.tcoid = co.id |
|
|
|
and cm.product_id = c.id |
|
|
|
and cm.status = 0 |
|
|
|
and c.id = co.coupon_id |
|
|
|
and cu.id = co.c_user_id |
|
|
|
and m.id = cm.merchant_id |
|
|
|
</select> |
|
|
|
|
|
|
|
<sql id="allBUserVerifiedCouponOrderColumns"> |
|
|
|
co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price, |
|
|
|
c.type,c.title,c.sale_price,c.use_price,c.price,c.unit, |
|
|
|
@@ -376,14 +413,13 @@ |
|
|
|
|
|
|
|
<select id="findListOfOrderedByDateForBUser" parameterType="map" resultMap="BVoResultMap"> |
|
|
|
select <include refid="allBUserOrderedCouponOrderColumns" /> |
|
|
|
from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu,wx_coupon_merchant cm, |
|
|
|
from wx_coupon_order co,wx_coupon c,wx_c_user cu,wx_coupon_merchant cm, |
|
|
|
(select tco.id as tcoid, |
|
|
|
(select count(*) from wx_coupon_merchant tcm |
|
|
|
where tcm.product_id = tco.coupon_id) as mc |
|
|
|
from wx_coupon_order tco) com |
|
|
|
where com.mc = 1 |
|
|
|
and com.tcoid = co.id |
|
|
|
and o.id = co.order_id |
|
|
|
and cm.merchant_id = #{merchantId} |
|
|
|
and cm.product_id = c.id |
|
|
|
and cm.status = 0 |
|
|
|
@@ -401,9 +437,8 @@ |
|
|
|
|
|
|
|
<select id="findListOfVerifiedByDateForBUser" parameterType="map" resultMap="BVoResultMap"> |
|
|
|
select <include refid="allBUserVerifiedCouponOrderColumns" /> |
|
|
|
from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu,wx_merchant_b_user bu |
|
|
|
where o.id = co.order_id |
|
|
|
and co.coupon_id = c.id |
|
|
|
from wx_coupon_order co,wx_coupon c,wx_c_user cu,wx_merchant_b_user bu |
|
|
|
where co.coupon_id = c.id |
|
|
|
and cu.id = co.c_user_id |
|
|
|
and bu.id = co.b_user_id |
|
|
|
and bu.merchant_id = #{merchantId} |
|
|
|
@@ -518,7 +553,7 @@ |
|
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<select id="findDetail" parameterType="java.lang.Long" resultMap="CVoResultMap"> |
|
|
|
<select id="findDetailOfCUser" parameterType="java.lang.Long" resultMap="CVoResultMap"> |
|
|
|
select <include refid="allCUserCouponOrderDetailColumns" /> |
|
|
|
from wx_coupon_order co,wx_coupon c |
|
|
|
where co.coupon_id = c.id |
|
|
|
|