`id`,`order_number`,`tenant_id`,`parent_tenant_id`,`c_user_id`,`coupon_channel_id`,`product_id`,`product_name`,`type`,`pay_vendor`,`pay_version`,`make_merchant_id`,`payment_type`,`payment`,`payment_time`,`freight_price`,`order_status`,`cps_status`,`create_date`,`update_date`,`detail`,`ref_detail`,
`press_end_date`,`press_current_num`,`press_current_value`,`order_group_id`,`form_id`,`total_payment`,`compose_order_id`,`coupon_number`,`compose_order_type`,`shipping_type`,`shipping_address`,`parent_order_id`,`ext_param`
where 1 = 1
and `id` = #{id}
and `order_number` = #{orderNumber}
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
and `c_user_id` = #{cUserId}
and `coupon_channel_id` = #{couponChannelId}
and `product_id` = #{productId}
and `type` = #{type}
and `pay_vendor` = #{payVendor}
and `pay_version` = #{payVersion}
and `payment_type` = #{paymentType}
and `payment` = #{payment}
and `payment_time` = #{paymentTime}
and `order_status` = #{orderStatus}
and `cps_status` = #{cpsStatus}
and `create_date` = #{createDate}
and `update_date` = #{updateDate}
and `detail` like concat('%', #{detail},'%')
and `press_end_date` = #{pressEndDate}
and `press_current_num` = #{pressCurrentNum}
and `press_current_value` = #{pressCurrentValue}
and `order_group_id` = #{orderGroupId}
and `form_id` = #{formId}
and `compose_order_id` = #{composeOrderId}
and `compose_order_type` = #{composeOrderType}
and `shipping_type` = #{shippingType}
and `parent_order_id` = #{parentOrderId}
and `order_status` in
#{sItem}
and id in
#{idItem}
order by ${sortColumns}
select from wx_order where id =#{id} and tenant_id=#{tenantId}
select
from wx_order
select count(1) from wx_order
select COALESCE(sum(coupon_number),0) from wx_order
select count(1) from wx_order o where o.`tenant_id` = #{tenantId}
and o.c_user_id = #{cUserId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.type = #{type}
and o.pay_vendor = #{payVendor}
and o.order_status in
#{sItem}
and o.product_id in
#{couponIdItem}
select
from wx_order
where order_status = '0' and press_end_date is null and tenant_id = #{tenantId}
AND type = #{type,jdbcType=TINYINT}
AND pay_vendor = #{payVendor,jdbcType=TINYINT}
AND unix_timestamp(`create_date`) > unix_timestamp(#{startDate,jdbcType=TIMESTAMP})
AND unix_timestamp(`create_date`) < unix_timestamp(#{endDate,jdbcType=TIMESTAMP})
select
from wx_order
where press_end_date is not null and (order_status = 6 or order_status = 7) and tenant_id = #{tenantId}
AND type = #{type,jdbcType=TINYINT}
AND pay_vendor = #{payVendor,jdbcType=TINYINT}
AND unix_timestamp(`create_date`) > unix_timestamp(#{startDate,jdbcType=TIMESTAMP})
AND unix_timestamp(`press_end_date`) < unix_timestamp(#{endDate,jdbcType=TIMESTAMP})
select
from wx_order
where press_end_date is not null and order_status = 7 and tenant_id = #{tenantId}
AND type = #{type,jdbcType=TINYINT}
AND pay_vendor = #{payVendor,jdbcType=TINYINT}
AND unix_timestamp(`create_date`) > unix_timestamp(#{startDate,jdbcType=TIMESTAMP})
AND unix_timestamp(`update_date`) < unix_timestamp(#{endDate,jdbcType=TIMESTAMP})
select
from wx_order
where order_status = 15 and press_end_date is null and tenant_id = #{tenantId}
AND type = #{type,jdbcType=TINYINT}
AND pay_vendor = #{payVendor,jdbcType=TINYINT}
AND unix_timestamp(`create_date`) > unix_timestamp(#{startDate,jdbcType=TIMESTAMP})
AND unix_timestamp(`create_date`) < unix_timestamp(#{endDate,jdbcType=TIMESTAMP})
update wx_order set order_status=#{orderStatus}
where product_id=#{productId}
and press_end_date is not null and order_status in (6,7)
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
update wx_order set order_status=#{orderStatus},update_date=#{updateDate}
where product_id=#{productId} and order_status in(10,15)
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
update wx_order set order_status=#{orderStatus},update_date=#{updateDate}
where coupon_channel_id=#{couponChannelId} and order_status in(10,15)
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
select
o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.product_name,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
o.compose_order_type,o.compose_order_id,o.`coupon_number`,o.`freight_price`,o.`shipping_type`,o.`shipping_address`,o.parent_order_id,o.ext_param
from wx_order o
where o.order_status in (0,1,2,3,4,5)
and o.c_user_id = #{cUserId}
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.`compose_order_id` = #{composeOrderId}
and o.`parent_order_id` = #{parentOrderId}
AND o.order_status = #{orderStatus}
and o.pay_vendor = #{payVendor}
and o.compose_order_id in
#{composeOrderIdItem}
order by ${sortColumns}
select
o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.product_name,o.payment_type,o.payment,o.payment_time,o.order_status,o.create_date,o.update_date,
o.compose_order_type,o.compose_order_id,o.parent_order_id,o.`coupon_number`,o.`freight_price`,o.`shipping_type`,o.`shipping_address`,o.ext_param
FROM wx_order o where o.`tenant_id` = #{tenantId}
and o.c_user_id = #{cUserId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.`compose_order_id` = #{composeOrderId}
and o.`parent_order_id` = #{parentOrderId}
and o.id = #{id}
select * from(
select 0 level,o.compose_order_type,o.compose_order_id,o.payment,o.order_status,o.create_date,
o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.payment_type,o.payment_time,o.update_date,
c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date,
o.`coupon_number`,o.`freight_price`,o.`shipping_type`,o.`shipping_address`
from wx_coupon c,wx_order o
where o.product_id = c.id and o.order_status in (0,2)
and o.compose_order_type = 0
and o.compose_order_id = 0
and o.parent_order_id = 0
and o.c_user_id = #{cUserId}
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
AND o.order_status = #{orderStatus}
and o.pay_vendor = #{payVendor}
union all
select 0 level, o.compose_order_type,o.compose_order_id,o.payment,o.order_status,o.create_date,
o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.payment_type,o.payment_time,o.update_date,
c.type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.tail_price,c.orig_price,c.unit,c.valid_start_date,c.valid_end_date,c.pick_start_date,c.pick_end_date,
o.`coupon_number`,o.`freight_price`,o.`shipping_type`,o.`shipping_address`
from wx_coupon c,wx_order o
where o.product_id = c.id and o.order_status in (1,3,4,5)
and o.compose_order_type in (0,1,2,3)
and o.parent_order_id = 0
and o.c_user_id = #{cUserId}
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
AND o.order_status = #{orderStatus}
and o.pay_vendor = #{payVendor}
union all
select 1 level,o.compose_order_type,o.compose_order_id,sum(o.payment) payment,o.order_status,min(create_date) create_date,
null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,
null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,null ,
null ,null ,null ,null
from wx_order o
where o.order_status in (0,2)
and o.compose_order_type in (1,2,3)
and o.compose_order_id > 0
and o.parent_order_id = 0
and o.c_user_id = #{cUserId}
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
AND o.order_status = #{orderStatus}
and o.pay_vendor = #{payVendor}
group by o.compose_order_type,o.compose_order_id
) a
order by a.create_date desc
select count(1) as count, IFNULL(sum(o.payment), 0) as total_price
from wx_order o
where o.`type` = 1 and o.`order_status` = 1
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.pay_vendor = #{payVendor}
and o.product_id in
#{bUserIdItem}
and o.`c_user_id` = #{cUserId}
and o.`coupon_channel_id` = #{couponChannelId}
and o.`product_id` = #{productId}
AND o.create_date > #{startDate,jdbcType=TIMESTAMP}
AND o.create_date < #{endDate,jdbcType=TIMESTAMP}
select
o.`id`,o.`order_number`,o.`tenant_id`,o.`parent_tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`,o.`pay_vendor`,o.`pay_version`,
o.`payment_type`,o.`payment`,o.`payment_time`,o.`freight_price`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`,o.`ref_detail`
from wx_order o
where o.order_status = '1' and o.`type` = 1
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.pay_vendor = #{payVendor}
and o.pay_version = #{payVersion}
and o.product_id in
#{bUserIdItem}
AND o.create_date > #{startDate,jdbcType=TIMESTAMP}
AND o.create_date < #{endDate,jdbcType=TIMESTAMP}
order by o.create_date desc
select
o.`id`,o.`order_number`,o.`tenant_id`,o.`c_user_id`,o.`coupon_channel_id`,o.`product_id`,o.`type`,o.`pay_vendor`,o.`pay_version`,
o.`payment_type`,o.`payment`,o.`payment_time`,o.`freight_price`,o.`order_status`,o.`create_date`,o.`update_date`,o.`detail`,o.`ref_detail`
from wx_order o
where o.order_status = '0' and o.`type` = 1
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.pay_vendor = #{payVendor}
and o.pay_version = #{payVersion}
and o.product_id in
#{bUserIdItem}
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.`type` = #{type}
and o.pay_vendor = #{payVendor}
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
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.`parent_tenant_id` = #{parentTenantId}
and o.`type` = #{type}
and o.pay_vendor = #{payVendor}
and o.`order_status` = #{orderStatus}
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` = 1 and o.`order_status` = 1
and o.product_id in
#{bUserIdItem}
and o.pay_vendor = #{payVendor}
and o.`create_date` BETWEEN #{startTime} and #{endTime}
group by xTime
select bu.merchant_id as id, IFNULL(sum(o.payment),0) tradeAmt
from wx_order o, wx_merchant_b_user bu
where bu.id = o.product_id
and o.order_status = 1
and o.type = 1
AND o.create_date > #{startTime}
AND o.create_date < #{endTime}
and bu.merchant_id in
#{merchantIdItem}
group by id
order by tradeAmt desc
select o.*,case o.order_status when 0 then 0 when 2 then 0 else o.payment end pay from (
select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,o.order_status,
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,1 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where c.type=100
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
union all
select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,o.order_status,
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,2 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where c.type in (1,2,3,4,5,6,10,50,51,66) and o.order_status in(0,1,2,3,4,5)
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
union all
select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,o.order_status,
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,6 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where c.type = 11 and o.order_status in(0,1,2,3,4,5)
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
union all
select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,o.order_status,
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,7 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where c.type = 12 and o.order_status in(0,1,2,3,4,5)
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
union all
select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,
case o.order_status when 6 then 0 when 7 then 0
when 8 then 2 when 9 then 2 else o.order_status end order_status,
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,3 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where c.type=8 and o.press_current_num>0
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
union all
select o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.product_id,o.payment,
case o.order_status when 10 then 1 when 11 then 1
when 12 then 4 when 13 then 4 when 14 then 4 when 15 then 0 when 16 then 2
else o.order_status end order_status,
c.title,cubi.`name` c_user_name,cubi.phone,o.create_date,4 attribute from wx_order o
left join wx_c_user_basic_info cubi on o.c_user_id=cubi.id
left join wx_coupon c on o.product_id=c.id
where c.type=9 and o.order_group_id>0
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
) o
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.`title` like concat('%',#{title},'%')
and o.`payment` = 0
and o.`payment` > 0
and o.create_date between #{startdate} and #{enddate}
and o.order_status = #{orderStatus}
and o.attribute = #{attribute}
and o.order_number like concat('%',#{orderNumber},'%')
order by ${sortColumns}
order by o.create_date desc, 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 o.type = 0 and o.order_status in (1,4)) 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 o.type in (1,2) and o.order_status in (1,4)) o
left join wx_merchant m on o.merchant_id=m.id
) o
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.create_date between #{startdate} and #{enddate}
) o
select ifnull(sum(o.payment),0) payment from wx_order o
where o.type in (0,1,2) and o.order_status = #{order_status}
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.create_date between #{startdate} and #{enddate}
select count(*) from (
select o.* from wx_order o
where o.type in (0,1,2) and o.order_status = #{order_status}
) o
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
and o.create_date between #{startdate} and #{enddate}
o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.`freight_price`,o.order_status,
o.create_date,o.update_date,o.press_end_date,o.press_current_num,o.press_current_value,
c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.press_limit_num,
o.compose_order_id,o.compose_order_type,o.`shipping_type`,o.`shipping_address`
o.id,o.order_number,o.tenant_id,o.parent_tenant_id,o.c_user_id,o.coupon_channel_id,o.product_id,o.payment_type,o.payment,o.payment_time,o.`freight_price`,o.order_status,
o.create_date,o.update_date,o.press_end_date,o.press_current_num,o.press_current_value,
o.compose_order_id,o.compose_order_type,
c.type as coupon_type,c.cover_img,c.title,c.sub_title,c.sale_price,c.use_price,c.price,c.unit,c.detail,c.remark,c.press_limit_num,
co.id as coupon_order_id,co.coupon_order_status
select
from wx_coupon c,wx_order o
left join wx_coupon_order co on co.order_id = o.id
where o.product_id = c.id and c.type = 8 and o.order_status in (6,7,8,9)
and o.c_user_id = #{cUserId}
and o.`tenant_id` = #{tenantId}
and o.`parent_tenant_id` = #{parentTenantId}
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.`parent_tenant_id` = #{parentTenantId}
and o.id = #{id}
update wx_order set order_status=#{orderStatus}
where order_group_id=#{orderGroupId} and order_status=10
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
update wx_order set order_status=12 where `type`=0 and tenant_id = #{tenantId} and order_status in(10,15) and now()>press_end_date
update wx_order set c_user_id= #{cUserId} where tenant_id = #{tenantId}
and id = #{id}
and id in
#{idItem}
select distinct compose_order_id from wx_order
where c_user_id = #{cUserId}
and parent_order_id = 0
and (`type` = 0 or `type` = 4)
and order_status in (0,1,2,3,4,5)
and `tenant_id` = #{tenantId}
and `parent_tenant_id` = #{parentTenantId}
AND order_status = #{orderStatus}
and `order_status` in
#{sItem}
and pay_vendor = #{payVendor}