From e71881a6ade967e45ba62b802028e2a2d2dfdee0 Mon Sep 17 00:00:00 2001
From: tangzy <tangzy123456>
Date: Wed, 15 Jun 2022 18:05:07 +0800
Subject: [PATCH] 农资库存管理

---
 src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml |   29 +++++++++++++++++++++++++----
 1 files changed, 25 insertions(+), 4 deletions(-)

diff --git a/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml b/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
index 57558d9..722dbf8 100644
--- a/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
+++ b/src/main/java/org/springblade/modules/lang/mapper/LandMapper.xml
@@ -38,6 +38,15 @@
         <if test="land.landName!=null and land.landName != ''">
             and l.land_name like concat('%', #{land.landName},'%')
         </if>
+        <if test="land.deptId!=null and land.deptId != ''">
+            and l.dept_id=#{land.deptId}
+        </if>
+        <if test="land.type!=null and land.type != ''">
+            and l.type=#{land.type}
+        </if>
+        <if test="land.tenantId!=null and land.tenantId != ''">
+            and l.tenant_id =#{land.tenantId}
+        </if>
     </select>
 
     <insert id="saveLandInfo">
@@ -90,26 +99,38 @@
     <select id="selectZAre" resultType="java.util.HashMap">
         SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit
         FROM sys_land
-        WHERE is_deleted = 0 and  dept_id=#{deprId}
+        WHERE is_deleted = 0
+        <if test="deptId!= null and deptId!=''">
+            and dept_id=#{deptId}
+        </if>
     </select>
     <!--土地使用面积-->
     <select id="selectSAre" resultType="java.util.HashMap">
         SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit
         FROM sys_land
         WHERE is_deleted = 0
-          and type = 0 and  dept_id=#{deprId}
+        and type = 0
+        <if test="deptId!= null and deptId!=''">
+            and dept_id=#{deptId}
+        </if>
     </select>
     <!--土地未使用面积-->
     <select id="selectWAre" resultType="java.util.HashMap">
         SELECT IFNULL(land_area, 0) as area, IFNULL(land_unit, 0) as unit
         FROM sys_land
         WHERE is_deleted = 0
-          and type = 1 and  dept_id=#{deprId}
+        and type = 1
+        <if test="deptId!= null and deptId!=''">
+            and dept_id=#{deptId}
+        </if>
     </select>
     <select id="selectNum" resultType="java.util.HashMap">
         SELECT strain_id
         FROM `sys_farm_plant`
-        WHERE status = 1 and dept_id=#{deprId}
+        WHERE status = 1
+        <if test="deptId!= null and deptId!=''">
+            and dept_id=#{deptId}
+        </if>
         GROUP BY strain_id
     </select>
 

--
Gitblit v1.9.3