From 0621dc7f7121a8b2a2a785687ec1fc8d0a8d3d45 Mon Sep 17 00:00:00 2001
From: wang..123 <brook_w@163.com>
Date: 星期二, 08 三月 2022 16:23:18 +0800
Subject: [PATCH] #

---
 src/main/resources/mapper/LocDetlMapper.xml |   38 +++++++++++++++++++++++++++++++++-----
 1 files changed, 33 insertions(+), 5 deletions(-)

diff --git a/src/main/resources/mapper/LocDetlMapper.xml b/src/main/resources/mapper/LocDetlMapper.xml
index c5c38c7..e72c016 100644
--- a/src/main/resources/mapper/LocDetlMapper.xml
+++ b/src/main/resources/mapper/LocDetlMapper.xml
@@ -57,6 +57,18 @@
         </if>
     </sql>
 
+    <sql id="stockOutCondition1">
+    <if test="mat_no!=null and mat_no!='' ">
+        and mat_no like '%' + #{mat_no} + '%'
+    </if>
+    <if test="mat_name!=null and mat_name!='' ">
+        and mat_name like '%' + #{mat_name} + '%'
+    </if>
+    <if test="str3!=null and str3!=''" >
+        and str3 like '%'+#{str3}+'%'
+    </if>
+    </sql>
+
     <select id="getStockOutPage" resultMap="BaseResultMap">
         select * from
         (
@@ -96,15 +108,31 @@
         where loc_no=#{locNo}
     </select>
     <select id="getStockStatis" resultMap="BaseResultMap">
-        select a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty  from
+<!--        select a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty  from-->
+<!--        (-->
+<!--        select-->
+<!--        ROW_NUMBER() over (order by c.appe_time,c.mat_no,c.loc_no) as row,-->
+<!--        c.*-->
+<!--        from asr_loc_detl c-->
+<!--        ) a where a.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})-->
+<!--         <include refid="stockOutCondition"></include>-->
+<!--        group by a.mat_no,a.mat_name,a.supplier,a.str3-->
+
+        select * from
+        (
+        select ROW_NUMBER() over (order by a.mat_no) as row,
+        a.mat_name,a.mat_no,a.supplier,a.str3,sum(a.qty) qty  from
         (
         select
-        ROW_NUMBER() over (order by c.appe_time,c.mat_no,c.loc_no) as row,
-        c.*
+        mat_name,mat_no,supplier,str3,qty
         from asr_loc_detl c
-        ) a where a.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
-         <include refid="stockOutCondition"></include>
+        where 1=1
+        <include refid="stockOutCondition1"></include>
+        ) a
         group by a.mat_no,a.mat_name,a.supplier,a.str3
+        ) d
+        where 1=1
+        and row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
     </select>
     <select id="getStockStatisCount" resultType="integer">
         select

--
Gitblit v1.9.1