Browse Source

[卡券][修复]:优化拼团统计数据

release_toaliyun_real
hupeng 6 years ago
parent
commit
7d2374b923
2 changed files with 19 additions and 16 deletions
  1. +1
    -1
      mallinkService/src/main/resources/mapper/WxCouponMapper.xml
  2. +18
    -15
      mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml

+ 1
- 1
mallinkService/src/main/resources/mapper/WxCouponMapper.xml View File

@@ -662,7 +662,7 @@
FROM wx_coupon c
left join (SELECT count(id) as press_count, coupon_id FROM wx_order_press WHERE `tenant_id` = #{tenantId} AND `first` = 1 group by coupon_id) op on op.coupon_id = c.id
left join (SELECT count(id) as press_succ_count, product_id FROM wx_order WHERE `tenant_id` = #{tenantId} AND order_status = 1 group by product_id) o on o.product_id = c.id
left join (SELECT count(id) as join_count, coupon_id FROM wx_order_press op WHERE `tenant_id` = #{tenantId} group by coupon_id) op2 on op2.coupon_id = c.id
left join (SELECT count(id) as join_count, coupon_id FROM wx_order_press WHERE `tenant_id` = #{tenantId} group by coupon_id) op2 on op2.coupon_id = c.id
left join (SELECT count(id) as xCount, coupon_id FROM wx_coupon_order WHERE `tenant_id` = #{tenantId} AND coupon_order_status = 1 group by coupon_id) cop on cop.coupon_id = c.id
where c.type = 8
<if test="tenantId != null">


+ 18
- 15
mallinkService/src/main/resources/mapper/WxOrderGroupMapper.xml View File

@@ -91,20 +91,23 @@
<select id="queryOrderGroupMarketingList" parameterType="com.iformall.domain.vo.WxOrderGroupMarketing"
resultType="com.iformall.domain.vo.WxOrderGroupMarketing">
select c.tenant_id,coupon_id,c.cover_img,title,c.price,c.sale_price,c.group_total_count,c.group_success_count,
ROUND(IFNULL((c.group_success_count/c.group_total_count),0)*100)
group_transfer_ratio,c.success_people,c.verify_count,
ROUND(IFNULL((verify_count/success_people),0)*100) verify_ratio,c.total_people from(
select tenant_id,id coupon_id,cover_img,title,ROUND(price/100,2) price,ROUND(sale_price/100,2) sale_price,
(select count(*) total from wx_order_group where coupon_id=c.id) group_total_count,
(select count(*) total from wx_order_group where status=11 and coupon_id=c.id) group_success_count,
IFNULL((select count(*) from wx_order where order_status=11 and product_id=c.id),0) success_people,
(select count(*) total
from wx_coupon_order where coupon_type=9 and coupon_order_status=1 and coupon_id=c.id) verify_count,
IFNULL((select count(*) from wx_order where order_group_id!=0 and product_id=c.id),0) total_people
from wx_coupon c where type=9 order by c.status,c.id desc
) c
<where>
SELECT c.tenant_id, c.id, c.cover_img, c.title,
IFNULL(og.group_total_count,0) as group_total_count,
IFNULL(og2.group_success_count,0) as group_success_count,
IFNULL(o.success_people,0) as success_people,
IFNULL(co.verify_count,0) as verify_count,
IFNULL(o2.total_people,0) as total_people,
ROUND(IFNULL((og2.group_success_count / og.group_total_count), 0) * 100) group_transfer_ratio,
ROUND(IFNULL((co.verify_count / o.success_people), 0) * 100) verify_ratio,
ROUND(c.price / 100, 2) price,
ROUND(c.sale_price / 100, 2) sale_price
FROM wx_coupon c
left join (SELECT count(*) group_total_count, coupon_id FROM wx_order_group group by coupon_id) og on og.coupon_id = c.id
left join (SELECT count(*) group_success_count, coupon_id FROM wx_order_group WHERE status = 11 group by coupon_id) og2 on og2.coupon_id = c.id
left join (SELECT count(*) success_people, product_id FROM wx_order WHERE order_status = 11 group by product_id ) o on o.product_id = c.id
left join (SELECT count(*) verify_count, coupon_id FROM wx_coupon_order WHERE coupon_type = 9 AND coupon_order_status = 1 group by coupon_id ) co on co.coupon_id = c.id
left join (SELECT count(*) total_people, product_id FROM wx_order WHERE order_group_id != 0 group by product_id ) o2 on o2.product_id = c.id
WHERE type = 9
<if test=" null != tenantId">
and c.tenant_id=#{tenantId}
</if>
@@ -114,8 +117,8 @@
<if test=" null != title and ''!=title">
and c.title like concat('%',#{title},'%')
</if>
</where>
<if test=" null != sortColumns"> order by ${sortColumns} </if>
<if test=" null == sortColumns">order by c.status asc,c.create_date desc</if>
</select>
<select id="queryOrderGroupSuccessCountAndTime" parameterType="hashmap" resultType="hashmap">


Loading…
Cancel
Save