|
|
@@ -624,54 +624,68 @@ |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
<select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap"> |
|
|
<select id="findPressData" parameterType="com.iformall.domain.po.WxCoupon" resultMap="statisMap"> |
|
|
select c.*, |
|
|
|
|
|
IFNULL(round((select count(wo.id) from wx_coupon wc |
|
|
|
|
|
left join wx_order wo on wo.product_id = wc.id |
|
|
|
|
|
where wo.order_status = 1 and wc.id = c.id)/(select count(wop.id) from wx_coupon wc |
|
|
|
|
|
left join wx_order wo on wo.product_id = wc.id |
|
|
|
|
|
left join wx_order_press wop on wop.order_id = wo.id |
|
|
|
|
|
where wop.first = 1 and wc.id = c.id)*100,2),0) change_rate |
|
|
|
|
|
|
|
|
|
|
|
,(select count(wop.id) from wx_coupon wc |
|
|
|
|
|
left join wx_order wo on wo.product_id = wc.id |
|
|
|
|
|
left join wx_order_press wop on wop.order_id = wo.id |
|
|
|
|
|
where wop.first = 1 and wc.id = c.id) as press_count, |
|
|
|
|
|
|
|
|
|
|
|
(select count(wo.id) from wx_coupon wc |
|
|
|
|
|
left join wx_order wo on wo.product_id = wc.id |
|
|
|
|
|
where wo.order_status = 1 and wc.id = c.id) as press_succ_count, |
|
|
|
|
|
|
|
|
|
|
|
(select count(wop.id) from wx_coupon wc |
|
|
|
|
|
left join wx_order wo on wo.product_id = wc.id |
|
|
|
|
|
left join wx_order_press wop on wop.order_id = wo.id |
|
|
|
|
|
where wc.id = c.id) as join_count, |
|
|
|
|
|
|
|
|
|
|
|
round( |
|
|
|
|
|
(select count(wco.id) xcount from wx_coupon wc |
|
|
|
|
|
left join wx_coupon_order wco on wco.coupon_id = wc.id |
|
|
|
|
|
where wc.type = 8 and wco.coupon_order_status = 1 |
|
|
|
|
|
and wc.id = c.id) |
|
|
|
|
|
/ |
|
|
|
|
|
(select count(wop.id) from wx_coupon wc |
|
|
|
|
|
left join wx_order wo on wo.product_id = wc.id |
|
|
|
|
|
left join wx_order_press wop on wop.order_id = wo.id |
|
|
|
|
|
where wop.first = 1 and wc.id = c.id) |
|
|
|
|
|
*100,2) as payment_rate |
|
|
|
|
|
|
|
|
|
|
|
from wx_coupon c where c.type = 8 |
|
|
|
|
|
<if test="tenantId != null"> |
|
|
|
|
|
and c.tenant_id=#{tenantId} |
|
|
|
|
|
|
|
|
select cpd.id, cpd.`cover_img`,cpd.`title`,cpd.`sale_price`,cpd.`price`, |
|
|
|
|
|
cpd.change_rate, cpd.press_count, cpd.press_succ_count, cpd.join_count, cpd.payment_rate |
|
|
|
|
|
from wx_coupon_press_data cpd |
|
|
|
|
|
left join wx_coupon c on c.id = cpd.id |
|
|
|
|
|
<if test="id != null"> |
|
|
|
|
|
and cpd.tenant_id=#{tenantId} |
|
|
</if> |
|
|
</if> |
|
|
<if test="id != null"> |
|
|
<if test="id != null"> |
|
|
and c.id = #{id} |
|
|
|
|
|
|
|
|
and cpd.id = #{id} |
|
|
</if> |
|
|
</if> |
|
|
<if test="title != null and title != ''"> |
|
|
<if test="title != null and title != ''"> |
|
|
and c.title like concat('%', #{title},'%') |
|
|
|
|
|
|
|
|
and cpd.title like concat('%', #{title},'%') |
|
|
</if> |
|
|
</if> |
|
|
<if test=" null != sortColumns"> order by ${sortColumns} </if> |
|
|
<if test=" null != sortColumns"> order by ${sortColumns} </if> |
|
|
<if test=" null == sortColumns"> order by c.status asc,c.create_date desc </if> |
|
|
<if test=" null == sortColumns"> order by c.status asc,c.create_date desc </if> |
|
|
</select> |
|
|
</select> |
|
|
|
|
|
|
|
|
|
|
|
<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 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 |
|
|
select DATE_FORMAT(wco.create_date,'%Y-%m-%d') xtime,count(wco.id) xcount from wx_coupon c |
|
|
left join wx_coupon_order wco on c.id = wco.coupon_id |
|
|
left join wx_coupon_order wco on c.id = wco.coupon_id |
|
|
|