From 4d60a2ee6bbfe76e2740307c832c8f309090a41e Mon Sep 17 00:00:00 2001
From: guoshilong <123456>
Date: Fri, 19 Aug 2022 10:42:06 +0800
Subject: [PATCH] 加工产品在销售记录表和损耗记录表中加上相应的地块
---
src/main/java/org/springblade/modules/soldr/mapper/SoldrMapper.xml | 76 +++++++++++++++++++++++++++++++++++--
1 files changed, 71 insertions(+), 5 deletions(-)
diff --git a/src/main/java/org/springblade/modules/soldr/mapper/SoldrMapper.xml b/src/main/java/org/springblade/modules/soldr/mapper/SoldrMapper.xml
index fe8eca5..87c6b5a 100644
--- a/src/main/java/org/springblade/modules/soldr/mapper/SoldrMapper.xml
+++ b/src/main/java/org/springblade/modules/soldr/mapper/SoldrMapper.xml
@@ -29,7 +29,7 @@
</select>
<select id="selectLists" resultType="org.springblade.modules.soldr.vo.SoldrVO">
- SELECT st.stock_id1,
+ SELECT st.id,st.stock_id1,
st.specs1,
st.sid,
st.amount1 AS amount1,
@@ -37,16 +37,24 @@
a.dict_value AS stype,
d.dict_value AS dic1,
c.dict_value AS dic2,
- stf.agricultural_name as agrname
+ stf.agricultural_name as agrname,
+ st.dept_id
FROM sys_soldr st
LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_id1
LEFT JOIN (SELECT dict_key, dict_value
FROM blade_dict_biz
- WHERE CODE = 'stockSpecs1' AND is_deleted = 0) d ON d.dict_key = st.specs_val1
+ WHERE CODE = 'stockSpecs1' AND is_deleted = 0 <if test="soldr.codes!=null and soldr.codes != ''">
+ AND blade_dict_biz.tenant_id = #{soldr.codes}
+ </if>) d ON d.dict_key = st.specs_val1
LEFT JOIN (SELECT dict_key, dict_value
FROM blade_dict_biz
- WHERE CODE = 'stockSpecs2' AND is_deleted = 0) c ON c.dict_key = st.specs_val2
- LEFT JOIN ( SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'stockType' AND is_deleted = 0 ) a ON
+ WHERE CODE = 'stockSpecs2' AND is_deleted = 0 <if test="soldr.codes!=null and soldr.codes != ''">
+ AND blade_dict_biz.tenant_id = #{soldr.codes}
+ </if>) c ON c.dict_key = st.specs_val2
+ LEFT JOIN ( SELECT dict_key, dict_value FROM blade_dict_biz WHERE CODE = 'stockType' AND is_deleted = 0 <if
+ test="soldr.codes!=null and soldr.codes != ''">
+ AND blade_dict_biz.tenant_id = #{soldr.codes}
+ </if>) a ON
a.dict_key = stf.type
WHERE st.is_deleted = 0
<if test="soldr.stype!=null and soldr.stype != ''">
@@ -55,6 +63,9 @@
<if test="soldr.stockId1!=null and soldr.stockId1 != ''">
and st.stock_id1 = #{soldr.stockId1}
</if>
+ <if test="soldr.deptId != null and soldr.deptId !=''">
+ AND st.dept_id = #{soldr.deptId}
+ </if>
</select>
<delete id="del">
@@ -62,4 +73,59 @@
from sys_soldr
where sid = #{id}
</delete>
+
+ <delete id="dels">
+ delete
+ from sys_soldr
+ where id = #{id}
+ </delete>
+
+ <!--已出农资列表-->
+ <select id="selectSol" resultType="org.springblade.modules.soldr.vo.SoldrVO">
+ SELECT st.id,
+ st.stock_id1,
+ st.specs1,
+ st.sid,
+ st.amount1 AS amount1,
+ stf.factory_name AS factoryName,
+ a.dict_value AS stype,
+ d.dict_value AS dic1,
+ c.dict_value AS dic2,
+ stf.agricultural_name as agrname
+ FROM sys_soldr st
+ LEFT JOIN sys_stockfactory stf ON stf.id = st.stock_id1
+ LEFT JOIN (SELECT dict_key, dict_value
+ FROM blade_dict_biz
+ WHERE CODE = 'stockSpecs1'
+ AND is_deleted = 0) d ON d.dict_key = st.specs_val1
+ LEFT JOIN (SELECT dict_key, dict_value
+ FROM blade_dict_biz
+ WHERE CODE = 'stockSpecs2'
+ AND is_deleted = 0) c ON c.dict_key = st.specs_val2
+ LEFT JOIN (SELECT dict_key, dict_value
+ FROM blade_dict_biz
+ WHERE CODE = 'stockType' AND is_deleted = 0) a ON
+ a.dict_key = stf.type
+ WHERE st.is_deleted = 0
+ <if test="farmId != null and farmId !=''">
+ AND st.dept_id = #{farmId}
+ </if>
+ </select>
+
+ <!--查询是否存在已出库农资-->
+ <select id="selectCz" resultType="java.util.Map">
+ SELECT census, sid, amount1
+ FROM `sys_soldr`
+ WHERE sid = #{sid} AND dept_id = #{deptId}
+ </select>
+<!-- 根据stockId、specs1、specs_val1、specs_val2、sid-->
+ <select id="getByServalParam" resultType="org.springblade.modules.soldr.entity.Soldr">
+ SELECT * FROM sys_soldr WHERE
+ stock_id1 = #{stockId1} and specs1=#{specs1} and specs_val1=#{specsVal1} and specs_val2=#{specsVal2} and sid=#{sid} and type=#{type} and is_deleted=0
+ </select>
+
+ <update id="cancelDel">
+ UPDATE sys_soldr SET is_deleted = 0 WHERE id = #{id}
+ </update>
+
</mapper>
--
Gitblit v1.9.3