From f7d2f20365467a834188edd35c464d9fb9349214 Mon Sep 17 00:00:00 2001
From: zhangfeng <1603559716@qq.com>
Date: 星期五, 23 十二月 2022 08:53:43 +0800
Subject: [PATCH] 安全物资和设备管理调整v2

---
 equipment/equipment-service/src/main/resources/config/mapper/equipment/SafeMaterialDetailInfoMapper.xml |  152 ++++++++++++++++++++++++++++++++++++++++----------
 1 files changed, 122 insertions(+), 30 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 8394b25..6ea5708 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
@@ -15,12 +15,14 @@
         <result column="valid_type" property="validType" jdbcType="TINYINT"/>
         <result column="valid_time" property="validTime" jdbcType="TIMESTAMP"/>
         <result column="valid_status" property="validStatus" jdbcType="TINYINT"/>
+        <result column="status" property="status" jdbcType="TINYINT"/>
         <result column="ir_status" property="irStatus" jdbcType="TINYINT"/>
         <result column="ware_housing_time" property="wareHousingTime" jdbcType="TIMESTAMP"/>
         <result column="delivery_time" property="deliveryTime" jdbcType="TIMESTAMP"/>
         <result column="sm_id" property="smId" jdbcType="BIGINT"/>
-        <result column="claimant_id" property="claimantId" jdbcType="BIGINT"/>
-        <result column="claimant_name" property="claimantName" jdbcType="VARCHAR"/>
+        <result column="receive_uid" property="receiveUid" jdbcType="BIGINT"/>
+        <result column="receive_uname" property="receiveUname" jdbcType="VARCHAR"/>
+        <result column="remark" property="remark" jdbcType="VARCHAR"/>
         <result column="del_flag" property="delFlag" jdbcType="INTEGER"/>
         <result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
         <result column="create_uid" property="createUid" jdbcType="BIGINT"/>
@@ -35,7 +37,7 @@
     </select>
     <select id="queryById" resultMap="materialDetailResult">
         select id,
-               CONCAT(name,'(ID',sm_id,')') as name,
+               name,
                material_no,
                big_classify_id,
                rfid,
@@ -43,25 +45,27 @@
                valid_type,
                valid_time,
                valid_status,
+               status,
                ir_status,
-               ware_housing_time,
                ware_housing_time,
                delivery_time,
                sm_id,
-               claimant_id,
-               claimant_name
+               receive_uid,
+               receive_uname
         from safe_material_detail where del_flag = 0 and id = #{id}
     </select>
     <update id="updateReceiptStatus" >
         update safe_material_detail
         set ir_status = #{status},
             ware_housing_time = #{wareHousingTime},
-            claimant_id = null,
-            claimant_name = null
+            receive_uid = null,
+            receive_uname = null,
+            delivery_time = null
         where id = #{id}
     </update>
     <select id="getListByIds" resultMap="materialDetailResult">
-        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
+        select id,name,material_no,big_classify_id,rfid,consumable,valid_type,valid_time,valid_status,status,ir_status,ware_housing_time,ware_housing_time,delivery_time,sm_id,receive_uid,
+        receive_uname,remark
                from safe_material_detail
                where del_flag = 0
                  and id in
@@ -73,8 +77,10 @@
         update safe_material_detail
         set ir_status = #{irStatus},
             ware_housing_time = #{wareHousingTime},
-            claimant_id = null,
-            claimant_name = null where id in
+            receive_uid = null,
+            receive_uname = null,
+            delivery_time = null
+            where id in
         <foreach collection="ids" item="id" separator="," open="(" close=")">
             #{id}
         </foreach>
@@ -115,26 +121,13 @@
     <update id="updateDeliveryStatusByIds" >
         update safe_material_detail
         set ir_status = #{detailBO.irStatus},
-            claimant_id = #{detailBO.claimantId},
-            claimant_name = #{detailBO.claimantName},
+            receive_uid = #{detailBO.receiveUid},
+            receive_uname = #{detailBO.receiveUname},
             delivery_time = #{detailBO.deliveryTime}
         where id in
         <foreach collection="detailBO.ids" item="id" separator="," open="(" close=")">
             #{id}
         </foreach>
-    </update>
-    <!--批量出库-随机-->
-    <update id="deliveryBatchRandom" >
-        update safe_material_detail
-        set ir_status = #{detailBO.irStatus},
-            claimant_id = #{detailBO.claimantId},
-            claimant_name = #{detailBO.claimantName},
-            delivery_time = #{detailBO.deliveryTime}
-        where id in
-        <foreach collection="detailBO.ids" item="id" separator="," open="(" close=")" >
-            #{id}
-        </foreach>
-
     </update>
 
     <select id="getValidStockCount" resultType="java.lang.Integer">
