From 568b782afa3be4b55f617e7330aa1f2c0e54e693 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Mon, 27 Jun 2022 09:03:01 +0800
Subject: [PATCH] 地块管理
---
src/main/java/org/springblade/modules/stock/mapper/StockMapper.xml | 73 ++++++++++++++++++++++++++----------
1 files changed, 52 insertions(+), 21 deletions(-)
diff --git a/src/main/java/org/springblade/modules/stock/mapper/StockMapper.xml b/src/main/java/org/springblade/modules/stock/mapper/StockMapper.xml
index 41b1581..9ce33e7 100644
--- a/src/main/java/org/springblade/modules/stock/mapper/StockMapper.xml
+++ b/src/main/java/org/springblade/modules/stock/mapper/StockMapper.xml
@@ -116,10 +116,13 @@
WHERE stock_type1 = 1
AND type1 = 0
<if test="stock.startTime!=null and stock.startTime!=''">
- and time1 >= #{stock.startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime}
</if>
<if test="stock.endTime!=null and stock.endTime!=''">
- and time1 <= #{stock.endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime}
+ </if>
+ <if test="stock.deptId!=null and stock.deptId!=''">
+ and dept_id = #{stock.deptId}
</if>
GROUP BY stock_id1) cg ON cg.stock_id1 = a.id
LEFT JOIN (SELECT stock_id1, SUM(census) AS dbrknum
@@ -127,10 +130,13 @@
WHERE stock_type1 = 1
AND type1 = 1
<if test="stock.startTime!=null and stock.startTime!=''">
- and time1 >= #{stock.startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime}
</if>
<if test="stock.endTime!=null and stock.endTime!=''">
- and time1 <= #{stock.endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime}
+ </if>
+ <if test="stock.deptId!=null and stock.deptId!=''">
+ and dept_id = #{stock.deptId}
</if>
GROUP BY stock_id1) dbr ON dbr.stock_id1 = a.id
LEFT JOIN (SELECT stock_id1, SUM(census) AS lycknum
@@ -138,10 +144,13 @@
WHERE stock_type1 = 0
AND type1 = 0
<if test="stock.startTime!=null and stock.startTime!=''">
- and time1 >= #{stock.startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime}
</if>
<if test="stock.endTime!=null and stock.endTime!=''">
- and time1 <= #{stock.endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime}
+ </if>
+ <if test="stock.deptId!=null and stock.deptId!=''">
+ and dept_id = #{stock.deptId}
</if>
GROUP BY stock_id1) lyc ON lyc.stock_id1 = a.id
LEFT JOIN (SELECT stock_id1, SUM(census) AS dbcknum
@@ -149,10 +158,13 @@
WHERE stock_type1 = 0
AND type1 = 1
<if test="stock.startTime!=null and stock.startTime!=''">
- and time1 >= #{stock.startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime}
</if>
<if test="stock.endTime!=null and stock.endTime!=''">
- and time1 <= #{stock.endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime}
+ </if>
+ <if test="stock.deptId!=null and stock.deptId!=''">
+ and dept_id = #{stock.deptId}
</if>
GROUP BY stock_id1) dbc ON dbc.stock_id1 = a.id
LEFT JOIN (SELECT stock_id1, SUM(census) AS bfcknum
@@ -160,10 +172,13 @@
WHERE stock_type1 = 0
AND type1 = 2
<if test="stock.startTime!=null and stock.startTime!=''">
- and time1 >= #{stock.startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{stock.startTime}
</if>
<if test="stock.endTime!=null and stock.endTime!=''">
- and time1 <= #{stock.endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{stock.endTime}
+ </if>
+ <if test="stock.deptId!=null and stock.deptId!=''">
+ and dept_id = #{stock.deptId}
</if>
GROUP BY stock_id1) bfc ON bfc.stock_id1 = a.id
</select>
@@ -175,7 +190,8 @@
sto.type
FROM `sys_stock` st
LEFT JOIN (SELECT id, type FROM sys_stockfactory) sto ON st.stock_id = sto.id
- WHERE st.is_deleted = 0 and dept_id=#{deptId}
+ WHERE st.is_deleted = 0
+ and dept_id = #{deptId}
</select>
<!--小程序数据统计-->
@@ -204,10 +220,13 @@
WHERE stock_type1 = 1
AND type1 = 0
<if test="startTime!=null and startTime!=''">
- and time1 >= #{startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
- and time1 <= #{endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime}
+ </if>
+ <if test="deptId!=null and deptId!=''">
+ and dept_id = #{deptId}
</if>
GROUP BY stock_id1) cg ON cg.stock_id1 = a.id
LEFT JOIN (SELECT stock_id1, SUM(census) AS dbrknum
@@ -215,10 +234,13 @@
WHERE stock_type1 = 1
AND type1 = 1
<if test="startTime!=null and startTime!=''">
- and time1 >= #{startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
- and time1 <= #{endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime}
+ </if>
+ <if test="deptId!=null and deptId!=''">
+ and dept_id = #{deptId}
</if>
GROUP BY stock_id1) dbr ON dbr.stock_id1 = a.id
LEFT JOIN (SELECT stock_id1, SUM(census) AS lycknum
@@ -226,10 +248,13 @@
WHERE stock_type1 = 0
AND type1 = 0
<if test="startTime!=null and startTime!=''">
- and time1 >= #{startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
- and time1 <= #{endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime}
+ </if>
+ <if test="deptId!=null and deptId!=''">
+ and dept_id = #{deptId}
</if>
GROUP BY stock_id1) lyc ON lyc.stock_id1 = a.id
LEFT JOIN (SELECT stock_id1, SUM(census) AS dbcknum
@@ -237,10 +262,13 @@
WHERE stock_type1 = 0
AND type1 = 1
<if test="startTime!=null and startTime!=''">
- and time1 >= #{startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
- and time1 <= #{endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime}
+ </if>
+ <if test="deptId!=null and deptId!=''">
+ and dept_id = #{deptId}
</if>
GROUP BY stock_id1) dbc ON dbc.stock_id1 = a.id
LEFT JOIN (SELECT stock_id1, SUM(census) AS bfcknum
@@ -248,10 +276,13 @@
WHERE stock_type1 = 0
AND type1 = 2
<if test="startTime!=null and startTime!=''">
- and time1 >= #{startTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') >= #{startTime}
</if>
<if test="endTime!=null and endTime!=''">
- and time1 <= #{endTime}
+ and DATE_FORMAT(time1,'%Y-%m-%d') <= #{endTime}
+ </if>
+ <if test="deptId!=null and deptId!=''">
+ and dept_id = #{deptId}
</if>
GROUP BY stock_id1) bfc ON bfc.stock_id1 = a.id
</select>
--
Gitblit v1.9.3