From 8e36d6e7a2837df41b35ca46bd3678cc1a8d0533 Mon Sep 17 00:00:00 2001
From: Administrator <876263681@qq.com>
Date: 星期一, 30 十二月 2024 08:06:15 +0800
Subject: [PATCH] #导出优化,低库位满时,低库位的货往高库位寻找

---
 src/main/resources/mapper/ViewWorkInMapper.xml |  180 ++++++++++++++++++++++++++++++++++++++++++++++-------------
 1 files changed, 140 insertions(+), 40 deletions(-)

diff --git a/src/main/resources/mapper/ViewWorkInMapper.xml b/src/main/resources/mapper/ViewWorkInMapper.xml
index 1adbe97..8086065 100644
--- a/src/main/resources/mapper/ViewWorkInMapper.xml
+++ b/src/main/resources/mapper/ViewWorkInMapper.xml
@@ -99,59 +99,159 @@
 
 <!-- 涓嶅垎椤垫煡璇㈡墍鏈変俊鎭紝鐢ㄤ簬excel瀵煎嚭 -->
 <select id="getViewWorkInAll" parameterType="com.zy.asrs.entity.ViewWorkInBean" resultType="com.zy.asrs.entity.ViewWorkInBean">
-select * from asr_wrkin_view a
-<where>
-	<![CDATA[
- 		1=1
- 	]]>
+<!--	select count(1)-->
+<!--	from asr_wrkin_view a-->
+<!--	where 1=1-->
+<!--	<include refid="viewWorkInConditionSql"></include>-->
+	select * from asr_wrkin_view
+	where 1=1
 	<include refid="viewWorkInConditionSql"></include>
-	<![CDATA[
-		order by io_time desc
-	]]>
-</where>
 </select>
 
 <!-- 鍑哄簱缁熻 -->
 <!-- 鍒嗛〉鏌ヨ鎵�鏈変俊鎭� -->
 <select id="queryViewWorkOutList" parameterType="com.zy.asrs.entity.ViewWorkInBean" resultType="com.zy.asrs.entity.ViewWorkInBean">
