From e28a746eb7cbb23a3d7bbb78dba0ae3023e8215d Mon Sep 17 00:00:00 2001
From: linwei <872216696@qq.com>
Date: Wed, 29 Jul 2026 18:07:17 +0800
Subject: [PATCH] feat(workorder): 添加线索事件分页列表功能并优化状态流转

---
 drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdClueEventMapper.xml |   41 +++++++++++++++++++++++++++++++++++------
 1 files changed, 35 insertions(+), 6 deletions(-)

diff --git a/drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdClueEventMapper.xml b/drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdClueEventMapper.xml
index 9556c83..fed63e2 100644
--- a/drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdClueEventMapper.xml
+++ b/drone-service/drone-gd/src/main/java/org/sxkj/gd/workorder/mapper/GdClueEventMapper.xml
@@ -60,11 +60,17 @@
         <result column="geojson" property="geojson"/>
         <result column="attachment_type" property="attachmentType"/>
         <result column="event_name" property="eventName"/>
+        <result column="shoot_time" property="shootTime"/>
+        <result column="dispose_user_name" property="disposeUserName"/>
+        <result column="dispose_dept_name" property="disposeDeptName"/>
     </resultMap>
 
     <resultMap id="gdClueEventCountVoResultMap" type="org.sxkj.gd.workorder.vo.GdClueEventCountVO">
         <result column="total_count" property="totalCount"/>
         <result column="my_count" property="myCount"/>
+        <result column="returned_count" property="returnedCount"/>
+        <result column="disposed_count" property="disposedCount"/>
+        <result column="completed_count" property="completedCount"/>
     </resultMap>
 
     <sql id="gdClueEventDeptWhere">
@@ -105,17 +111,34 @@
             COALESCE(tr.result_url, ce.attach_url) as event_image_url,
             COALESCE(tr.geojson, ce.geojson)  as geojson,
             COALESCE(tr.attachment_type, ce.attachment_type) as attachment_type,
-            ce.create_time as create_time
+            ce.create_time as create_time,
+            tr.shoot_time as shoot_time,
+            COALESCE(bu.real_name, bu.name) as dispose_user_name,
+            bd.dept_name as dispose_dept_name
         from ja_gd_clue_event ce
         left join ja_gd_task_result tr on tr.id::VARCHAR = ce.result_id::VARCHAR and tr.is_deleted = 0
+        left join blade_user bu on bu.id::VARCHAR = ce.dispose_user::VARCHAR and bu.is_deleted = 0
+        left join blade_dept bd on bd.id::VARCHAR = ce.dispose_dept::VARCHAR and bd.is_deleted = 0
         <include refid="gdClueEventDeptWhere"/>
-        and ce.event_status in (1, 3)
+        <if test="statusList != null and statusList.size() > 0">
+            and ce.event_status in
+            <foreach collection="statusList" item="status" open="(" separator="," close=")">
+                #{status}
+            </foreach>
+        </if>
         <if test="keyword != null and keyword != ''">
             and ce.event_num::VARCHAR like concat('%', #{keyword}, '%')
         </if>
         <if test="onlyMine != null and onlyMine == 1">
             and ce.dispose_user = #{userId}
         </if>
+        <if test="startTime != null and startTime != ''">
+            and tr.shoot_time &gt;= #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and tr.shoot_time &lt;= #{endTime}
+        </if>
+        order by ce.create_time desc
     </select>
 
     <select id="selectGdClueEventDetailById" resultMap="gdClueEventVoResultMap">
@@ -131,8 +154,6 @@
         ce.area_code,
         ce.event_num,
         ce.event_name,
-        ce.attach_url,
-        ce.shoot_time,
         ce.create_user,
         ce.create_dept,
         ce.create_time,
@@ -165,10 +186,18 @@
 
     <select id="selectGdClueEventCount" resultMap="gdClueEventCountVoResultMap">
         select count(1) as total_count,
-        COALESCE(sum(case when ce.dispose_user = #{userId} then 1 else 0 end), 0) as my_count
+        COALESCE(sum(case when ce.dispose_user = #{userId} then 1 else 0 end), 0) as my_count,
+        COALESCE(sum(case when ce.event_status = 2 then 1 else 0 end), 0) as returned_count,
+        COALESCE(sum(case when ce.event_status = 3 then 1 else 0 end), 0) as disposed_count,
+        COALESCE(sum(case when ce.event_status = 4 then 1 else 0 end), 0) as completed_count
         from ja_gd_clue_event ce
         <include refid="gdClueEventDeptWhere"/>
-        and ce.event_status in (1, 3)
+        <if test="statusList != null and statusList.size() > 0">
+            and ce.event_status in
+            <foreach collection="statusList" item="status" open="(" separator="," close=")">
+                #{status}
+            </foreach>
+        </if>
         <if test="keyword != null and keyword != ''">
             and ce.event_num like concat('%', #{keyword}, '%')
         </if>

--
Gitblit v1.9.3