From e133600480d5f688a8375db7708fe531b4726f4a Mon Sep 17 00:00:00 2001
From: feiyu02 <risaku@163.com>
Date: 星期五, 07 二月 2025 17:38:38 +0800
Subject: [PATCH] 1. 新增卫星网格拆分、遥测数据拆分映射功能

---
 src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt |   36 ++++++++++++++++++++++++++++++++++++
 1 files changed, 36 insertions(+), 0 deletions(-)

diff --git a/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt b/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
index 4c35033..3fcdb97 100644
--- a/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
+++ b/src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
@@ -46,11 +46,35 @@
         return gridGroupMapper.select(gridGroup)
     }
 
+    fun insertGridGroup(gridGroup: GridGroup): Int {
+        return gridGroupMapper.insert(gridGroup)
+    }
+
+    @Transactional
+    fun deleteGridGroup(groupId: Int) {
+        gridCellMapper.delete(GridCell().apply { this.groupId = groupId })
+        gridCellMapper.selectByExample(
+            Example(GridCell::class.java).apply { orderBy("id").desc() }
+        ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
+            gridCellMapper.resetAutoIncrement(id + 1)
+        }
+        gridGroupMapper.deleteByPrimaryKey(groupId)
+        gridGroupMapper.selectByExample(
+            Example(GridGroup::class.java).apply { orderBy("id").desc() }
+        ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
+            gridGroupMapper.resetAutoIncrement(id + 1)
+        }
+    }
+
     fun fetchGridCell(groupId: Int): List<GridCell?> {
         return gridCellMapper.selectByExample(Example(GridCell::class.java).apply {
             createCriteria().andEqualTo("groupId", groupId)
             orderBy("id")
         })
+    }
+
+    fun insertGridCell(gridCellList: List<GridCell?>): Int {
+        return gridCellMapper.insertList(gridCellList)
     }
 
     fun fetchGridData(groupId: Int, dataTime: LocalDateTime?, type: Int?): List<GridData?> {
@@ -65,6 +89,18 @@
         return gridDataMapper.select(gridData)
     }
 
+    fun fetchGridData(id: Int): GridData? {
+        return gridDataMapper.selectByPrimaryKey(id)
+    }
+
+    fun insertGridData(gridData: GridData): Int {
+        return gridDataMapper.insert(gridData)
+    }
+
+    fun insertGridDataDetail(gridDataDetails: List<GridDataDetail?>): Int {
+        return gridDataDetailMapper.insertList(gridDataDetails)
+    }
+
     fun fetchGridDataDetail(dataId: Int, groupId: Int?, cellId: Int?): List<GridDataDetail?> {
         return gridDataDetailMapper.selectByExample(Example(GridDataDetail::class.java).apply {
             createCriteria().andEqualTo("dataId", dataId)

--
Gitblit v1.9.3