`id`,`order_number`,`tenant_id`,`c_user_id`,`product_id`,`type`,`payment_type`,`payment`,`payment_time`,`order_status`,`create_date`,`update_date`,`detail`
where 1 = 1
and `id` = #{id}
and `order_number` = #{orderNumber}
and `tenant_id` = #{tenantId}
and `c_user_id` = #{cUserId}
and `product_id` = #{productId}
and `type` = #{type}
and `payment_type` = #{paymentType}
and `payment` = #{payment}
and `payment_time` = #{paymentTime}
and `order_status` = #{orderStatus}
and `create_date` = #{createDate}
and `update_date` = #{updateDate}
and `detail` like concat('%', #{detail},'%')
and id in
#{idItem}
order by ${sortColumns}
select
from wx_order
select count(*) from wx_order
select count(*) from wx_order
where 1=1
and `tenant_id` = #{tenantId}
and `c_user_id` = #{cUserId}
and `product_id` = #{productId}
and `order_status` = #{orderStatus}
and date(`create_date`) = curdate()
select
from wx_order
where order_status = '0'
AND type = #{type,jdbcType=TINYINT}
AND create_date > #{startDate,jdbcType=TIMESTAMP}
AND create_date < #{endDate,jdbcType=TIMESTAMP}
o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit
o.id,o.order_number,o.tenant_id,o.c_user_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.detail,c.remark,
co.id as coupon_order_id,co.coupon_order_status
select
from wx_order o,wx_coupon c
where o.product_id = c.id
and o.c_user_id = #{cUserId}
and o.tenant_id = #{tenantId}
AND o.order_status = #{orderStatus}
order by ${sortColumns}
select
FROM wx_order o
left join wx_coupon c ON o.product_id = c.id
left join wx_coupon_order co on o.id = co.order_id
where o.product_id = c.id
and o.c_user_id = #{cUserId}
and o.tenant_id = #{tenantId}
and o.id = #{id}
select count(*) as count, IFNULL(sum(payment), 0) as total_price
from wx_order
inner join wx_merchant_b_user bu on bu.id = product_id
inner join wx_merchant m on m.id = bu.merchant_id
where `type` = 1 and `order_status` = 1
and `tenant_id` = #{tenantId}
and bu.`merchant_id` = #{merchantId}
and `c_user_id` = #{cUserId}
and bu.`id` = #{bUserId}
and `product_id` = #{productId}
AND create_date > #{startDate,jdbcType=TIMESTAMP}
AND create_date < #{endDate,jdbcType=TIMESTAMP}
o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`product_id`,o.`type`,
o.`payment_type`,o.`payment`,o.`payment_time`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`,
m.name as merchant_name, bu.name, bu.phone as bphone, cu.phone,cu.c_user_name
select
from wx_order o
inner join wx_merchant_b_user bu on bu.id = o.product_id
inner join wx_merchant m on m.id = bu.merchant_id
left join (
select cu.id,cu.phone,(select cubi.`name` from wx_c_user_basic_info cubi
where cubi.phone=cu.phone and cubi.`name` is not null limit 1) c_user_name
from wx_c_user cu
) cu on cu.id = o.c_user_id
where o.order_status = '1' and o.`type` = 1
and o.`tenant_id` = #{tenantId}
and bu.`merchant_id` = #{merchantId}
and bu.`id` = #{bUserId}
AND o.create_date > #{startDate,jdbcType=TIMESTAMP}
AND o.create_date < #{endDate,jdbcType=TIMESTAMP}
order by o.create_date desc
select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) triggerCount
from wx_order o
where o.`tenant_id` = #{tenantId} and o.`type` = #{type}
and o.`create_date` BETWEEN #{startTime} and #{endTime}
group by xTime
select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) count, IFNULL (SUM(o.payment),0) amount
from wx_order o
where o.`tenant_id` = #{tenantId} and o.`type` = #{type}
and o.`create_date` BETWEEN #{startTime} and #{endTime}
group by xTime
select DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime, count(o.id) count, IFNULL (SUM(o.payment),0) amount
from wx_order o
inner join wx_merchant_b_user bu on bu.id = o.product_id
inner join wx_merchant m on m.id = bu.merchant_id
where m.`id` = #{merchantId} and o.`type` = 1
and o.`create_date` BETWEEN #{startTime} and #{endTime}
group by xTime
wm.id as id,
wm.tenant_id as tenant_id,
wm.name as merchant_name,
wm.link_phone as merchant_phone,
mo.xTime as report_date,
(case when mo.amount > 0 then mo.amount else 0 end) trade_amt
select
from wx_merchant wm
left join
(select m.id as mid, IFNULL(sum(o.payment),0) amount,DATE_FORMAT(o.create_date,'%Y-%m-%d') xTime
from wx_merchant m, wx_order o, wx_merchant_b_user bu
where bu.id = o.product_id
and m.status = 1
and m.id = bu.merchant_id
and o.order_status = '1'
and o.type = 1
AND o.create_date > #{startTime}
AND o.create_date < #{endTime}
group by m.id,xTime) mo on mo.mid = wm.id
where wm.status = 1
and wm.name like concat('%', #{merchantName},'%')
order by wm.create_date desc
select o.* from (
select o.*,m.`name` merchant_name,cubi.`name` c_user_name,cubi.phone from (
select o.*,cm.merchant_id from wx_order o
left join wx_coupon_merchant cm on o.product_id=cm.product_id
where type in (0,3)) o
left join wx_merchant m on o.merchant_id=m.id
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
union all
select o.*,m.`name` merchantName,cubi.`name` c_user_name,cubi.phone from (
select o.*,mbu.merchant_id from wx_order o
left join wx_merchant_b_user mbu on o.product_id=mbu.id
where type in (1,2)) o
left join wx_merchant m on o.merchant_id=m.id
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
) o
and o.tenant_id =#{tenantId}
and o.`merchant_name` like concat('%',#{merchantName},'%')
and o.create_date between #{startdate} and #{enddate}
order by o.id desc
select count(*) merchantCount from (
select distinct merchant_id from (
select o.*,m.`name` merchantName from (
select o.*,cm.merchant_id from wx_order o
left join wx_coupon_merchant cm on o.product_id=cm.product_id
where type in (0,3)) o
left join wx_merchant m on o.merchant_id=m.id
union all
select o.*,m.`name` merchantName from (
select o.*,mbu.merchant_id from wx_order o
left join wx_merchant_b_user mbu on o.product_id=mbu.id
where type in (1,2)) o
left join wx_merchant m on o.merchant_id=m.id
) o
and tenant_id =#{tenantId}
and create_date between #{startdate} and #{enddate}
) o
select ifnull(sum(payment),0) payment from (
select o.*,m.`name` merchantName from (
select o.*,cm.merchant_id from wx_order o
left join wx_coupon_merchant cm on o.product_id=cm.product_id
where type in (0,3)) o
left join wx_merchant m on o.merchant_id=m.id
union all
select o.*,m.`name` merchantName from (
select o.*,mbu.merchant_id from wx_order o
left join wx_merchant_b_user mbu on o.product_id=mbu.id
where type in (1,2)) o
left join wx_merchant m on o.merchant_id=m.id
) o
and tenant_id =#{tenantId}
and create_date between #{startdate} and #{enddate}