From 53df0151e8f2363d4a110a5f9d6dcbc4229e4f7f Mon Sep 17 00:00:00 2001
From: guoyuji <guoyujie@ng.com>
Date: 星期一, 01 四月 2024 09:26:50 +0800
Subject: [PATCH] 整合文件

---
 north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml |  165 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 163 insertions(+), 2 deletions(-)

diff --git a/north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml b/north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml
index ba1a99b..770d133 100644
--- a/north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml
+++ b/north-glass-erp/src/main/resources/mapper/sd/OrderMapper.xml
@@ -5,18 +5,19 @@
 <mapper namespace="com.example.erp.mapper.sd.OrderMapper">
     <select id="selectMaxOrderId">
         select
-            COUNT(a.order_id)
+           ifnull(SUBSTR(max(order_id) from 9),0)
         from
             `order` as a
         where
             date(a.create_time) = curdate()
+        order by id desc,order_id	desc limit  1
     </select>
     
 
     <update id="updateOrderParameter">
         update `order` o
         left join
-            (select a.order_id,sum(a.perimeter) as aa,sum(a.quantity) as b,sum(a.compute_gross_area)  as c
+            (select a.order_id,round(sum(a.perimeter),2) as aa,sum(a.quantity) as b,sum(a.compute_gross_area)  as c
              from sd.order_detail as a group by a.order_id)  od
             on o.order_id = od.order_id
         set
@@ -27,5 +28,165 @@
             o.order_id = #{orderId}
 
     </update>
+    
+    <select id="getOrderList">
+        select
+            *,
+        sum(fgi.quantity_available) as goodsQuantity
+        from
+            `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) &lt;= #{endDate}
+
+          <if test="orderType!= null and orderType != ''">
+               and o.create_order = #{orderType}
+           </if>
+
+           <if test="order.orderId != null and order.orderId != ''">
+               and o.order_id REGEXP #{order.orderId}
+           </if>
+
+           <if test="order.customerId != null and order.customerId != ''">
+               and o.customer_id REGEXP #{order.customerId}
+           </if>
+           <if test="order.customerName != null and order.customerName != ''">
+               and o.customer_name REGEXP #{order.customerName}
+           </if>
+           <if test="order.project != null and order.project != ''">
+               and o.project REGEXP #{order.project}
+           </if>
+           <if test="order.batch != null and order.batch != ''">
+               and o.batch REGEXP #{order.batch}
+           </if>
+           <if test="order.quantity != null and order.quantity != ''">
+               and o.quantity REGEXP #{order.quantity}
+           </if>
+
+           <if test="order.area != null and order.area != ''">
+               and o.area REGEXP REGEXP_REPLACE(#{order.area}, '\\.0+$', '')
+           </if>
+           <if test="order.createTime != null and order.createTime != ''">
+               and date(o.create_time) = #{order.createTime}
+           </if>
+           <if test="order.packType != null and order.packType != ''">
+               and o.pack_type REGEXP #{order.packType}
+           </if>
+           <if test="order.orderType != null and order.orderType != ''">
+               and o.order_type REGEXP #{order.orderType}
+           </if>
+           <if test="order.salesman != null and order.salesman != ''">
+               and o.salesman REGEXP #{order.salesman}
+           </if>
+
+           <if test="order.perimeter != null and order.perimeter != ''">
+               and o.perimeter REGEXP #{order.perimeter}
+           </if>
+           <if test="order.deliveryDate != null and order.deliveryDate != ''">
+               and o.delivery_date REGEXP #{order.deliveryDate}
+           </if>
+           <if test="order.customerBatch != null and order.customerBatch != ''">
+               and o.customer_batch REGEXP #{order.customerBatch}
+           </if>
+           <if test="order.otherRemarks != null and order.otherRemarks != ''">
+               and o.other_remarks REGEXP #{order.otherRemarks}
+           </if>
+           <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
+               and o.delivery_address REGEXP #{order.deliveryAddress}
+           </if>
+        group by o.id
+        order by o.id desc
+        limit #{offset},#{pageSize}
+    </select>
+
+    <select id="getPageTotal">
+        select
+            CEILING(count(o.id)/#{pageSize}) as 'pageTotal',
+            count(o.id) as 'total'
+        from
+        `order` as o
+        where date (o.create_time)>=#{startDate} and date(o.create_time) &lt;= #{endDate}
+            <if test="orderType!= null and orderType != ''">
+                and o.create_order = #{orderType}
+            </if>
+
+            <if test="order.orderId != null and order.orderId != ''">
+                and o.order_id REGEXP #{order.orderId}
+            </if>
+
+            <if test="order.customerId != null and order.customerId != ''">
+                and o.customer_id REGEXP #{order.customerId}
+            </if>
+            <if test="order.customerName != null and order.customerName != ''">
+                and o.customer_name REGEXP #{order.customerName}
+            </if>
+            <if test="order.project != null and order.project != ''">
+                and o.project REGEXP #{order.project}
+            </if>
+            <if test="order.batch != null and order.batch != ''">
+                and o.batch REGEXP #{order.batch}
+            </if>
+            <if test="order.quantity != null and order.quantity != ''">
+                and o.quantity REGEXP #{order.quantity}
+            </if>
+
+            <if test="order.area != null and order.area != ''">
+                and o.area REGEXP #{order.area}
+            </if>
+            <if test="order.createTime != null and order.createTime != ''">
+                and date(o.create_time) = #{order.createTime}
+            </if>
+            <if test="order.packType != null and order.packType != ''">
+                and o.pack_type REGEXP #{order.packType}
+            </if>
+            <if test="order.orderType != null and order.orderType != ''">
+                and o.order_type REGEXP #{order.orderType}
+            </if>
+            <if test="order.salesman != null and order.salesman != ''">
+                and o.salesman REGEXP #{order.salesman}
+            </if>
+
+            <if test="order.perimeter != null and order.perimeter != ''">
+                and o.perimeter REGEXP #{order.perimeter}
+            </if>
+            <if test="order.deliveryDate != null and order.deliveryDate != ''">
+                and o.delivery_date REGEXP #{order.deliveryDate}
+            </if>
+            <if test="order.customerBatch != null and order.customerBatch != ''">
+                and o.customer_batch REGEXP #{order.customerBatch}
+            </if>
+            <if test="order.otherRemarks != null and order.otherRemarks != ''">
+                and o.other_remarks REGEXP #{order.otherRemarks}
+            </if>
+            <if test="order.deliveryAddress != null and order.deliveryAddress != ''">
+                and o.delivery_address REGEXP #{order.deliveryAddress}
+            </if>
+        order by o.id desc
+        limit #{offset},#{pageSize}
+    </select>
+    
+    <update id="reviewOrderById">
+        update `order` set order_review = #{status} where order_id = #{id}
+    </update>
+
+    <update id="reviewProcessById">
+        update `order` set process_review = #{status} where order_id = #{id}
+    </update>
+
+    <update id="updateMoney">
+        update `order` set money = #{order.money} where order_id = #{order.orderId}
+    </update>
+
+    <update id="cancelOrder">
+        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>
 
 </mapper>
\ No newline at end of file

--
Gitblit v1.8.0