select DATE_FORMAT(create_date,'%Y-%m-%d') AS xTime,COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id
select DATE_FORMAT(create_date,'%Y-%m-%d') AS xTime,COUNT(wx_coupon_order.id) as tempCount from wx_coupon_action_log left join wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id
where wx_coupon_action_log.tenant_id=#{tenantId}
where wx_coupon_action_log.tenant_id=#{tenantId}
and wx_coupon_order.coupon_order_status = 1
and wx_coupon_order.coupon_order_status = 1
<if test=" null != startTime ">
and wx_coupon_action_log.createtime >= #{startTime}
and wx_coupon_action_log.createtime >= #{startTime}
</if>
<if test=" null != endTime ">
and wx_coupon_action_log.createtime <= #{endTime}
and wx_coupon_action_log.createtime <= #{endTime}
and wx_coupon_action_log.channel_type = #{channelType} group by xTime
</if>
and wx_coupon_action_log.channel_type = #{channelType}
SELECT DATE_FORMAT(wx_coupon_order.create_date,'%Y-%m-%d') as createTime,wx_coupon_order.coupon_id as couponId
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
,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
,(select Count(coupon_id) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} and c.coupon_id=couponId AND c.update_date >= #{startTime} and c.update_date <= #{endTime}) as verifyCount
,(select Count(DISTINCT c_user_id) from wx_coupon_order d where coupon_order_status=1 AND d.coupon_id=couponId AND DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} and d.coupon_id=couponId AND d.update_date >= #{startTime} and d.update_date <= #{endTime}) 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} AND wx_coupon_order.create_date >= #{startTime} and wx_coupon_order.create_date <= #{endTime}
<if test="couponType != null">
AND wx_coupon.type = #{couponType}
</if>
GROUP BY createTime,couponId
,(select Count(coupon_id) from wx_coupon_order c
where coupon_order_status=1
and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime
and tenant_id=#{tenantId}
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
where coupon_order_status=1
and d.coupon_id=couponId
and DATE_FORMAT(create_date,'%Y-%m-%d')=createTime
and tenant_id=#{tenantId}
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
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}
SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime
SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime
,COUNT(DISTINCT c_user_id) as userCount,count(*) as couponCount
,COUNT(DISTINCT c_user_id) as userCount,count(*) as couponCount
,(select Count(*) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=xTime and tenant_id=#{tenantId}
,(select Count(*) from wx_coupon_order c
where coupon_order_status=1
and DATE_FORMAT(create_date,'%Y-%m-%d')=xTime
and tenant_id=#{tenantId}
<if test="startTime != null">
<if test="startTime != null">
AND c.update_date >= #{startTime}
and c.update_date >= #{startTime}
</if>
</if>
<if test="endTime != null">
<if test="endTime != null">
and c.update_date <= #{endTime}
and c.update_date <= #{endTime}
</if>
</if>
) as verifyCount
,(select Count(DISTINCT c_user_id) from wx_coupon_order d where coupon_order_status=1 AND DATE_FORMAT(create_date,'%Y-%m-%d')=xTime and tenant_id=#{tenantId} AND d.update_date >= #{startTime} and d.update_date <= #{endTime}) as verifyUserCount
from wx_coupon_order where tenant_id=#{tenantId}
)
as verifyCount
,(select Count(DISTINCT c_user_id) from wx_coupon_order d