`id`,`tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `coupon_id` = #{couponId}
and `coupon_order_id` = #{couponOrderId}
and `channel_type` = #{channelType}
and `channel_id` = #{channelId}
and `create_time` = #{createTime}
and `create_time` >= #{startTime}
and `create_time` <= #{endTime}
and id in
#{idItem}
order by ${sortColumns}
select from wx_coupon_action_log
select DATE_FORMAT(create_time,'%m/%d') as xTime,
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=2
and tenant_id=#{tenantId} ) as parkSendCount,
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=3
and tenant_id=#{tenantId}) as verifySendCount,
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=4
and tenant_id=#{tenantId}) as microPaySendCount,
(select Count(*) from wx_coupon_action_log c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=5
and tenant_id=#{tenantId}) as orderSendCount
from wx_coupon_action_log
where tenant_id=#{tenantId}
and channel_type in (2,3,4,5)
and create_time >= #{startTime}
and create_time <= #{endTime}
group by xTime
order by xTime desc
select DATE_FORMAT(create_date,'%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}
----- and wx_coupon_order.coupon_order_status = 1 ----
and wx_coupon_action_log.create_time >= #{startTime}
and wx_coupon_action_log.create_time <= #{endTime}
and wx_coupon_action_log.channel_type = #{channelType}
group by xTime
order by xTime desc
select DATE_FORMAT(create_time,'%Y-%m-%d') as xTime,
Count(*) as sendCount
from wx_coupon_action_log
where tenant_id=#{tenantId}
and channel_type=#{channelType}
and create_time >= #{startTime}
and create_time <= #{endTime}
group by xTime
order by ${sortColumns}
order by xTime desc
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}
and wx_coupon_order.coupon_order_status = 1
and wx_coupon_action_log.create_time >= #{startTime}
and wx_coupon_action_log.create_time <= #{endTime}
and wx_coupon_action_log.channel_type = #{channelType}
group by xTime
order by xTime desc
select COUNT(*) FROM wx_coupon_action_log
where tenant_id = #{tenantId}
and `channel_type` != 0
and `channel_type` != 1
and `create_time` >= #{startTime}
and `create_time` <= #{endTime}
select COUNT(*) FROM wx_coupon_action_log
where tenant_id = #{tenantId}
and channel_type = #{channelType}
and channel_id = #{channelId}
select COUNT(*)
FROM wx_coupon_action_log a, wx_coupon_order o
WHERE a.coupon_order_id = o.id
AND a.tenant_id = #{tenantId}
AND o.c_user_id = #{cUserId}
AND date(a.create_time) = curdate()
select COUNT(*)
FROM wx_coupon_action_log a, wx_coupon_order o
WHERE a.coupon_order_id = o.id
AND a.tenant_id = #{tenantId}
AND o.c_user_id = #{cUserId}
AND a.coupon_id = #{couponId}
AND date(a.create_time) between date_sub(curdate(),interval #{dayNum} day) and curdate()
select COUNT(*)
FROM wx_coupon_action_log a, wx_coupon_order o
WHERE a.coupon_order_id = o.id
AND a.tenant_id = #{tenantId}
AND o.c_user_id = #{cUserId}
AND a.coupon_id = #{couponId}
AND a.channel_type = #{channelType}
and a.create_time >= #{startTime}
and a.create_time <= #{endTime}