id,
member_id,
coupon_id,
order_sn,
create_time,
member_username,
total_amount,
pay_amount,
freight_amount,
promotion_amount,
integration_amount,
coupon_amount,
discount_amount,
pay_type,
source_type,
status,
order_type,
delivery_company,
delivery_sn,
auto_confirm_day,
integration,
growth,
promotion_info,
bill_type,
bill_header,
bill_content,
bill_receiver_phone,
bill_receiver_email,
receiver_name,
receiver_phone,
receiver_post_code,
receiver_province,
receiver_city,
receiver_region,
receiver_detail_address,
note,
confirm_status,
delete_status,
use_integration,
payment_time,
delivery_time,
receive_time,
comment_time,
modify_time,
prepay_id,
supply_id,
goods_id,
goods_name,
school_id
SELECT o.id,
o.order_sn,
o.coupon_id,
o.integration,
o.member_id,
o.use_integration,
ot.id ot_id,
ot.product_name ot_product_name,
ot.product_sku_id ot_product_sku_id,
ot.product_sku_code ot_product_sku_code,
ot.product_quantity ot_product_quantity
FROM oms_order o
LEFT JOIN oms_order_item ot ON o.id = ot.order_id
WHERE o.status = 12
AND date_add(NOW(), INTERVAL -#{minute} MINUTE) > o.create_time;
SELECT sum(CASE DATE_FORMAT(create_time, '%m') WHEN '01' THEN pay_amount ELSE 0 END) AS a1,
sum(CASE
DATE_FORMAT(create_time, '%m')
WHEN '02' THEN pay_amount
ELSE 0 END) AS a2,
sum(CASE DATE_FORMAT(create_time,
'%m')
WHEN '03' THEN pay_amount
ELSE 0 END) AS a3,
sum(CASE DATE_FORMAT(create_time, '%m')
WHEN '04' THEN
pay_amount
ELSE 0 END) AS a4,
sum(CASE DATE_FORMAT(create_time, '%m') WHEN '05' THEN pay_amount ELSE 0 END) AS
a5,
sum(CASE DATE_FORMAT(create_time, '%m') WHEN '06' THEN pay_amount ELSE 0 END) AS a6,
sum(CASE DATE_FORMAT(create_time, '%m') WHEN '07' THEN pay_amount ELSE 0 END) AS a7,
sum(CASE DATE_FORMAT(create_time, '%m') WHEN '08' THEN pay_amount ELSE 0 END) AS a8,
sum(CASE
DATE_FORMAT(create_time, '%m')
WHEN '09' THEN pay_amount
ELSE 0 END) AS a9,
sum(CASE DATE_FORMAT(create_time,
'%m')
WHEN '10' THEN pay_amount
ELSE 0 END) AS a10,
sum(CASE DATE_FORMAT(create_time, '%m')
WHEN '11' THEN
pay_amount
ELSE 0 END) AS a11,
sum(CASE DATE_FORMAT(create_time, '%m') WHEN '12' THEN pay_amount ELSE 0 END) AS
a12
FROM oms_order
WHERE YEAR(create_time) = YEAR(#{date})
SELECT sum(case DATE_FORMAT(create_time, '%d') when '01' then pay_amount else 0 end) as a1,
sum(case DATE_FORMAT(create_time, '%d') when '02' then pay_amount else 0 end) as a2,
sum(case DATE_FORMAT(create_time, '%d') when '03' then pay_amount else 0 end) as a3,
sum(case DATE_FORMAT(create_time, '%d') when '04' then pay_amount else 0 end) as a4,
sum(case DATE_FORMAT(create_time, '%d') when '05' then pay_amount else 0 end) as a5,
sum(case DATE_FORMAT(create_time, '%d') when '06' then pay_amount else 0 end) as a6,
sum(case DATE_FORMAT(create_time, '%d') when '07' then pay_amount else 0 end) as a7,
sum(case DATE_FORMAT(create_time, '%d') when '08' then pay_amount else 0 end) as a8,
sum(case DATE_FORMAT(create_time, '%d') when '09' then pay_amount else 0 end) as a9,
sum(case DATE_FORMAT(create_time, '%d') when '10' then pay_amount else 0 end) as a10,
sum(case DATE_FORMAT(create_time, '%d') when '11' then pay_amount else 0 end) as a11,
sum(case DATE_FORMAT(create_time, '%d') when '12' then pay_amount else 0 end) as a12,
sum(case DATE_FORMAT(create_time, '%d') when '13' then pay_amount else 0 end) as a13,
sum(case DATE_FORMAT(create_time, '%d') when '14' then pay_amount else 0 end) as a14,
sum(case DATE_FORMAT(create_time, '%d') when '15' then pay_amount else 0 end) as a15,
sum(case DATE_FORMAT(create_time, '%d') when '16' then pay_amount else 0 end) as a16,
sum(case DATE_FORMAT(create_time, '%d') when '17' then pay_amount else 0 end) as a17,
sum(case DATE_FORMAT(create_time, '%d') when '18' then pay_amount else 0 end) as a18,
sum(case DATE_FORMAT(create_time, '%d') when '19' then pay_amount else 0 end) as a19,
sum(case DATE_FORMAT(create_time, '%d') when '20' then pay_amount else 0 end) as a20,
sum(case DATE_FORMAT(create_time, '%d') when '21' then pay_amount else 0 end) as a21,
sum(case DATE_FORMAT(create_time, '%d') when '22' then pay_amount else 0 end) as a22,
sum(case DATE_FORMAT(create_time, '%d') when '23' then pay_amount else 0 end) as a23,
sum(case DATE_FORMAT(create_time, '%d') when '24' then pay_amount else 0 end) as a24,
sum(case DATE_FORMAT(create_time, '%d') when '25' then pay_amount else 0 end) as a25,
sum(case DATE_FORMAT(create_time, '%d') when '26' then pay_amount else 0 end) as a26,
sum(case DATE_FORMAT(create_time, '%d') when '27' then pay_amount else 0 end) as a27,
sum(case DATE_FORMAT(create_time, '%d') when '28' then pay_amount else 0 end) as a28,
sum(case DATE_FORMAT(create_time, '%d') when '29' then pay_amount else 0 end) as a29,
sum(case DATE_FORMAT(create_time, '%d') when '30' then pay_amount else 0 end) as a30,
sum(case DATE_FORMAT(create_time, '%d') when '31' then pay_amount else 0 end) as a31
FROM oms_order
WHERE MONTH(create_time) = MONTH(#{date})
UPDATE oms_order
SET
delivery_sn = CASE id
WHEN #{item.orderId} THEN #{item.deliverySn}
END,
delivery_company = CASE id
WHEN #{item.orderId} THEN #{item.deliveryCompany}
END,
delivery_time = CASE id
WHEN #{item.orderId} THEN now()
END,
`status` = CASE id
WHEN #{item.orderId} THEN 3
END
WHERE
id IN
#{item.orderId}
AND `status` = 2
UPDATE pms_sku_stock
SET
stock = CASE id
WHEN #{item.productSkuId} THEN stock - #{item.productQuantity}
END,
lock_stock = CASE id
WHEN #{item.productSkuId} THEN lock_stock - #{item.productQuantity}
END
WHERE
id IN
#{item.productSkuId}
update oms_order
set status=#{status}
where id in
#{id}
UPDATE pms_sku_stock
SET
lock_stock = CASE id
WHEN #{item.productSkuId} THEN lock_stock - #{item.productQuantity}
END
WHERE
id IN
#{item.productSkuId}
select count(id) totalCount, sum(pay_amount) totalPayAmount, member_id memberId
from oms_order
where 9 > status
group by member_id
select id, pay_amount, status
from oms_order where
date_format(create_time, '%y%m%d') = date_format(#{date}, '%y%m%d')
date_format(create_time,'%y%m')
= date_format(
#{date}
,
'%y%m'
)
select id, name
from building_community
where company_id = #{id}
select id, name
from build_wuye_company
select omo.order_sn orderSn,
omo.create_time createTime,
omo.receiver_phone receiverPhone,
omo.member_username memberUsername,
omo.goods_name goodsName,
omo.total_amount totalAmount,
omo.receiver_detail_address receiverDetailAddress,
case omo.status
when 1 then '支付成功,没有回调'
when 2 then '待发货'
when 3 then '待收货'
when 4 then '待评价'
when 5 then '已完成'
when 6 then '维权中'
when 7 then '维权已完成'
when 8 then '待分享'
when 13 then '申请退款'
when 14 then '已退款'
when 15 then '已关闭'
when 16 then '无效订单'
when 17 then '已删除'
when 12 then '待付款'
end as statusName,
ooi.product_quantity productQuantity,
omo.store_id storeId
from oms_order omo
left join oms_order_item ooi on ooi.order_sn = omo.order_sn
${ew.sqlSegment}