`id`,`tenant_id`,`parent_tenant_id`,`coupon_id`,`coupon_type`,`c_user_id`,`owner_id`,`b_user_id`,`b_merchant_id`,`b_tenant_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`,`coupon_credit_price`, `auto_refund`,
`verify_type`,`verify_remark`,`pay_vendor`,`pay_version`,`send_merchant_id`,`send_merchant_user_id`,`compose_order_type`,`compose_order_id`,`parent_coupon_order_id`,`coupon_number`,
`freight_price`,`shipping_type`,`shipping_address`,`shipping_status`,`delivery_info`,`subsidy`,`ext_param`
where `tenant_id` = #{tenantId}
and `id` = #{id}
and `parent_tenant_id` = #{parentTenantId}
and `coupon_id` = #{couponId}
and `coupon_type` = #{couponType}
and `c_user_id` = #{cUserId}
and `owner_id` = #{ownerId}
and `b_user_id` = #{bUserId}
and `b_merchant_id` = #{bMerchantId}
and `b_tenant_id` = #{bTenantId}
and `a_user_id` = #{aUserId}
and `order_id` = #{orderId}
and `expired_time` = #{expiredTime}
and `coupon_order_status` = #{couponOrderStatus}
and `create_date` = #{createDate}
and `update_date` = #{updateDate}
and `coupon_price` = #{couponPrice}
and `auto_refund` = #{autoRefund}
and `pay_vendor` = #{payVendor}
and `pay_version` = #{payVersion}
and `send_merchant_id` = #{sendMerchantId}
and `send_merchant_user_id` = #{sendMerchantUserId}
and `compose_order_type` = #{composeOrderType}
and `compose_order_id` = #{composeOrderId}
and `parent_coupon_order_id` = #{parentCouponOrderId}
and `shipping_type` = #{shippingType}
and `shipping_status` = #{shippingStatus}
and coupon_order_status in
#{cosidItem}
and id in
#{idItem}
order by ${sortColumns}
select from wx_coupon_order where id = #{id} and tenant_id=#{tenantId}
select from wx_coupon_order
select id from wx_coupon_order
select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,
co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
from wx_coupon_order co
where co.tenant_id = #{tenantId}
AND co.coupon_order_status = '1'
and co.b_merchant_id = #{bMerchantId}
AND co.update_date >= #{startDate,jdbcType=TIMESTAMP}
AND co.update_date <= #{endDate,jdbcType=TIMESTAMP}
order by co.update_date desc
select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,
co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
from wx_coupon_order co
where co.tenant_id = #{tenantId}
AND co.create_date_times > #{startDateTimes}
AND co.create_date_times < #{endDateTimes}
and co.coupon_id in
#{couponIdItem}
order by co.create_date_times desc
update wx_coupon_order
set `coupon_order_status` = #{couponOrderStatus},
`b_user_id` = #{bUserId},
`b_merchant_id` = #{bMerchantId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
,`verify_remark` = #{verifyRemark}
,`shipping_status` = #{shippingStatus}
,`b_tenant_id` = #{bTenantId}
where id=#{id} and `b_user_id` is null
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
update wx_coupon_order
set `coupon_order_status` = #{couponOrderStatus},
`b_user_id` = #{bUserId},
`b_merchant_id` = #{bMerchantId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
,`verify_remark` = #{verifyRemark}
,`shipping_status` = #{shippingStatus}
,`b_tenant_id` = #{bTenantId}
where id=#{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `b_user_id` is null
and `b_user_id` = #{bUserId}
update wx_coupon_order
set `coupon_order_status` = #{couponOrderStatus},
`b_user_id` = #{bUserId},
`b_merchant_id` = #{bMerchantId},
`update_date` = #{updateDate},
`verify_type` = #{verifyType}
,`verify_remark` = #{verifyRemark}
,`shipping_status` = #{shippingStatus}
,`b_tenant_id` = #{bTenantId}
where 1=1
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and id=#{id}
update wx_coupon_order
set `coupon_order_status` = #{couponOrderStatus},
`b_user_id` = null,
`b_merchant_id` = null,
`update_date` = #{updateDate},
`verify_type` = null,
`b_tenant_id` = null
where id=#{id}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
update wx_coupon_order
set `subsidy` = #{subsidy}
where id=#{id}
select DATE_FORMAT(create_date,'%m/%d') as createTime ,count(1) as count from wx_coupon_order co
where `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
AND co.create_date_times >= #{startCreateDateTimes}
AND co.create_date_times <= #{endCreateDateTimes}
and co.coupon_order_status = #{couponOrderStatus}
AND co.update_date >= #{updateStartTime}
AND co.update_date <= #{updateEndTime}
group by DATE_FORMAT(create_date,'%m/%d')
select DATE_FORMAT(create_date,'%m/%d') as createTime ,count(DISTINCT c_user_id) as count from wx_coupon_order co
where `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
AND co.create_date_times >= #{startCreateDateTimes}
AND co.create_date_times <= #{endCreateDateTimes}
and co.coupon_order_status = #{couponOrderStatus}
AND co.update_date >= #{updateStartTime}
AND co.update_date <= #{updateEndTime}
group by DATE_FORMAT(create_date,'%m/%d')
SELECT createTime,couponId,sum(couponCount) couponCount,sum(couponUserCount) couponUserCount,sum(verifyCount) verifyCount,sum(verifyUserCount) verifyUserCount
from view_coupon_data${tenantEntity.shardTableSuffix} WHERE `tenant_id` = #{tenantEntity.tenantId}
and `parent_tenant_id` = #{parentTenantId}
and createTime >= DATE_FORMAT(#{startTime},'%Y-%m-%d')
and view_coupon_data.createTime <= DATE_FORMAT(#{endTime},'%Y-%m-%d')
and couponType = #{couponType}
and couponTitle like concat('%', #{couponTitle},'%')
GROUP BY createTime,couponId
order by createTime desc
SELECT xTime, sum(pv) pv, sum(uv) uv, sum(couponCount) couponCount, sum(userCount) userCount, sum(verifyCount) verifyCount, sum(verifyUserCount) verifyUserCount
from view_touch_user${tenantEntity.shardTableSuffix} WHERE `tenant_id` = #{tenantEntity.tenantId}
and `parent_tenant_id` = #{parentTenantId}
and xTime >= DATE_FORMAT(#{startTime},'%Y-%m-%d')
and xTime <= DATE_FORMAT(#{endTime},'%Y-%m-%d')
GROUP BY xTime
order by xTime desc
select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
from wx_coupon_order c
where c.coupon_order_status = 1
and c.`tenant_id` = #{tenantId}
and c.`parent_tenant_id` = #{parentTenantId}
and c.update_date BETWEEN #{startTime} and #{endTime}
group by xTime
select DATE_FORMAT(update_date,'%Y-%m-%d') xTime, count(c.id) triggerCount
from wx_coupon_order c where c.`tenant_id` = #{tenantId}
and c.`parent_tenant_id` = #{parentTenantId}
and c.create_date BETWEEN #{startTime} and #{endTime}
group by xTime
SELECT IFNULL(SUM(coupon_price),0) from wx_coupon_order
where `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and coupon_order_status = #{couponOrderStatus}
and c_user_id = #{cUserId}
and coupon_id = #{couponId}
and coupon_type = #{couponType}
and create_date_times >= unix_timestamp(#{startTime})*1000
and create_date_times <= unix_timestamp(#{endTime})*1000
select COUNT(co.id) FROM wx_coupon_order co
where co.`tenant_id` = #{tenantId}
and co.`parent_tenant_id` = #{parentTenantId}
and co.coupon_order_status = #{couponOrderStatus}
and co.c_user_id = #{cUserId}
and co.coupon_id = #{couponId}
and co.coupon_type = #{couponType}
and co.send_merchant_id = #{sendMerchantId}
and co.update_date >= #{startTime}
and co.update_date <= #{endTime}
and date_format(co.update_date,'%H:%m') >= '06:00'
and date_format(co.update_date,'%H:%m') < '18:00'
and date_format(co.update_date,'%w') in (1,2,3,4,5)
and ((date_format(co.update_date,'%H:%m') >= '18:00'
and date_format(co.update_date,'%w') in (1,2,3,4))
or
((date_format(co.update_date,'%H:%m') < '06:00')
and date_format(co.update_date,'%w') in (1,2,3,4,5)))
and date_format(co.update_date,'%H:%m') >= '06:00'
and date_format(co.update_date,'%H:%m') < '18:00'
and date_format(co.update_date,'%w') in (0,6)
and ((date_format(co.update_date,'%H:%m') >= '18:00'
and date_format(co.update_date,'%w') in (5,6,0))
or
((date_format(co.update_date,'%H:%m') < '06:00')
and date_format(co.update_date,'%w') in (6,0)))
and co.create_date >= #{startTime}
and co.create_date <= #{endTime}
and date_format(co.create_date,'%H:%m') >= '06:00'
and date_format(co.create_date,'%H:%m') < '18:00'
and date_format(co.create_date,'%w') in (1,2,3,4,5)
and ((date_format(co.create_date,'%H:%m') >= '18:00'
and date_format(co.create_date,'%w') in (1,2,3,4))
or
((date_format(co.create_date,'%H:%m') < '06:00')
and date_format(co.create_date,'%w') in (1,2,3,4,5)))
and date_format(co.create_date,'%H:%m') >= '06:00'
and date_format(co.create_date,'%H:%m') < '18:00'
and date_format(co.create_date,'%w') in (0,6)
and ((date_format(co.create_date,'%H:%m') >= '18:00'
and date_format(co.create_date,'%w') in (5,6,0))
or
((date_format(co.create_date,'%H:%m') < '06:00')
and date_format(co.create_date,'%w') in (6,0)))
select COALESCE(sum(coupon_number),0) FROM wx_coupon_order co
where co.`tenant_id` = #{tenantId}
and co.`parent_tenant_id` = #{parentTenantId}
and co.coupon_order_status = #{couponOrderStatus}
and co.c_user_id = #{cUserId}
and co.coupon_id = #{couponId}
and co.coupon_type = #{couponType}
and co.coupon_id in
#{couponIdItem}
select co.coupon_id as couponId, count(1) as count FROM wx_coupon_order co
where co.`tenant_id` = #{tenantId}
and co.`parent_tenant_id` = #{parentTenantId}
and co.coupon_order_status = #{couponOrderStatus}
and co.c_user_id = #{cUserId}
and co.coupon_id = #{couponId}
and co.coupon_type = #{couponType}
and co.coupon_id in
#{couponIdItem}
and co.update_date >= #{startTime}
and co.update_date <= #{endTime}
and date_format(co.update_date,'%H:%m') >= '06:00'
and date_format(co.update_date,'%H:%m') < '18:00'
and date_format(co.update_date,'%w') in (1,2,3,4,5)
and ((date_format(co.update_date,'%H:%m') >= '18:00'
and date_format(co.update_date,'%w') in (1,2,3,4))
or
((date_format(co.update_date,'%H:%m') < '06:00')
and date_format(co.update_date,'%w') in (1,2,3,4,5)))
and date_format(co.update_date,'%H:%m') >= '06:00'
and date_format(co.update_date,'%H:%m') < '18:00'
and date_format(co.update_date,'%w') in (0,6)
and ((date_format(co.update_date,'%H:%m') >= '18:00'
and date_format(co.update_date,'%w') in (5,6,0))
or
((date_format(co.update_date,'%H:%m') < '06:00')
and date_format(co.update_date,'%w') in (6,0)))
and co.create_date >= #{startTime}
and co.create_date <= #{endTime}
and date_format(co.create_date,'%H:%m') >= '06:00'
and date_format(co.create_date,'%H:%m') < '18:00'
and date_format(co.create_date,'%w') in (1,2,3,4,5)
and ((date_format(co.create_date,'%H:%m') >= '18:00'
and date_format(co.create_date,'%w') in (1,2,3,4))
or
((date_format(co.create_date,'%H:%m') < '06:00')
and date_format(co.create_date,'%w') in (1,2,3,4,5)))
and date_format(co.create_date,'%H:%m') >= '06:00'
and date_format(co.create_date,'%H:%m') < '18:00'
and date_format(co.create_date,'%w') in (0,6)
and ((date_format(co.create_date,'%H:%m') >= '18:00'
and date_format(co.create_date,'%w') in (5,6,0))
or
((date_format(co.create_date,'%H:%m') < '06:00')
and date_format(co.create_date,'%w') in (6,0)))
group by co.coupon_id
SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,IFNULL(SUM(coupon_price),0) as price
from wx_coupon_order
where create_date_times >= unix_timestamp(#{startTime})*1000 and create_date_times < unix_timestamp(#{endTime})*1000
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
GROUP BY xTime
select from wx_coupon_order
where tenant_id = #{tenantId} and expired_time >= date_sub(curdate(),interval 360 day) and expired_time <=#{expiredTime} and coupon_price = 0 and coupon_order_status in (0, 4)
select from wx_coupon_order
where tenant_id = #{tenantId} and expired_time >= date_sub(curdate(),interval 360 day) and expired_time <=#{expiredTime} and coupon_price > 0 and coupon_order_status in (0, 4)
select from wx_coupon_order
where tenant_id = #{tenantId} and coupon_type = 11
and update_date < DATE_SUB(curdate(),interval 14 day)
and shipping_type = 2 and shipping_status = 24 and coupon_order_status = 0
select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.expired_time,co.coupon_order_status,co.order_id,
co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price, co.verify_type, co.verify_remark,co.pay_vendor,co.pay_version,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.send_merchant_id,co.subsidy,co.ext_param
FROM wx_coupon_order co where co.`tenant_id` = #{tenantId}
and co.id = #{id}
and co.order_id = #{orderId}
and co.c_user_id = #{cUserId}
and co.coupon_type = #{couponType}
and co.coupon_type != 11
and co.coupon_type < 100
and co.`parent_tenant_id` = #{parentTenantId}
and co.coupon_order_status = #{couponOrderStatus}
and co.`shipping_type` = #{shippingType}
and co.`shipping_status` = #{shippingStatus}
AND co.create_date > #{startDate,jdbcType=TIMESTAMP}
AND co.create_date_times > #{startDateTimes}
AND co.create_date < #{endDate,jdbcType=TIMESTAMP}
AND co.create_date_times < #{endDateTimes}
AND co.update_date > #{verifyStartDate,jdbcType=TIMESTAMP}
AND co.update_date < #{verifyEndDate,jdbcType=TIMESTAMP}
AND co.b_tenant_id = #{bTenantId}
and co.coupon_id in
#{couponIdItem}
and co.b_merchant_id in
#{bMerchantIdItem}
order by ${sortColumns}
order by co.update_date desc
select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,
co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark, co.pay_vendor,co.pay_version,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.subsidy,co.ext_param
FROM wx_coupon_order co
where co.id = #{id} and co.tenant_id = #{tenantId}
select
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,
co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark, co.pay_vendor,co.pay_version,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
FROM wx_coupon_order co
where co.`tenant_id` = #{tenantId}
and co.coupon_type = #{couponType}
and co.coupon_type != 11
and co.coupon_type < 100
and co.`parent_tenant_id` = #{parentTenantId}
and co.coupon_order_status = #{couponOrderStatus}
and co.`shipping_status` in
#{idItem}
AND co.create_date_times > unix_timestamp(#{startDate})*1000
AND co.create_date_times < unix_timestamp(#{endDate})*1000
AND co.update_date > #{verifyStartDate,jdbcType=TIMESTAMP}
AND co.update_date < #{verifyEndDate,jdbcType=TIMESTAMP}
and co.id = #{id}
and co.order_id = #{orderId}
and co.coupon_id in
#{couponIdItem}
order by co.update_date desc
select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,
co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
from wx_coupon_order co
where co.tenant_id = #{tenantId}
AND co.create_date_times > #{startDateTimes}
AND co.create_date_times < #{endDateTimes}
and co.coupon_id in
#{couponIdItem}
select co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,
co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,co.pay_version,
co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
from wx_coupon_order co
where co.coupon_order_status = '1'
and co.tenant_id = #{tenantId}
AND co.b_merchant_id = #{bMerchantId}
AND co.update_date > #{startDate,jdbcType=TIMESTAMP}
AND co.update_date < #{endDate,jdbcType=TIMESTAMP}
select
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,
co.pay_version,co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
from wx_coupon_order co
where co.c_user_id = #{cUserId} and co.`tenant_id` = #{tenantId}
and co.coupon_type = #{couponType}
and co.coupon_type != 5
and co.coupon_type != 11
and co.coupon_type != 12
and co.coupon_type != 51
and co.coupon_type < 100
and co.owner_id = #{ownerId}
and co.`parent_tenant_id` = #{parentTenantId}
AND (co.coupon_order_status = #{couponOrderStatus} OR co.coupon_order_status = 100 )
AND co.coupon_order_status = #{couponOrderStatus}
and co.coupon_id in
#{couponIdItem}
order by ${sortColumns}
select
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,
co.pay_version,co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
from wx_coupon_order co
where co.id = #{id} and co.tenant_id = #{tenantId}
select
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,
co.pay_version,co.`freight_price`,co.`shipping_type`,co.`shipping_address`,co.`shipping_status`,co.`delivery_info`,co.ext_param
from wx_coupon_order co
where co.c_user_id = #{cUserId}
and co.coupon_order_status = #{status}
and co.`tenant_id` = #{tenantId}
and co.`parent_tenant_id` = #{parentTenantId}
and co.expired_time > now()
and co.coupon_id in
#{couponIdItem}
and id in
#{idItem}
select
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,co.coupon_credit_price,co.verify_type,co.verify_remark,co.pay_vendor,
co.pay_version from wx_coupon_order co
where co.c_user_id = #{cUserId}
and co.id = #{id}
and co.`tenant_id` = #{tenantId}
and co.`parent_tenant_id` = #{parentTenantId}
AND ( co.coupon_order_status = #{couponOrderStatus} OR co.coupon_order_status = 100 )
AND co.coupon_order_status = #{couponOrderStatus}
and co.coupon_id in
#{couponIdItem}
order by ${sortColumns}
select
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.expired_time,co.coupon_order_status,co.create_date,co.update_date
from wx_coupon_order co
where co.coupon_type = 100
and co.`tenant_id` = #{tenantId}
and co.`parent_tenant_id` = #{parentTenantId}
and co.c_user_id = #{cUserId}
and co.owner_id = #{ownerId}
and co.coupon_order_status = #{couponOrderStatus}
and co.coupon_order_status in
#{sItem}
and co.coupon_id in
#{couponIdItem}
order by ${sortColumns}
select
co.id,co.tenant_id,co.parent_tenant_id,co.coupon_id,co.coupon_type,co.c_user_id,co.owner_id,co.b_user_id,co.b_merchant_id,co.b_tenant_id,co.order_id,co.expired_time,co.coupon_order_status,
co.create_date,co.update_date,co.coupon_price
from wx_coupon_order co where co.id = #{id} and co.tenant_id = #{tenantId}
update wx_coupon_order set coupon_order_status = 4,update_date = now(), expired_time= #{expireTime} where coupon_id = #{couponId} and tenant_id = #{tenantId} and coupon_order_status in (4, 5)
select id from wx_coupon_order where coupon_id = #{couponId} and tenant_id = #{tenantId} and coupon_order_status in (4, 5)
select count(1)
from wx_coupon_order co
where co.`tenant_id` = #{tenantId}
and co.`parent_tenant_id` = #{parentTenantId}
and co.`coupon_type` = #{couponType}
and co.`coupon_order_status` = #{couponOrderStatus}
and co.`send_merchant_id` = #{sendMerchantId}
AND co.update_date >= #{startTime}
AND co.update_date <= #{endTime}
AND co.b_merchant_id = #{bMerchantId}
select count(co.b_merchant_id) AS consumeCountP,count(DISTINCT co.b_merchant_id) AS consumeCount,sum(co.coupon_price) AS tradeAmt, co.b_merchant_id as bMerchantId from
wx_coupon_order co
WHERE co.coupon_order_status = 1 and co.b_merchant_id is not null and co.b_merchant_id > 0
and co.`tenant_id` = #{tenantId}
and co.`parent_tenant_id` = #{parentTenantId}
and co.create_date >= #{starttime}
and co.create_date <= #{endtime}
AND co.b_merchant_id = #{bMerchantId}
and co.b_merchant_id in
#{bMerchantIdItem}
group by co.b_merchant_id
select co.create_date,co.coupon_id,co.c_user_id
from wx_coupon_order co
WHERE co.coupon_order_status=1
and co.`tenant_id` = #{tenantId}
and co.`parent_tenant_id` = #{parentTenantId}
and co.create_date >= #{startTime}
and co.create_date <= #{endTime}
and co.b_user_id in
#{bUserIdItem}
order by ${sortColumns}
order by co.create_date desc
select distinct c_user_id from wx_coupon_order
where `tenant_id` = #{tenantId}
and coupon_order_status = 1
and update_date >= #{verifiedStartTime}
and update_date <= #{verifiedEndTime}
select IFNULL(SUM(co.coupon_price), 0) AS amount, COUNT(1) AS total
from wx_coupon_order co
where co.tenant_id = #{tenantId}
AND co.coupon_order_status = '1'
and co.b_merchant_id = #{bMerchantId}
AND co.update_date >= #{startDate,jdbcType=TIMESTAMP}
AND co.update_date <= #{endDate,jdbcType=TIMESTAMP}