From 4915493db5013f4e0857ac7127616781732c2d6c Mon Sep 17 00:00:00 2001
From: zhangf <1603559716@qq.com>
Date: 星期四, 09 五月 2024 09:54:10 +0800
Subject: [PATCH] spi统计
---
equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml | 57 +++++++++++++++++++++++++++++++++++++++++++++++++++++++--
1 files changed, 55 insertions(+), 2 deletions(-)
diff --git a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml
index e7f4763..49f481a 100644
--- a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml
+++ b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialInfoMapper.xml
@@ -13,6 +13,8 @@
<result column="dep_name" property="depName" jdbcType="VARCHAR"/>
<result column="material_name" property="materilaName" jdbcType="VARCHAR"/>
<result column="consumable" property="consumable" jdbcType="TINYINT"/>
+ <result column="total_count" property="totalCount" jdbcType="INTEGER"/>
+ <result column="stock_count" property="stockCount" jdbcType="INTEGER"/>
<result column="del_flag" property="delFlag" jdbcType="INTEGER"/>
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
<result column="create_uid" property="createUid" jdbcType="BIGINT"/>
@@ -22,8 +24,25 @@
<result column="update_uname" property="updateUname" jdbcType="VARCHAR"/>
</resultMap>
<!--查询单条数据-->
- <select id="queryById" resultMap="materialResult">
- select id,serial_num,small_classify_id,big_classify_id,dep_id,dep_name,material_name,consumable,del_flag,create_time,create_uid,create_uname,update_time,update_uid,update_uname from safe_material where id = #{id} and del_flag = 0;
+ <select id="queryById" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDO">
+ select m.id,
+ m.serial_num,
+ m.big_classify_id as bigClassifyId,
+ m.small_classify_id as smallClassifyId,
+ m.dep_id,
+ m.dep_name,
+ m.material_name,
+ m.consumable,
+ m.stock_count,
+ m.total_count,
+ m.create_time,
+ m.material_name as smallClassifyName,
+ c.material_classify_name as bigClassifyName
+ from safe_material m
+ inner join safe_material_classify c
+ on m.big_classify_id = c.id
+ where m.del_flag = 0
+ and m.id = #{id};
</select>
<!--查询所有数量-->
<select id="getTotalCount" resultType="java.lang.Integer">
@@ -49,6 +68,10 @@
m.dep_name,
m.material_name,
m.consumable,
+ m.stock_count,
+ m.total_count,
+ m.create_time,
+ m.material_name as smallClassifyName,
c.material_classify_name as bigClassifyName
from safe_material m
inner join safe_material_classify c
@@ -59,6 +82,9 @@
</if>
<if test="query.bigClassifyId != null">
and m.big_classify_id = #{query.bigClassifyId}
+ </if>
+ <if test="query.depId != null">
+ and m.dep_id = #{query.depId}
</if>
order by m.create_time desc
</select>
@@ -72,5 +98,32 @@
and id != #{id}
</if>
</select>
+ <update id="updateCountById">
+ update safe_material
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="totalCount != null">
+ total_count = total_count + #{totalCount},
+ </if>
+ <if test="stockCount != null">
+ stock_count = stock_count + #{stockCount},
+ </if>
+ </trim>
+ where id = #{id}
+ </update>
+ <update id="updateStockCount">
+ <foreach collection="safeMaterialBOList" item="safeMaterialBO" separator=";">
+ update safe_material
+ <trim prefix="SET" suffixOverrides=",">
+ <if test="safeMaterialBO.totalCount != null">
+ total_count = total_count + #{safeMaterialBO.totalCount},
+ </if>
+ <if test="safeMaterialBO.stockCount != null">
+ stock_count = stock_count + #{safeMaterialBO.stockCount}
+ </if>
+ </trim>
+ where id = #{safeMaterialBO.id}
+ </foreach>
+
+ </update>
</mapper>
--
Gitblit v1.9.2