delete from sd.delivery where delivery_id=#{deliveryId}
update sd.delivery set delivery_state=#{deliveryState} where delivery_id=#{deliveryId}
update sd.delivery set area=#{area},quantity=#{quantity},money=#{money} where delivery_id=#{oddNumber}
select count(*) from sd.delivery where date(create_time)=CURDATE()
select count(*) from sd.delivery where delivery_id=#{deliveryId}
insert into sd.delivery(delivery_state,stock_state,payment_terms,delivery_id,order_id,project,customer_id,customer_name,
delivery_date,pay_method,pay_date,salesman_id,salesman,creator_id,creator,contacts,contact_number,delivery_address,
area,quantity,money,remarks,create_time)
values (
0,0,#{delivery.paymentTerms},#{number} ,#{orderId},#{delivery.project},#{delivery.customerId},#{delivery.customerName},#{delivery.deliveryDate},#{delivery.payMethod},
#{delivery.payDate},#{delivery.salesmanId},#{delivery.salesman},#{delivery.creatorId},#{delivery.creator},#{delivery.contacts},#{delivery.contactNumber},#{delivery.deliveryAddress},
0,0,0,#{delivery.remarks},now()
)
select o.create_order,
o.process_review,
o.order_review,
o.production_order,
o.processing_card,
o.warehousing,
o.delivery,
o.order_id,
o.customer_id,
o.customer_name,
o.quantity,
sum(fgi.quantity_available) as quantity_available,
o.project,
o.batch,
o.money,
o.area,
o.create_time,
o.pack_type,
o.order_type,
o.creator
from sd.`order` o
left join mm.finished_goods_inventory fgi on o.order_id = fgi.order_id
fgi.quantity_available > 0 and date(o.create_time)>=#{startDate} and date(o.create_time) <= #{endDate}
and o.order_id REGEXP #{order.orderId}
and o.customer_id REGEXP #{order.customerId}
and o.customer_name REGEXP #{order.customerName}
and o.quantity REGEXP #{order.quantity}
and o.project REGEXP #{order.project}
and o.batch REGEXP #{order.batch}
and o.money REGEXP REGEXP_REPLACE(#{order.money},'\\.0+$','')
and o.area REGEXP REGEXP_REPLACE(#{order.area},'\\.0+$','')
and o.pack_type REGEXP #{order.packType}
and o.order_type REGEXP #{order.orderType}
and o.creator REGEXP #{order.creator}
and o.create_time REGEXP #{order.createTime}
and fgi.quantity_available REGEXP #{order.finishedGoodsInventory.quantityAvailable}
group by o.order_id order by o.id desc
limit #{offset},#{pageSize};
select CEILING(count(zu.order_id)/#{pageSize}) as 'pageTotal',
count(zu.order_id) as 'total' from
(select o.create_order,o.process_review,o.order_review,o.production_order,
o.processing_card,o.warehousing,o.delivery,o.order_id,o.customer_id,
o.customer_name,o.quantity,sum(fgi.quantity_available),o.project,o.batch,
o.money,o.area,o.create_time,o.pack_type,o.order_type,o.creator
from sd.`order` o left join mm.finished_goods_inventory fgi on o.order_id=fgi.order_id
fgi.quantity_available > 0 and date(o.create_time)>=#{startDate} and date(o.create_time) <= #{endDate}
and o.order_id REGEXP #{order.orderId}
and o.customer_id REGEXP #{order.customerId}
and o.customer_name REGEXP #{order.customerName}
and o.quantity REGEXP #{order.quantity}
and o.project REGEXP #{order.project}
and o.batch REGEXP #{order.batch}
and o.money REGEXP REGEXP_REPLACE(#{order.money},'\\.0+$','')
and o.area REGEXP REGEXP_REPLACE(#{order.area},'\\.0+$','')
and o.pack_type REGEXP #{order.packType}
and o.order_type REGEXP #{order.orderType}
and o.creator REGEXP #{order.creator}
and o.create_time REGEXP #{order.createTime}
and fgi.quantity_available REGEXP #{order.finishedGoodsInventory.quantityAvailable}
group by o.order_id limit #{offset},#{pageSize}) as zu;
select
d.delivery_state,d.stock_state,d.payment_terms,
d.customer_id,d.customer_name,d.project,d.pay_method,d.pay_date,d.contacts,d.contact_number,
d.delivery_address,d.remarks,d.create_time,d.delivery_date,d.creator,d.salesman,d.salesman_id
from sd.delivery d
and d.delivery_id regexp #{orderDetail.deliveryDetail.deliveryId}
limit 0,1
select
d.delivery_id,d.quantity,d.money,d.area,
d.customer_id,d.customer_name,d.project,d.pay_method,d.pay_date,d.contacts,d.contact_number,
d.delivery_address,d.remarks,d.create_time,d.delivery_date,d.creator,d.salesman,d.salesman_id
from sd.delivery d
and d.delivery_id like concat('%',#{deliveryDetail.deliveryId},'%')
select customer_id,customer_name,project,salesman,salesman_id,contacts,contact_number,delivery_address from sd.`order`
and order_id regexp #{orderDetail.orderId}
limit 0,1
select * from sd.delivery d
date(d.create_time)>=#{startDate} and date(d.create_time) <= #{endDate}
and d.delivery_id regexp #{delivery.deliveryId}
and d.creator regexp #{delivery.creator}
and d.delivery_date regexp #{delivery.deliveryDate}
and d.customer_id regexp #{delivery.customerId}
and d.customer_name regexp #{delivery.customerName}
and d.project regexp #{delivery.project}
and d.order_id regexp #{delivery.orderId}
and d.pay_method regexp #{delivery.payMethod}
and d.quantity regexp #{delivery.quantity}
and d.area regexp REGEXP_REPLACE(#{delivery.area},'\\.0+$','')
order by d.id desc
limit #{offset},#{pageSize};
select
CEILING(count(id)/#{pageSize}) as 'pageTotal',
count(id) as 'total'
from sd.delivery d
date(d.create_time)>=#{startDate} and date(d.create_time) <= #{endDate}
and d.delivery_id regexp #{delivery.deliveryId}
and d.creator regexp #{delivery.creator}
and d.delivery_date regexp #{delivery.deliveryDate}
and d.customer_id regexp #{delivery.customerId}
and d.customer_name regexp #{delivery.customerName}
and d.project regexp #{delivery.project}
and d.order_id regexp #{delivery.orderId}
and d.pay_method regexp #{delivery.payMethod}
and d.quantity regexp #{delivery.quantity}
and d.area regexp REGEXP_REPLACE(#{delivery.area},'\\.0+$','')
limit #{offset},#{pageSize};