From 8e65eb751d8e3c18d9d2134df084d349e55f1985 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Mon, 15 Aug 2022 11:42:28 +0800
Subject: [PATCH] 首页执行农事操作要使用农资时,农资库存表会进行相应的变化
---
src/main/java/org/springblade/modules/sale/mapper/SaleMapper.xml | 17 +++++++++++++++--
1 files changed, 15 insertions(+), 2 deletions(-)
diff --git a/src/main/java/org/springblade/modules/sale/mapper/SaleMapper.xml b/src/main/java/org/springblade/modules/sale/mapper/SaleMapper.xml
index 343ed91..df266f2 100644
--- a/src/main/java/org/springblade/modules/sale/mapper/SaleMapper.xml
+++ b/src/main/java/org/springblade/modules/sale/mapper/SaleMapper.xml
@@ -43,9 +43,13 @@
LEFT JOIN sys_strain strain on sale.strain_id = strain.id
LEFT JOIN sys_district district on sale.sale_destination = district.code
LEFT JOIN blade_region region on sale.county = region.district_code
+ LEFT JOIN sys_land land ON land.id = sale.land_id
WHERE
<if test="sale.strainId !=null and sale.strainId != '' ">
sale.strain_id = #{sale.strainId} AND
+ </if>
+ <if test="sale.farmId != null and sale.farmId !=''">
+ land.farm_id = #{sale.farmId} AND
</if>
sale.is_deleted = 0 ORDER BY sale.create_time DESC
</select>
@@ -128,8 +132,17 @@
sys_sale sale
LEFT JOIN sys_district dis ON sale.sale_destination = dis.CODE
LEFT JOIN sys_land sl ON sl.id = sale.land_id
- WHERE
- YEAR ( sale_time ) = YEAR ( NOW( ) )
+ WHERE 1 = 1
+ <if test="startTime != null and startTime != ''">
+ and sale_time >= #{startTime}
+ </if>
+ <if test="endTime != null and endTime != ''">
+ and sale_time <= #{endTime}
+ </if>
+ <if test="startTime == null and endTime == null ">
+ and YEAR ( sale_time ) = YEAR ( NOW( ) )
+ </if>
+
<if test="farmId != null and farmId != ''">
and sl.farm_id = #{farmId}
</if>
--
Gitblit v1.9.3