|
|
|
@@ -145,55 +145,22 @@ |
|
|
|
</select> |
|
|
|
|
|
|
|
<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 |
|
|
|
,(case when coupon_type < 7 then |
|
|
|
(select Count(coupon_id) from wx_coupon_order c |
|
|
|
where coupon_order_status=1 |
|
|
|
and DATE_FORMAT(update_date,'%Y-%m-%d')=createTime |
|
|
|
and tenant_id=#{tenantId} |
|
|
|
and c.coupon_id=couponId |
|
|
|
) 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 |
|
|
|
and d.coupon_id=couponId |
|
|
|
and DATE_FORMAT(update_date,'%Y-%m-%d')=createTime |
|
|
|
and tenant_id=#{tenantId} |
|
|
|
and d.coupon_id=couponId |
|
|
|
) 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 |
|
|
|
join wx_coupon on wx_coupon_order.coupon_id=wx_coupon.id |
|
|
|
where wx_coupon_order.tenant_id=#{tenantId} |
|
|
|
<if test="startTime != null"> |
|
|
|
and wx_coupon_order.create_date >= #{startTime} |
|
|
|
</if> |
|
|
|
<if test="endTime != null"> |
|
|
|
and wx_coupon_order.create_date <= #{endTime} |
|
|
|
</if> |
|
|
|
<if test="couponType != null"> |
|
|
|
and wx_coupon.type = #{couponType} |
|
|
|
</if> |
|
|
|
<if test="couponTitle != null"> |
|
|
|
and wx_coupon.title like concat('%', #{couponTitle},'%') |
|
|
|
</if> |
|
|
|
GROUP BY createTime,couponId,coupon_type |
|
|
|
order by createTime desc |
|
|
|
SELECT createTime,couponId,couponCount,couponUserCount,verifyCount,verifyUserCount |
|
|
|
from view_coupon_data |
|
|
|
where view_coupon_data.tenant_id=#{tenantId} |
|
|
|
<if test="startTime != null"> |
|
|
|
and view_coupon_data.createTime >= DATE_FORMAT(#{startTime},'%Y-%m-%d') |
|
|
|
</if> |
|
|
|
<if test="endTime != null"> |
|
|
|
and view_coupon_data.createTime <= DATE_FORMAT(#{endTime},'%Y-%m-%d') |
|
|
|
</if> |
|
|
|
<if test="couponType != null"> |
|
|
|
and view_coupon_data.couponType = #{couponType} |
|
|
|
</if> |
|
|
|
<if test="couponTitle != null"> |
|
|
|
and view_coupon_data.couponTitle like concat('%', #{couponTitle},'%') |
|
|
|
</if> |
|
|
|
|
|
|
|
</select> |
|
|
|
|
|
|
|
<select id="touchUsersReportList" resultType="com.iformall.domain.vo.TouchUsersReportVo" parameterType="hashmap"> |
|
|
|
|