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/farm/mapper/FarmingRecordMapper.xml |   30 ++++++++++++++++++++++++++++++
 1 files changed, 30 insertions(+), 0 deletions(-)

diff --git a/src/main/java/org/springblade/modules/farm/mapper/FarmingRecordMapper.xml b/src/main/java/org/springblade/modules/farm/mapper/FarmingRecordMapper.xml
index 3ae5804..b756b23 100644
--- a/src/main/java/org/springblade/modules/farm/mapper/FarmingRecordMapper.xml
+++ b/src/main/java/org/springblade/modules/farm/mapper/FarmingRecordMapper.xml
@@ -22,6 +22,12 @@
         <if test="farmingRecord.operator!=null and farmingRecord.operator!=''">
             and sfr.operator = #{farmingRecord.operator}
         </if>
+        <if test="farmingRecord.deptId!=null and farmingRecord.deptId!=''">
+            and sfr.dept_id = #{farmingRecord.deptId}
+        </if>
+        <if test="farmingRecord.tenantId!=null and farmingRecord.tenantId!=''">
+            and sfr.tenant_id = #{farmingRecord.tenantId}
+        </if>
     </select>
 
     <!--查询统计本年农事记录操作总数-->
@@ -30,4 +36,28 @@
         where 1=1
         and YEAR(time)=YEAR(NOW())
     </select>
+
+    <!--查询统计本年农事记录操作总数-->
+    <select id="getFarmingStatis" resultType="org.springblade.modules.farm.vo.FarmingStatisVO">
+        select
+        case when type=0 then '施肥'
+         when type=1 then '翻耕'
+         when type=2 then '灌溉'
+         when type=3 then '起垄'
+         when type=4 then '用药'
+         when type=5 then '追肥'
+         when type=6 then '除草'
+         when type=7 then '修剪'
+         when type=8 then '浸种'
+         when type=9 then '拌种'
+         when type=10 then '移栽'
+         when type=11 then '直播'
+         when type=12 then '采收'
+         else '其他' end as name,
+        ifnull(count(*),0) value
+        from sys_farming_record
+        where 1=1
+        and YEAR(time)=YEAR(NOW())
+        group by type
+    </select>
 </mapper>

--
Gitblit v1.9.3