From f600f38c6c23a282b61ed4db1b2da094d695276f Mon Sep 17 00:00:00 2001
From: zhangfeng <1603559716@qq.com>
Date: 星期五, 25 十一月 2022 16:43:52 +0800
Subject: [PATCH] 安全物资和设备管理调整
---
equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml | 99 ++++++++++++++++++++++++++++++++++++++++++++-----
1 files changed, 88 insertions(+), 11 deletions(-)
diff --git a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml
index b79af4a..8394b25 100644
--- a/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml
+++ b/equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml
@@ -8,7 +8,8 @@
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="name" property="name" jdbcType="VARCHAR"/>
<result column="material_no" property="materialNo" jdbcType="VARCHAR"/>
- <result column="material_classify_id" property="materialClassifyId" jdbcType="BIGINT"/>
+ <result column="big_classify_id" property="bigClassifyId" jdbcType="BIGINT"/>
+ <result column="small_classify_id" property="smallClassifyId" jdbcType="BIGINT"/>
<result column="rfid" property="rfid" jdbcType="VARCHAR"/>
<result column="consumable" property="consumable" jdbcType="TINYINT"/>
<result column="valid_type" property="validType" jdbcType="TINYINT"/>
@@ -34,9 +35,9 @@
</select>
<select id="queryById" resultMap="materialDetailResult">
select id,
- name,
+ CONCAT(name,'(ID',sm_id,')') as name,
material_no,
- material_classify_id,
+ big_classify_id,
rfid,
consumable,
valid_type,
@@ -60,7 +61,7 @@
where id = #{id}
</update>
<select id="getListByIds" resultMap="materialDetailResult">
- select id,name,material_no,material_classify_id,rfid,consumable,valid_type,valid_time,valid_status,ir_status,ware_housing_time,ware_housing_time,delivery_time,sm_id,claimant_id,claimant_name
+ select id,name,material_no,big_classify_id,rfid,consumable,valid_type,valid_time,valid_status,ir_status,ware_housing_time,ware_housing_time,delivery_time,sm_id,claimant_id,claimant_name
from safe_material_detail
where del_flag = 0
and id in
@@ -130,8 +131,10 @@
claimant_name = #{detailBO.claimantName},
delivery_time = #{detailBO.deliveryTime}
where id in
- (select t.id from (select id from safe_material_detail where ir_status = 0 and valid_status = 0 and del_flag = 0 ORDER BY ware_housing_time asc LIMIT #{detailBO.count}) t
- )
+ <foreach collection="detailBO.ids" item="id" separator="," open="(" close=")" >
+ #{id}
+ </foreach>
+
</update>
<select id="getValidStockCount" resultType="java.lang.Integer">
@@ -144,9 +147,9 @@
</select>
<select id="listByCondition" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfoDO">
select sd.id,
- sd.name,
+ CONCAT(sd.name,'(ID',sd.sm_id,')') as name,
sd.material_no,
- sd.material_classify_id,
+ sd.big_classify_id,
sd.rfid,
sd.consumable,
sd.valid_type,
@@ -158,16 +161,20 @@
sd.delivery_time,
sm.dep_id,
sm.dep_name,
- sc.material_classify_name
+ sd.sm_id,
+ sc.material_classify_name as bigClassifyName
from safe_material_detail sd
- INNER JOIN safe_material_classify sc on sd.material_classify_id = sc.id
+ INNER JOIN safe_material_classify sc on sd.big_classify_id = sc.id
INNER JOIN safe_material sm on sd.sm_id = sm.id
where sd.del_flag = 0
<if test="query.rfid != null and query.rfid != '' ">
and sd.rfid = #{query.rfid}
</if>
- <if test="query.irStatus != null and query.irStatus != '' or query.irStatus == 0">
+ <if test="query.irStatus != null">
and sd.ir_status = #{query.irStatus}
+ </if>
+ <if test="query.smId != null">
+ and sd.sm_id = #{query.smId}
</if>
ORDER BY sd.create_time desc
</select>
@@ -187,4 +194,74 @@
<update id="updateValidStatus" >
update safe_material_detail set valid_status = #{validStatus} where id = #{id}
</update>
+ <select id="getRfidNotNullList" resultType="java.lang.Long">
+ select id from safe_material_detail where sm_id = #{smId} and ir_status = 0 and valid_status = 0 and del_flag = 0 and rfid is not null ORDER BY ware_housing_time asc LIMIT #{count}
+ </select>
+
+ <select id="getRfidNullList" resultType="java.lang.Long">
+ select id from safe_material_detail where sm_id = #{smId} and ir_status = 0 and valid_status = 0 and del_flag = 0 and rfid is null ORDER BY ware_housing_time asc LIMIT #{count}
+ </select>
+ <select id="getIdListByRfid" resultType="java.lang.Long">
+ select id from safe_material_detail where sm_id = #{smId} and ir_status = 0 and valid_status = 0 and del_flag = 0 and rfid = #{rfid} ORDER BY ware_housing_time asc LIMIT #{count}
+ </select>
+ <select id="getSmallClassifyStockByIds" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyStockDO">
+ select d.small_classify_id,
+ m.dep_id,
+ m.dep_name,
+ count(1) as stockCount
+ from safe_material_detail d
+ INNER JOIN safe_material m
+ ON d.sm_id = m.id
+ where d.del_flag = 0
+ and d.ir_status = 0
+ and d.valid_status = 0
+ and d.small_classify_id in
+ <foreach collection="smallClassifyIds" item="smallClassifyId" separator="," open="(" close=")">
+ #{smallClassifyId}
+ </foreach>
+ group By d.small_classify_id,m.dep_id,m.dep_name
+ </select>
+ <select id="getListBySmallClassifyIds" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailDO">
+ SELECT
+ sd.id,
+ sd.rfid,
+ sm.dep_id,
+ sd.small_classify_id,
+ sd.big_classify_id
+ FROM
+ safe_material_detail sd
+ INNER JOIN safe_material sm ON sd.sm_id = sm.id
+ WHERE
+ sd.del_flag = 0
+ AND sd.ir_status = 0
+ AND sd.valid_status = 0
+ AND sd.small_classify_id IN
+ <foreach collection="smallClassifyIds" item="smallClassifyId" open="(" close=")" separator=",">
+ #{smallClassifyId}
+ </foreach>
+ AND sm.dep_id IN
+ <foreach collection="depIds" item="depId" open="(" close=")" separator=",">
+ #{depId}
+ </foreach>
+ ORDER BY
+ sd.create_time ASC
+ </select>
+ <select id="getListByRfids" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfoDO">
+ SELECT
+ sd.id,
+ CONCAT( sd.NAME, '(NO', sd.material_no, ')' ) as name,
+ sd.big_classify_id,
+ sd.small_classify_id,
+ sm.dep_id
+ FROM
+ safe_material_detail sd
+ inner join safe_material sm on sd.sm_id = sm.id
+ WHERE
+ sd.del_flag = 0
+ AND sd.ir_status = 1
+ AND sd.rfid in
+ <foreach collection="rfids" item="rfid" open="(" close=")" separator=",">
+ #{rfid}
+ </foreach>
+ </select>
</mapper>
--
Gitblit v1.9.2