`id`,`tenant_id`,`order_id`,`coupon_id`,`remain_people`,`create_date`,`update_date`,`expired_date`,`status`,`user_id`
where 1 = 1
and `id` = #{id}
and `tenant_id` = #{tenantId}
and `order_id` = #{orderId}
and `coupon_id` = #{couponId}
and `remain_people` = #{remainPeople}
and `create_date` = #{createDate}
and id in
#{idItem}
order by ${sortColumns}
select
from wx_order_group
select o.press_end_date expiredDate,o.order_group_id orderGroupId,c.nick_name nickName,
c.avatar_url avatarUrl,o.id orderId,o.product_id couponId
from wx_order o
left join wx_c_user c on o.c_user_id=c.id
where o.tenant_id=#{tenantId} and o.id=#{orderId}
select o.id orderId,o.order_status orderStatus,o.order_group_id orderGroupId,c.title,c.sub_title subTitle,
c.sale_price salePrice,c.cover_img coverImg,g.remain_people remainPeople,c.id couponId,g.expired_date
expiredDate,g.status,g.user_id firstUser,u.nick_name nickName,u.avatar_url avatarUrl,o.tenant_id tenantId,
o.coupon_channel_id couponChannelId,c.press_limit_num pressLimitNum,
(select status from wx_coupon_channel where id=o.coupon_channel_id) couponStatus
from wx_order o
left join wx_coupon c on o.product_id=c.id
left join wx_order_group g on o.order_group_id=g.id
left join wx_c_user u on o.c_user_id=u.id
where o.tenant_id=#{tenantId} and c.type=9
and o.c_user_id=#{cUserId}
and o.id=#{id}
and o.order_group_id=#{orderGroupId}
and o.order_status in(10,11,12,13,14,15,16)
order by o.id desc,o.order_status
update wx_order_group set remain_people=remain_people-1,status=#{status},update_date=#{updateDate} where id=#{id} and remain_people>0
select c.tenant_id,coupon_id,c.cover_img,title,c.price,c.sale_price,c.group_total_count,c.group_success_count,
ROUND(IFNULL((c.group_success_count/c.group_total_count),0)*100)
group_transfer_ratio,c.success_people,c.verify_count,
ROUND(IFNULL((verify_count/success_people),0)*100) verify_ratio,c.total_people from(
select tenant_id,id coupon_id,cover_img,title,ROUND(price/100,2) price,ROUND(sale_price/100,2) sale_price,
(select count(*) total from wx_order_group where coupon_id=c.id) group_total_count,
(select count(*) total from wx_order_group where status=11 and coupon_id=c.id) group_success_count,
IFNULL((select count(*) from wx_order where order_status=11 and product_id=c.id),0) success_people,
(select count(*) total
from wx_coupon_order where coupon_type=9 and coupon_order_status=1 and coupon_id=c.id) verify_count,
IFNULL((select count(*) from wx_order where order_group_id!=0 and product_id=c.id),0) total_people
from wx_coupon c where type=9 order by c.status,c.id desc
) c
and c.tenant_id=#{tenantId}
and c.coupon_id=#{couponId}
and c.title like concat('%',#{title},'%')
order by ${sortColumns}
select count(*) total,DATE_FORMAT(create_date,'%Y-%m-%d') time from wx_coupon_order
where coupon_type=9
and tenant_id=#{tenantId}
and create_date BETWEEN #{startdate} and #{enddate}
and coupon_id=#{couponId}
group by time
select count(*) total,DATE_FORMAT(create_date,'%Y-%m-%d') time
from wx_coupon_order where coupon_type=9 and coupon_order_status=1
and tenant_id=#{tenantId}
and create_date BETWEEN #{startdate} and #{enddate}
and coupon_id=#{couponId}
group by time
select count(*) total from wx_order_group
and tenant_id=#{tenantId}
and create_date BETWEEN #{startdate} and #{enddate}
select DATE_FORMAT(create_date,'%Y-%m-%d') xtime,count(*) xcount
from wx_order_group
and tenant_id=#{tenantId}
and create_date BETWEEN #{startdate} and #{enddate}
group by xtime
select count(*) total from wx_order_group where status=11
and tenant_id=#{tenantId}
and create_date BETWEEN #{startdate} and #{enddate}
select count(*) from (select id from wx_order where order_group_id!=0
and tenant_id=#{tenantId}
and create_date BETWEEN #{startdate} and #{enddate}
) g
select count(*) total from wx_coupon_order where coupon_type=9 and coupon_order_status=1
and tenant_id=#{tenantId}
and create_date BETWEEN #{startdate} and #{enddate}
and coupon_id=#{couponId}
select count(*) from wx_order where order_status=11
and tenant_id=#{tenantId}
and create_date BETWEEN #{startdate} and #{enddate}