|
|
|
@@ -685,62 +685,6 @@ |
|
|
|
<if test=" null == sortColumns">order by c.status asc,c.create_date desc</if> |
|
|
|
</select> |
|
|
|
|
|
|
|
<insert id="delPressData" parameterType="com.iformall.domain.po.WxCoupon"> |
|
|
|
delete from `wx_coupon_press_data` where tenant_id = #{tenantId} |
|
|
|
</insert> |
|
|
|
|
|
|
|
<insert id="insertPressData" parameterType="com.iformall.domain.po.WxCoupon"> |
|
|
|
insert into `wx_coupon_press_data` |
|
|
|
(`id`, `tenant_id`, `cover_img`, `title`, `sale_price`, `price`) |
|
|
|
select `id`, `tenant_id`, `cover_img`, `title`, `sale_price`, `price` |
|
|
|
from wx_coupon where type = 8 and tenant_id = #{tenantId} |
|
|
|
</insert> |
|
|
|
|
|
|
|
<update id="updatePressData1" parameterType="com.iformall.domain.po.WxCoupon"> |
|
|
|
update wx_coupon_press_data cpd set change_rate = |
|
|
|
IFNULL(round((select count(o.id) from wx_order o |
|
|
|
where o.tenant_id = #{tenantId} and o.order_status = 1 and o.product_id = cpd.id)/ |
|
|
|
(select count(wop.id) from wx_order o |
|
|
|
left join wx_order_press wop on wop.order_id = o.id |
|
|
|
where o.product_id = cpd.id and o.tenant_id = #{tenantId} and wop.first = 1)*100,2),0) |
|
|
|
where cpd.tenant_id = #{tenantId} |
|
|
|
</update> |
|
|
|
|
|
|
|
<update id="updatePressData2" parameterType="com.iformall.domain.po.WxCoupon"> |
|
|
|
update wx_coupon_press_data cpd set press_count= (select count(wop.id) from wx_order o |
|
|
|
left join wx_order_press wop on wop.order_id = o.id |
|
|
|
where o.product_id = cpd.id and o.tenant_id = #{tenantId} and wop.first = 1) |
|
|
|
where cpd.tenant_id=#{tenantId} |
|
|
|
</update> |
|
|
|
|
|
|
|
<update id="updatePressData3" parameterType="com.iformall.domain.po.WxCoupon"> |
|
|
|
update wx_coupon_press_data cpd set |
|
|
|
press_succ_count = |
|
|
|
(select count(o.id) from wx_order o |
|
|
|
where o.product_id = cpd.id and o.tenant_id = #{tenantId} and o.order_status = 1) |
|
|
|
where cpd.tenant_id=#{tenantId} |
|
|
|
</update> |
|
|
|
|
|
|
|
<update id="updatePressData4" parameterType="com.iformall.domain.po.WxCoupon"> |
|
|
|
update wx_coupon_press_data cpd set join_count = |
|
|
|
(select count(wop.id) from wx_order o |
|
|
|
left join wx_order_press wop on wop.order_id = o.id |
|
|
|
where o.tenant_id = #{tenantId} and o.product_id = cpd.id and o.payment_type = 0) |
|
|
|
where cpd.tenant_id=#{tenantId} |
|
|
|
</update> |
|
|
|
|
|
|
|
<select id="updatePressData5" parameterType="com.iformall.domain.po.WxCoupon"> |
|
|
|
update wx_coupon_press_data cpd set payment_rate = round( |
|
|
|
(select count(wco.id) xcount from wx_coupon_order wco |
|
|
|
where wco.tenant_id = #{tenantId} and wco.coupon_id = cpd.id and wco.coupon_order_status = 1) |
|
|
|
/ |
|
|
|
(select count(wop.id) from wx_order o |
|
|
|
left join wx_order_press wop on wop.order_id = o.id |
|
|
|
where o.tenant_id = #{tenantId} and o.product_id = cpd.id and wop.first = 1 ) |
|
|
|
*100,2) |
|
|
|
where cpd.tenant_id=#{tenantId} |
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="findCouponOrderCount" parameterType="com.iformall.domain.po.WxCoupon" |
|
|
|
resultType="com.iformall.domain.vo.WxCouponStatisVo"> |
|
|
|
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c |
|
|
|
|