From fe371739b664c4e87914bcc7f3f550fec7e93121 Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Thu, 18 Aug 2022 11:42:27 +0800
Subject: [PATCH] 保留农资退回记录,修复当农资库存为1时出库再退回,农资库存数据有误
---
src/main/java/org/springblade/modules/recovery/mapper/RecoveryMapper.xml | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/src/main/java/org/springblade/modules/recovery/mapper/RecoveryMapper.xml b/src/main/java/org/springblade/modules/recovery/mapper/RecoveryMapper.xml
index 802bc44..7d3f7b1 100644
--- a/src/main/java/org/springblade/modules/recovery/mapper/RecoveryMapper.xml
+++ b/src/main/java/org/springblade/modules/recovery/mapper/RecoveryMapper.xml
@@ -4,10 +4,14 @@
<!--自定义查询采收记录分页数据-->
<select id="selectRecoveryPage" resultType="org.springblade.modules.recovery.vo.RecoveryVO">
- select sr.*,sl.land_name landName,ss.strain_name strainName from sys_recovery sr
+ select sr.*,sl.land_name landName,ss.strain_name strainName,user.real_name as realName from sys_recovery sr
left join sys_land sl on sl.id = sr.land_id
left join sys_strain ss on ss.id = sr.strain_id
+ left join blade_user user ON user.id = sr.operator
where 1=1
+ <if test="recovery.strainName!=null and recovery.strainName!=''">
+ and ss.strain_name like concat ('%',#{recovery.strainName},'%')
+ </if>
<if test="recovery.strainId!=null and recovery.strainId!=''">
and sr.strain_id = #{recovery.strainId}
</if>
@@ -23,12 +27,13 @@
<if test="recovery.operator!=null and recovery.operator!=''">
and sr.operator = #{recovery.operator}
</if>
- <if test="recovery.deptId!=null and recovery.deptId!=''">
- and sr.dept_id = #{recovery.deptId}
+ <if test="recovery.farmId != null and recovery.farmId != ''">
+ and sl.farm_id = #{recovery.farmId}
</if>
<if test="recovery.tenantId!=null and recovery.tenantId!=''">
and sr.tenant_id = #{recovery.tenantId}
</if>
+ ORDER BY sr.create_time DESC
</select>
<!--查询当前前缀已有的溯源码编号,取倒数7位的最大值-->
@@ -39,15 +44,16 @@
<!--查询农产品采收记录信息-->
<select id="getRecoveryDetail" resultType="org.springblade.modules.recovery.vo.RecoveryVO">
- select sr.id,sr.strain_id strainId,sr.land_id landId,sr.time,ss.strain_name strainName,ss.url,
+ select sr.id,sr.strain_id strainId,sr.land_id landId,sr.time,ss.strain_name strainName,ss.url,sr.farm_plant_id farmPlantId,
case
when sfp.plant = '0' then '有机'
when sfp.plant = 1 then '绿色'
when sfp.plant = 2 then '无公害'
- else '普通' end as lx
- from sys_recovery sr
+ else '普通' end as lx,
+ sl.farm_id farmId from sys_recovery sr
left join sys_strain ss on sr.strain_id = ss.id
left join sys_farm_plant sfp on sfp.id = sr.farm_plant_id
+ left join sys_land sl on sl.id = sr.land_id
where sr.id = #{recoveryId}
</select>
</mapper>
--
Gitblit v1.9.3