| @@ -145,33 +145,38 @@ | |||||
| </select> | </select> | ||||
| <select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | <select id="couponDataList" resultType="com.iformall.domain.vo.MarkingCouponDataReportVo" parameterType="hashmap"> | ||||
| SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime,wx_coupon_order.coupon_id as couponId | |||||
| ,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount | |||||
| ,(select Count(coupon_id) from wx_coupon_order c | |||||
| SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime, | |||||
| wx_coupon_order.coupon_id as couponId | |||||
| ,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount | |||||
| ,(case when coupon_type < 7 then | |||||
| (select Count(coupon_id) from wx_coupon_order c | |||||
| where coupon_order_status=1 | where coupon_order_status=1 | ||||
| and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime | |||||
| and DATE_FORMAT(update_date,'%Y-%m-%d')=createTime | |||||
| and tenant_id=#{tenantId} | and tenant_id=#{tenantId} | ||||
| and c.coupon_id=couponId | and c.coupon_id=couponId | ||||
| <if test="startTime != null"> | |||||
| and c.update_date >= #{startTime} | |||||
| </if> | |||||
| <if test="endTime != null"> | |||||
| and c.update_date <= #{endTime} | |||||
| </if> | |||||
| ) as verifyCount | |||||
| ,(select Count(DISTINCT c_user_id) from wx_coupon_order d | |||||
| ) else | |||||
| (select Count(card_id) from wx_coupon_order c, wx_card_spend cs | |||||
| where DATE_FORMAT(cs.create_date,'%Y-%m-%d')=createTime | |||||
| and c.tenant_id=#{tenantId} | |||||
| and c.coupon_id=couponId | |||||
| and c.id=cs.card_id | |||||
| ) end) | |||||
| as verifyCount | |||||
| ,(case when coupon_type < 7 then | |||||
| (select Count(DISTINCT c_user_id) from wx_coupon_order d | |||||
| where coupon_order_status=1 | where coupon_order_status=1 | ||||
| and d.coupon_id=couponId | and d.coupon_id=couponId | ||||
| and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime | |||||
| and DATE_FORMAT(update_date,'%Y-%m-%d')=createTime | |||||
| and tenant_id=#{tenantId} | and tenant_id=#{tenantId} | ||||
| and d.coupon_id=couponId | and d.coupon_id=couponId | ||||
| <if test="startTime != null"> | |||||
| and d.update_date >= #{startTime} | |||||
| </if> | |||||
| <if test="endTime != null"> | |||||
| and d.update_date <= #{endTime} | |||||
| </if> | |||||
| ) as verifyUserCount | |||||
| ) else | |||||
| (select Count(DISTINCT cs.owner_id) from wx_coupon_order c, wx_card_spend cs | |||||
| where DATE_FORMAT(cs.create_date,'%Y-%m-%d')=createTime | |||||
| and c.tenant_id=#{tenantId} | |||||
| and c.coupon_id=couponId | |||||
| and c.id=cs.card_id | |||||
| ) end) | |||||
| as verifyUserCount | |||||
| from wx_coupon_order | from wx_coupon_order | ||||
| join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id | join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id | ||||
| where wx_coupon_order.tenant_id=#{tenantId} | where wx_coupon_order.tenant_id=#{tenantId} | ||||
| @@ -187,7 +192,7 @@ | |||||
| <if test="couponTitle != null"> | <if test="couponTitle != null"> | ||||
| and wx_coupon.title like concat('%', #{couponTitle},'%') | and wx_coupon.title like concat('%', #{couponTitle},'%') | ||||
| </if> | </if> | ||||
| GROUP BY createTime,couponId | |||||
| GROUP BY createTime,couponId,coupon_type | |||||
| order by createTime desc | order by createTime desc | ||||
| </select> | </select> | ||||