`id`,`tenant_id`,`coupon_id`,`c_user_id`,`b_user_id`,`order_id`,`expired_time`,`coupon_order_status`,`create_date`,`update_date`,`coupon_price`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `coupon_id` = #{couponId}
and `c_user_id` = #{cUserId}
and `b_user_id` = #{bUserId}
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 id in
#{idItem}
order by ${sortColumns}
select from wx_coupon_order
select count(*) from wx_coupon_order
co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
c.type,c.title,c.sale_price,c.use_price,c.price,
bu.name,cu.phone
co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price,
c.type,c.title,c.sale_price,c.use_price,c.price,
cu.phone
co.id,co.tenant_id,co.coupon_id,co.c_user_id,co.b_user_id,co.order_id,co.expired_time,co.coupon_order_status,co.create_date,co.update_date,co.coupon_price
select
from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu
where o.id = co.order_id
and o.merchant_id = #{merchantID}
and co.coupon_id = c.id
and cu.id = co.c_user_id
AND co.create_date > #{startDate,jdbcType=TIMESTAMP}
AND co.create_date < #{endDate,jdbcType=TIMESTAMP}
AND (co.coupon_order_status = '0' or co.coupon_order_status = '1')
order by co.create_date desc
select
from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu,wx_merchant_b_user bu
where o.id = co.order_id
and o.merchant_id = #{merchantID}
and co.coupon_id = c.id
and cu.id = co.c_user_id
and bu.id = co.b_user_id
AND co.update_date > #{startDate,jdbcType=TIMESTAMP}
AND co.update_date < #{endDate,jdbcType=TIMESTAMP}
AND co.coupon_order_status = '1'
order by co.update_date desc
select
from wx_coupon_order co,wx_order o,wx_coupon c,wx_c_user cu
where o.id = co.order_id
and co.coupon_id = c.id
and cu.id = co.c_user_id
and co.id = #{id}
and co.tenant_id = #{tenantId}
and co.coupon_id = #{couponId}
and co.c_user_id = #{cUserId}
and co.b_user_id = #{bUserId}
and co.order_id = #{orderId}
and co.expired_time = #{expiredTime}
and co.coupon_order_status = #{couponOrderStatus}
and co.create_date = #{createDate}
and co.update_date = #{updateDate}
and co.coupon_price = #{couponPrice}
and id in
#{idItem}
order by ${sortColumns}
select
from wx_coupon_order co,wx_order o
where o.id = co.order_id
and o.merchant_id = #{merchantID}
AND co.create_date > #{startDate,jdbcType=TIMESTAMP}
AND co.create_date < #{endDate,jdbcType=TIMESTAMP}
AND (co.coupon_order_status = '0' or co.coupon_order_status = '1')
select
from wx_coupon_order co,wx_order o
where o.id = co.order_id
and o.merchant_id = #{merchantID}
AND co.update_date > #{startDate,jdbcType=TIMESTAMP}
AND co.update_date < #{endDate,jdbcType=TIMESTAMP}
AND co.coupon_order_status = '1'
c.id,c.expired_time,c.coupon_order_status,c.create_date,c.update_date,c.coupon_price,
co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,
m.name
c.id,c.tenant_id,c.coupon_id,c.c_user_id,c.b_user_id,c.order_id,c.expired_time,c.coupon_order_status,c.create_date,c.update_date,c.coupon_price,
co.merchant_id,co.type,co.cover_img,co.title,co.sub_title,co.sale_price,co.use_price,co.price,co.detail,co.remark,
m.img_url,m.name,m.link_phone,m.status,
s.addr,s.shop_number,s.baidu_poi,
mb.building_name,mf.floor_name
select
from wx_coupon_order c,wx_coupon co,wx_merchant m
where 1=1
and c.coupon_id = co.id
and co.merchant_id = m.id
and c.c_user_id = #{cUserId}
and c.tenant_id = #{tenantId}
AND c.coupon_order_status = #{couponOrderStatus}
order by ${sortColumns}
select
from wx_coupon_order c,wx_coupon co,wx_merchant m
left join wx_merchant_shop ms on ms.merchant_id = m.id
left join wx_shop s on ms.shop_id = s.id
left join wx_mall_building mb on s.building = mb.id
left join wx_mall_floor mf on s.floor = mf.id
where c.coupon_id = co.id
and co.merchant_id = m.id
and c.c_user_id = #{cUserId}
and co.merchant_id = #{merchantId}
and c.tenant_id = #{tenantId}
and c.id = #{couponOrderId}
select COUNT(*) FROM wx_coupon_order where tenant_id = #{tenantId} and create_date >= #{startTime} and create_date <= #{endTime}
SELECT DATE_FORMAT(create_date,'%m/%d') as createTime
,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
,(select Count(*) from wx_coupon_order c where coupon_order_status=1 AND DATE_FORMAT(create_date,'%m/%d')=createTime and tenant_id=#{tenantId} 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 DATE_FORMAT(create_date,'%m/%d')=createTime and tenant_id=#{tenantId} AND d.update_date >= #{startTime} and d.update_date <= #{endTime}) as verifyUserCount
from wx_coupon_order where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY createTime
SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as createTime
,COUNT(DISTINCT c_user_id) as couponUserCount,count(*) as couponCount
,(select Count(*) 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.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 DATE_FORMAT(create_date,'%Y-%m-%d')=createTime and tenant_id=#{tenantId} AND d.update_date >= #{startTime} and d.update_date <= #{endTime}) as verifyUserCount
from wx_coupon_order where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY createTime
SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime
,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}
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 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}
AND create_date >= #{startTime}
and create_date <= #{endTime}
GROUP BY xTime
SELECT DATE_FORMAT(create_date,'%Y-%m-%d') as xTime,SUM(coupon_price) as price from wx_coupon_order
where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime} GROUP BY xTime
SELECT SUM(coupon_price) from wx_coupon_order
where tenant_id=#{tenantId} AND create_date >= #{startTime} and create_date <= #{endTime}