-select * from (
-select *,ROW_NUMBER() OVER(Order by io_time desc) as rowid
- from asr_wrkout_view
-<where>
-	1=1
- 	<include refid="viewWorkOutConditionSql"></include>
-</where>
- ) as a
-<where>
-	rowid between ((#{pageNumber}-1)*#{pageSize}) and (#{pageNumber}*#{pageSize})
-	<![CDATA[
-		order by io_time desc
-	]]>
-</where>
+
+
+	select
+	*
+	from (
+		select
+		ROW_NUMBER() OVER(Order by t.io_time desc) as row
+		, *
+		from (
+			select *
+			from asr_wrkout_view
+			where 1=1
+			<include refid="viewWorkInConditionSql"></include>
+		) t
+	) a where 1=1 and a.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+
 </select>
 
 <select id="getViewWorkOutCount" parameterType="com.zy.asrs.entity.ViewWorkInBean"	resultType="Integer">
-select count(1) from asr_wrkout_view a
-<where>
-<![CDATA[
-	1=1
-]]>
-<include refid="viewWorkOutConditionSql"></include>
-</where>
+	select count(1)
+	from asr_wrkout_view a
+	where 1=1
+	<include refid="viewWorkInConditionSql"></include>
 </select>
 
 <!-- 涓嶅垎椤垫煡璇㈡墍鏈変俊鎭紝鐢ㄤ簬excel瀵煎嚭 -->
 <select id="getViewWorkOutAll" parameterType="com.zy.asrs.entity.ViewWorkInBean" resultType="com.zy.asrs.entity.ViewWorkInBean">
-select * from asr_wrkout_view a
-<where>
-	<![CDATA[
- 		1=1
- 	]]>
-	<include refid="viewWorkOutConditionSql"></include>
-	<![CDATA[
-		order by io_time desc
-	]]>
-</where>
+	select *
+	from asr_wrkout_view a
+	where 1=1
+	<include refid="viewWorkInConditionSql"></include>
+	Order by a.io_time desc
+</select>
+<sql id="viewWorkInTtlConditionSql">
+
+	<if test="matnr!=null and matnr!='' ">
+		and matnr like '%' + #{matnr} + '%'
+	</if>
+	<if test="maktx!=null and maktx!='' ">
+		and (maktx like '%' + #{maktx} + '%'
+		or matnr like '%' + #{maktx} + '%'
+		or maktx like '%' + #{maktx} + '%'
+		or specs like '%' + #{maktx} + '%'
+		or anfme like '%' + #{maktx} + '%'
+		or batch like '%' + #{maktx} + '%'
+		or brand like '%' + #{maktx} + '%'
+		or unit like '%' + #{maktx} + '%'
+		)
+	</if>
+	<if test="begin_date!=null and begin_date!='' ">
+		<![CDATA[
+		and io_date >= #{begin_date}
+		]]>
+	</if>
+	<if test="end_date!=null and end_date!='' ">
+		<![CDATA[
+		and io_date <= #{end_date}
+		]]>
+	</if>
+</sql>
+<sql id="viewWorkOutTtlConditionSql">
+
+	<if test="matnr!=null and matnr!='' ">
+		and matnr like '%' + #{matnr} + '%'
+	</if>
+	<if test="maktx!=null and maktx!='' ">
+		and (maktx like '%' + #{maktx} + '%'
+		or matnr like '%' + #{maktx} + '%'
+		or maktx like '%' + #{maktx} + '%'
+		or specs like '%' + #{maktx} + '%'
+		or anfme like '%' + #{maktx} + '%'
+		or batch like '%' + #{maktx} + '%'
+		or brand like '%' + #{maktx} + '%'
+		or unit like '%' + #{maktx} + '%'
+		)
+	</if>
+	<if test="begin_date!=null and begin_date!='' ">
+		<![CDATA[
+		and io_date >= #{begin_date}
+		]]>
+	</if>
+	<if test="end_date!=null and end_date!='' ">
+		<![CDATA[
+		and io_date <= #{end_date}
+		]]>
+	</if>
+</sql>
+<select id="queryViewWorkInTtlList" parameterType="com.zy.asrs.entity.ViewWorkInAllBean" resultType="com.zy.asrs.entity.ViewWorkInAllBean">
+	select
+	*
+	from (
+	select
+	ROW_NUMBER() OVER(Order by t.io_date desc) as row
+	, *
+	from (
+	select *
+	from asr_wrkin_ttl_view
+	where 1=1
+	<include refid="viewWorkInTtlConditionSql"></include>
+	) t
+	) a where 1=1 and a.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
 </select>
 
+<select id="getViewWorkInTtlCount" parameterType="com.zy.asrs.entity.ViewWorkInAllBean"	resultType="Integer">
+	select count(1)
+	from asr_wrkin_ttl_view a
+	where 1=1
+	<include refid="viewWorkInTtlConditionSql"></include>
+</select>
+<select id="getViewWorkInTtlAll" parameterType="com.zy.asrs.entity.ViewWorkInAllBean" resultType="com.zy.asrs.entity.ViewWorkInAllBean">
+	select * from asr_wrkin_ttl_view
+	where 1=1
+	<include refid="viewWorkInTtlConditionSql"></include>
+</select>
+
+<select id="queryViewWorkOutTtlList" parameterType="com.zy.asrs.entity.ViewWorkInAllBean" resultType="com.zy.asrs.entity.ViewWorkInAllBean">
+	select
+	*
+	from (
+	select
+	ROW_NUMBER() OVER(Order by t.io_date desc) as row
+	, *
+	from (
+	select *
+	from asr_wrkout_ttl_view
+	where 1=1
+	<include refid="viewWorkInTtlConditionSql"></include>
+	) t
+	) a where 1=1 and a.row between ((#{pageNumber}-1)*#{pageSize}+1) and (#{pageNumber}*#{pageSize})
+</select>
+<select id="getViewWorkOutTtlCount" parameterType="com.zy.asrs.entity.ViewWorkInAllBean"	resultType="Integer">
+	select count(1)
+	from asr_wrkout_ttl_view a
+	where 1=1
+	<include refid="viewWorkInTtlConditionSql"></include>
+</select>
+<select id="getViewWorkOutTtlAll" parameterType="com.zy.asrs.entity.ViewWorkInAllBean" resultType="com.zy.asrs.entity.ViewWorkInAllBean">
+	select *
+	from asr_wrkout_ttl_view a
+	where 1=1
+	<include refid="viewWorkInTtlConditionSql"></include>
+	Order by a.io_date desc
+</select>
 </mapper>

--
Gitblit v1.9.1