From ecc3b4099e595bc52037dd3ef39dcac26f58749d Mon Sep 17 00:00:00 2001
From: songhuangfeng123 <shf18767906695@163.com>
Date: 星期三, 03 八月 2022 11:40:47 +0800
Subject: [PATCH] 应急启动记录接口fix

---
 emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanLogInfoMapper.xml |   37 ++++++++++++++++++++++++++++++++++---
 1 files changed, 34 insertions(+), 3 deletions(-)

diff --git a/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanLogInfoMapper.xml b/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanLogInfoMapper.xml
index 3c67fe8..6125300 100644
--- a/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanLogInfoMapper.xml
+++ b/emergency/emergency-service/src/main/resource/config/mapper/emergency/EmergencyPlanLogInfoMapper.xml
@@ -8,13 +8,27 @@
         <id column="id" property="id" jdbcType="BIGINT"/>
         <result column="plan_id" property="planId"/>
         <result column="user_uid" property="userUid"/>
+        <result column="user_name" property="userName"/>
         <result column="start_create" property="startCreate"/>
         <result column="remark" property="remark"/>
     </resultMap>
 
     <select id="selectEmergencyPlanLogList" resultMap="emergencyPlanLogInfoDOResult">
-        select id,`plan_id`,`user_uid`,`start_create`,`remark` from emergency_plan_log where del_flag = 0
-        <if test="query.planId != null  ">and `plan_id` = #{query.planId}</if>
+
+        SELECT
+        a.id,
+        a.`plan_id`,
+        a.`user_uid`,
+        a.user_name,
+        a.`start_create`,
+        a.`remark`,
+        b.`name` AS planName
+        FROM
+        emergency_plan_log a
+        LEFT JOIN emergency_plan b ON a.plan_id = b.id
+        WHERE
+        a.del_flag = 0
+        <if test="query.planId != null  ">and a.`plan_id` = #{query.planId}</if>
     </select>
 
     <insert id="addEmergencyPlanLog" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyPlanLogInfo"
@@ -29,6 +43,7 @@
             <if test="updateUid != null ">update_uid,</if>
             <if test="planId != null ">plan_id,</if>
             <if test="userUid != null ">user_uid,</if>
+            <if test="userName != null and userName != ''">user_name,</if>
             <if test="startCreate != null ">start_create,</if>
             <if test="remark != null and remark != ''">remark,</if>
         </trim>
@@ -41,6 +56,7 @@
             <if test="updateUid != null ">#{updateUid},</if>
             <if test="planId != null ">#{planId},</if>
             <if test="userUid != null ">#{userUid},</if>
+            <if test="userName != null and userName != ''">#{userName},</if>
             <if test="startCreate != null ">#{startCreate},</if>
             <if test="remark != null and remark != ''">#{remark},</if>
         </trim>
@@ -48,7 +64,21 @@
 
 
     <select id="selectEmergencyPlanLogById" resultMap="emergencyPlanLogInfoDOResult">
-        select id,`plan_id`,`user_uid`,`start_create`,`remark` from emergency_plan_log where del_flag = 0 and id = #{id}
+        SELECT
+            a.id,
+            a.`plan_id`,
+            a.`user_uid`,
+            a.user_name,
+            a.`start_create`,
+            a.`remark`,
+            b.`name` AS planName
+        FROM
+            emergency_plan_log a
+            LEFT JOIN emergency_plan b ON a.plan_id = b.id
+        WHERE
+            a.del_flag = 0
+            AND a.id =  #{id}
+
     </select>
 
     <update id="updateEmergencyPlanLog" parameterType="com.gkhy.safePlatform.emergency.entity.EmergencyPlanLogInfo">
@@ -58,6 +88,7 @@
             <if test="updateUid != null ">update_uid = #{updateUid},</if>
             <if test="planId != null ">plan_id = #{planId},</if>
             <if test="userUid != null ">user_uid = #{userUid},</if>
+            <if test="userName != null and userName != ''">user_name = #{userName},</if>
             <if test="startCreate != null ">start_create = #{startCreate},</if>
             <if test="remark != null and remark != ''">remark = #{remark},</if>
         </trim>

--
Gitblit v1.9.2