From 8c6e742562d0c8647e0ee8deff01a3eb176d677b Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期二, 02 九月 2025 17:30:47 +0800
Subject: [PATCH] 2025.9.2 1. 新增走航任务统计功能(待完成)

---
 src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt
index b8c4c4c..f726760 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/SourceTraceRep.kt
@@ -99,9 +99,18 @@
         return if (res.isEmpty()) null else res[0]
     }
 
-    fun fetchList(deviceCode: String, startTime: Date, endTime: Date): List<BaseExceptionResult?> {
-        return sourceTraceMsgBlobMapper.selectWithBlob(deviceCode, startTime, endTime)
-            .map { stm ->
+    fun fetchList(
+        deviceCode: String,
+        startTime: Date,
+        endTime: Date,
+        msgType: MsgType? = null,
+    ): List<BaseExceptionResult?> {
+        var res = sourceTraceMsgBlobMapper.selectWithBlob(deviceCode, startTime, endTime)
+        if (msgType !== null) {
+            res = res.filter { it?.msgType == msgType.value }
+        }
+
+        return res.map { stm ->
             when (stm?.msgType) {
                 MsgType.PolClue.value,
                 MsgType.DataChange.value,
@@ -125,6 +134,7 @@
                 .andGreaterThanOrEqualTo("startTime", mission.startTime)
                 .andLessThanOrEqualTo("endTime", mission.endTime)
         }).map { it?.id }
+        if (idList.isEmpty()) return 0
         sourceTraceMsgMapper.deleteByExample(Example(SourceTraceMsg::class.java).apply {
             createCriteria().andIn("id", idList)
         })

--
Gitblit v1.9.3