select
*
from
sd.`order` as o
where
o.quantity=#{order.quantity} and o.area=#{order.area} and trim(o.project)=trim(#{order.project}) and o.customer_id=#{order.customerId}
select
ifnull(SUBSTR(max(right(order_id,8)) from 7),0)
from
`order` as a
where
date(a.create_time) = curdate()
/*order by order_id desc,order_id desc limit 1*/
select
ifnull(SUBSTR(max(right(order_id,8)) from 5),0)
from
`order` as a
where
date(a.create_time) BETWEEN DATE_FORMAT(DATE(NOW()), '%Y-%m-01') AND DATE(NOW())
select
ifnull(SUBSTR(max(right(order_id,8)) from 3),0)
from
`order` as a
where
year(a.create_time) = year(now())
and a.id>400
select count(*) from sd.`order` where SUBSTR(order_id,3,11)>#{substringInt}
select count(*) from sd.`order` where SUBSTR(order_id,3,11)=#{substringInt}
select count(*) from sd.`order` where order_id=#{oldOrderId} and SUBSTR(#{oldOrderId},9,2)=01
select count(*) from sd.`order` where order_id=#{oldOrderId} and SUBSTR(#{oldOrderId},7,4)=0001
select count(*) from sd.`order` where order_id=#{oldOrderId} and SUBSTR(#{oldOrderId},5,2)=000001
select * from sd.`order` where order_id=#{orderId}
update sd.`order` set order_id=#{newOrderId} where order_id=#{oldOrderId}
update `order` o
left join
(select a.order_id,
round(sum(a.perimeter),2) as aa,
sum(a.quantity) as b,
sum(a.compute_gross_area) as c,
sum(a.gross_amount) as 'detailAmount'
from sd.order_detail as a group by a.order_id
) as od
on o.order_id = od.order_id
left join (select oom.order_id,
sum(oom.money) as 'money'
from order_other_money as oom
where
oom.order_id = #{orderId}
group by oom.order_id
) as c
on c.order_id = o.order_id
set
o.money = ifnull(od.detailAmount,0)+ifnull(c.money,0),
o.quantity = od.b,
o.area = od.c,
o.perimeter= od.aa,
o.other_money = ifnull(c.money,0),
o.other_remarks = (select group_concat( distinct edging_type) from order_detail where order_id = #{orderId} and edging_type is not null)
where
o.order_id = #{orderId}
select * from (select
o.*,
ifnull(sum(fgi.quantity_available),0) as goodsQuantity,
if(DATEDIFF(o.delivery_date, CURDATE()) < 3 and o.delivery < 2, 'timeOut','' ) as timeOut
from
sd.`order` as o
left join mm.finished_goods_inventory as fgi
on o.order_id = fgi.order_id
where date(o.create_time)>=#{startDate} and date(o.create_time) <= #{endDate}
and o.create_order = #{orderType}
and o.order_id REGEXP #{order.orderId}
and o.customer_id REGEXP #{order.customerId}
and o.customer_name REGEXP #{order.customerName}
and o.project REGEXP #{order.project}
and o.batch REGEXP #{order.batch}
and o.quantity REGEXP #{order.quantity}
and o.area REGEXP REGEXP_REPLACE(#{order.area}, '\\.0+$', '')
and date(o.create_time) = #{order.createTime}
and o.pack_type REGEXP #{order.packType}
and o.order_type REGEXP #{order.orderType}
and o.salesman REGEXP #{order.salesman}
and o.creator REGEXP #{order.creator}
and o.verifier REGEXP #{order.verifier}
and o.perimeter REGEXP #{order.perimeter}
and o.delivery_date REGEXP #{order.deliveryDate}
and o.customer_batch REGEXP #{order.customerBatch}
and o.other_remarks REGEXP #{order.otherRemarks}
and o.delivery_address REGEXP #{order.deliveryAddress}
and o.delivery = #{order.delivery}
and o.process_review = #{order.processReview}
and o.order_review = #{order.orderReview}
and o.production_order = #{order.productionOrder}
and o.processing_card = #{order.processingCard}
and o.warehousing = #{order.warehousing}
and o.processing_note REGEXP #{order.processingNote}
group by o.id
) as acc
order by
order_id desc
${field} desc
${field}
limit #{offset},#{pageSize}
select
CEILING(count(o.id)/#{pageSize}) as 'pageTotal',
count(o.id) as 'dataTotal',
sum(o.quantity) as quantity,
sum(o.area) as area,
sum(o.money) as money,
ifnull(fgi.goodsQuantity ,0) as goodsQuantity ,
ROUND(sum(perimeter),2) as perimeter,
#{pageSize} as pageSize
from
`order` as o
left join(
select order_id,
ifnull(sum(quantity_available),0) as goodsQuantity
from mm.finished_goods_inventory group by order_id
) as fgi
on o.order_id = fgi.order_id
where date (o.create_time)>=#{startDate} and date(o.create_time) <= #{endDate}
and o.create_order = #{orderType}
and o.order_id REGEXP #{order.orderId}
and o.customer_id REGEXP #{order.customerId}
and o.customer_name REGEXP #{order.customerName}
and o.project REGEXP #{order.project}
and o.batch REGEXP #{order.batch}
and o.quantity REGEXP #{order.quantity}
and o.area REGEXP #{order.area}
and date(o.create_time) = #{order.createTime}
and o.pack_type REGEXP #{order.packType}
and o.order_type REGEXP #{order.orderType}
and o.salesman REGEXP #{order.salesman}
and o.creator REGEXP #{order.creator}
and o.verifier REGEXP #{order.verifier}
and o.perimeter REGEXP #{order.perimeter}
and o.delivery_date REGEXP #{order.deliveryDate}
and o.customer_batch REGEXP #{order.customerBatch}
and o.other_remarks REGEXP #{order.otherRemarks}
and o.delivery_address REGEXP #{order.deliveryAddress}
and o.delivery = #{order.delivery}
and o.process_review = #{order.processReview}
and o.order_review = #{order.orderReview}
and o.production_order = #{order.productionOrder}
and o.processing_card = #{order.processingCard}
and o.warehousing = #{order.warehousing}
and o.processing_note REGEXP #{order.processingNote}
order by o.id desc
update `order` set order_review = #{status},
verifier_id = #{userId},
verifier = #{userName},
update_time=now()
where order_id = #{id}
update `order` set order_review = #{status},process_review = #{status},
verifier_id = null,
verifier = null
where order_id = #{id}
update `order` set order_review = 0,
verifier_id = null,
verifier = null
where order_id = #{id}
update `order` set process_review = #{status} where order_id = #{id}
update `order` set money = #{order.money},calculate_type = #{order.calculateType},other_money=#{order.otherMoney} where order_id = #{order.orderId}
update `order` as a set
a.create_order = - a.create_order,
a.process_review = - a.process_review,
a.order_review = - a.order_review,
a.production_order = - a.production_order,
a.processing_card = - a.processing_card,
a.warehousing = - a.warehousing,
a.delivery = - a.delivery
where order_id = #{order.orderId}
update sd.`order` o
set o.printing_number=o.printing_number+1
where
o.order_id = #{orderId}
select a.order_number,count(a.order_number),a.order_id from(select order_id,order_number
from sd.order_glass_detail ogd
where ogd.order_id = #{orderId}
group by ogd.order_number,ogd.child_height,child_width)
as a
group by a.order_number
having count(a.order_number) > 1
select warehousing from `order`
where order_id = #{orderId}
select process_id from pp.optimize_heat_detail as a
where a.project_no = #{projectId}
and a.layout_id = #{layoutId}
and a.sort = #{sort}
select c.order_id as orderId,
b.order_number as orderNumber,
b.technology_number as technologyNumber,
a.process_id as processId,
c.customer_name as customerName,
concat(a.width," * " , a.height) as size,
b.area,
b.glass_child as glassChild,
d.product_name as productName
from pp.optimize_heat_detail as a
left join sd.order_glass_detail as b
on b.order_number = a.order_sort
and b.technology_number = a. layer
and b.order_id = #{orderId}
left join sd.order as c
on c.order_id = b.order_id
left join sd.order_detail as d
on c.order_id = d.order_id
and d.order_number = a.order_sort
where a.project_no = #{projectNo}
and a.layout_id = #{layoutId}
and a.sort = #{sort}