@@ -147,7 +140,7 @@
     </select>
     <select id="listByCondition" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfoDO">
         select sd.id,
-               CONCAT(sd.name,'(ID',sd.sm_id,')') as name,
+               CONCAT(sd.name,'(',sm.serial_num,')') as name,
                sd.material_no,
                sd.big_classify_id,
                sd.rfid,
@@ -155,9 +148,11 @@
                sd.valid_type,
                sd.valid_time,
                sd.valid_status,
+               sd.status,
+               sd.remark,
                sd.ir_status,
                sd.ware_housing_time,
-               sd.claimant_name,
+               sd.receive_uname,
                sd.delivery_time,
                sm.dep_id,
                sm.dep_name,
@@ -175,6 +170,9 @@
         </if>
         <if test="query.smId != null">
             and sd.sm_id = #{query.smId}
+        </if>
+        <if test="query.depId != null">
+            and sm.dep_id = #{query.depId}
         </if>
         ORDER BY sd.create_time desc
     </select>
@@ -201,8 +199,43 @@
     <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 id="getListBySmIdAndRfid" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfo">
+        select id,
+               name,
+               material_no,
+               big_classify_id,
+               rfid,
+               consumable,
+               valid_type,
+               valid_time,
+               valid_status,
+               status,
+               ir_status,
+               ware_housing_time,
+               delivery_time,
+               sm_id,
+               receive_uid,
+               receive_uname
+        from safe_material_detail where del_flag = 0 and sm_id = #{query.smId} and ir_status = #{query.irStatus} and valid_status = #{query.validStatus} and rfid = #{query.rfid} ORDER BY create_time asc LIMIT #{query.count}
+    </select>
+    <select id="getListBySmId" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfo">
+        select id,
+               name,
+               material_no,
+               big_classify_id,
+               rfid,
+               consumable,
+               valid_type,
+               valid_time,
+               valid_status,
+               status,
+               ir_status,
+               ware_housing_time,
+               delivery_time,
+               sm_id,
+               receive_uid,
+               receive_uname
+        from safe_material_detail where del_flag = 0 and sm_id = #{query.smId} and ir_status = #{query.irStatus} and valid_status = #{query.validStatus} ORDER BY create_time asc LIMIT #{query.count}
     </select>
     <select id="getSmallClassifyStockByIds" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialClassifyStockDO">
         select d.small_classify_id,
@@ -264,4 +297,63 @@
             #{rfid}
         </foreach>
     </select>
+    <select id="updateValidStatusByIds" >
+        update safe_material_detail set valid_status = #{validStatus} where id in
+        <foreach collection="ids" item="id" separator="," open="(" close=")">
+            #{id}
+        </foreach>
+    </select>
+    <select id="getUnValidList" resultType="com.gkhy.safePlatform.equipment.entity.SafeMaterialDetailInfo">
+        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,
+            receive_uid,
+            receive_uname
+        from safe_material_detail
+        where del_flag = 0
+            and valid_status = #{validStatus}
+            and  DATE_FORMAT(valid_time,'%Y%m%d') &lt; DATE_FORMAT(CURDATE( ),'%Y%m%d')
+    </select>
+    <update id="updateBatch" parameterType="java.util.List">
+        <foreach collection="list" item="item" index="index" open="" close="" separator=";">
+            update safe_material_detail
+            <trim prefix="SET" suffixOverrides=",">
+                <if test="null != item.receiveUid">
+                    receive_uid = #{item.receiveUid},
+                </if>
+                <if test="null != item.receiveUname and '' != item.receiveUname">
+                    receive_uname = #{item.receiveUname},
+                </if>
+                <if test="null != item.irStatus">
+                    ir_status = #{item.irStatus},
+                </if>
+                <if test="null != item.deliveryTime">
+                    delivery_time = #{item.deliveryTime}
+                </if>
+                <if test="null != item.validStatus">
+                    valid_status = #{item.validStatus}
+                </if>
+                <if test="null != item.remark and '' != item.remark">
+                    remark = #{item.remark}
+                </if>
+                <if test="null != item.status">
+                    status = #{item.status}
+                </if>
+
+            </trim>
+            where id = #{item.id}
+        </foreach>
+    </update>
 </mapper>

--
Gitblit v1.9.2