hanfucheng 6 달 전
부모
커밋
8ce7dabe5c
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  1. 6 5
      src/main/resources/mapper/lawenforcement/LawenforcementViewMapper.xml

+ 6 - 5
src/main/resources/mapper/lawenforcement/LawenforcementViewMapper.xml

@@ -225,12 +225,13 @@
             a.person_name personName,
             a.person_code personCode,
             a.dept_name deptName,
-            a.device_id deviceId,
-            a.device_name deviceName,
+            c.device_id deviceId,
+            c.device_name deviceName,
             case WHEN a.main_person = 0 then '否' WHEN a.main_person = 1 THEN '是' end mainPerson
         FROM
             lawenforcement_person a
-        WHERE record_id = #{recordId}
+                left join lawenforcement_record_log c on a.person_code = c.person_code and a.record_id = c.record_id and c.record_state = '0'
+        WHERE a.record_id = #{recordId}
     </select>
 
     <select id="getEquipmentDetails" parameterType="LawenforcementViewBO" resultType="map">
@@ -241,7 +242,7 @@
             b.person_name personName,
             c.device_id deviceId,
             c.device_name deviceName,
-            c.start_time checkStartTime,
+            SUBSTRING_INDEX( GROUP_CONCAT( DATE_FORMAT(c.start_time,'%Y-%m-%d %h:%m:%s') ORDER BY start_time asc ), ',', 1 ) checkStartTime,
             case WHEN a.is_last = 0 then '否' WHEN a.is_last = 1 THEN '是' end isLast,
             case WHEN a.is_cross_dept = 0 then '否' WHEN a.is_cross_dept = 1 THEN '是' end isCrossDept
         FROM
@@ -253,7 +254,7 @@
             <when test="deviceId != null and deviceId != ''">
                 and c.device_id = #{deviceId}
             </when>
-            <otherwise>and a.record_status in ('lawenforcement_type_4','lawenforcement_type_6') and c.record_state = 0</otherwise>
+            <otherwise>and a.record_status in ('lawenforcement_type_4','lawenforcement_type_6') and c.record_state = 0 GROUP BY a.id</otherwise>
         </choose>
         <if test="deviceId != null  and deviceId != ''"> LIMIT 5 </if>
     </select>