`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_order_id`,`channel_type`,`channel_id`,`create_time`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
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 where id = #{id} and tenant_id = #{tenantId}
delete from wx_coupon_action_log where id = #{id} and tenant_id = #{tenantId}
select
from wx_coupon_action_log
select DATE_FORMAT(create_time,'%m/%d') as xTime,
(select Count(*) from (
SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix}
) c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=2
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
) as parkSendCount,
(select Count(*) from (
SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix}
) c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=3
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
) as verifySendCount,
(select Count(*) from (
SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix}
) c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=4
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
) as microPaySendCount,
(select Count(*) from (
SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix}
) c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=5
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
) as orderSendCount,
(select Count(*) from (
SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix}
) c
where DATE_FORMAT(create_time,'%m/%d')=xTime
and c.channel_type=7
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
) as merchantSendCount
from (
SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix}
) wx_coupon_action_log
where channel_type in (2,3,4,5,7)
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and create_time >= #{startTime}
and create_time <= #{endTime}
group by xTime
order by xTime desc
select create_time_md as xTime, channel_type, count(create_time_md + '' + channel_type) as count
from wx_coupon_action_log
where channel_type in (2,3,4,5,7)
and `tenant_id` = #{tenantId}
and create_time >= #{startTime}
and create_time <= #{endTime}
group by create_time_md, channel_type
order by create_time_md desc
update wx_coupon_action_log
set create_time_md = DATE_FORMAT(create_time,'%m/%d')
where `tenant_id` = #{tenantId}
select DATE_FORMAT(create_time,'%m/%d') AS xTime,
COUNT(wx_coupon_order.id) as tempCount
from (
SELECT * from wx_coupon_action_log${tenantEntity.shardTableSuffix}
) wx_coupon_action_log
left join (
SELECT * from wx_coupon_order${tenantEntity.shardTableSuffix}
) wx_coupon_order on wx_coupon_action_log.coupon_order_id=wx_coupon_order.id
where 1=1
and wx_coupon_action_log.`tenant_id` = #{tenantId}
and wx_coupon_action_log.`parent_tenant_id` = #{parentTenantId}
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 channel_type=#{channelType}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and create_time >= #{startTime}
and create_time <= #{endTime}
group by xtime
order by ${sortColumns}
order by xtime desc
select DATE_FORMAT(cal.create_time,'%Y-%m-%d') AS xTime,
COUNT(co.id) as tempCount
from wx_coupon_action_log cal
left join wx_coupon_order co on cal.coupon_order_id=co.id
where co.coupon_order_status = 1
and cal.`tenant_id` = #{tenantId}
and cal.`parent_tenant_id` = #{parentTenantId}
and cal.create_time >= #{startTime}
and cal.create_time <= #{endTime}
and cal.channel_type = #{channelType}
group by xTime
order by xTime desc
select COUNT(*) FROM wx_coupon_action_log
where channel_type in (2,3,4,5,7)
and `tenant_id` = #{tenantId}
and `create_time` >= #{startTime}
and `create_time` <= #{endTime}
select COUNT(1) FROM wx_coupon_action_log
where channel_type = #{channelType}
and channel_id = #{channelId}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
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 a.`parent_tenant_id` = #{parentTenantId}
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 a.`parent_tenant_id` = #{parentTenantId}
AND o.c_user_id = #{cUserId}
AND a.coupon_id = #{couponId}
AND date(a.create_time) between #{beginDate} and #{endDate}
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 a.`parent_tenant_id` = #{parentTenantId}
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}
SELECT cal.id AS actionId,
cal.coupon_id AS couponId,
cal.create_time AS createDate,
cs.id AS couponSendId,
c.title,
cu.nick_name AS userName,
cu.phone,
mbu.NAME AS operator
FROM wx_coupon_action_log cal
LEFT JOIN wx_coupon_send cs ON cal.channel_id = cs.id
LEFT JOIN wx_coupon_order co ON cal.coupon_order_id = co.id
LEFT JOIN wx_coupon c ON cal.coupon_id = c.id
LEFT JOIN wx_c_user_basic_info cu ON cu.id = co.c_user_id
LEFT JOIN wx_merchant_b_user mbu ON mbu.id = cal.operator_id
WHERE cal.channel_type = #{channelType}
AND cs.conditions -> '$.id' = concat(#{merchantId},'')
AND cal.create_time >= #{beginDate}
AND cal.create_time < #{endDate}
order by ${sortColumns}