feiyu02
2025-05-08 9a9a27f185bc0cf9dc0001cfc6839e6d13dbccd9
src/main/kotlin/com/flightfeather/uav/domain/repository/SatelliteGridRep.kt
@@ -8,6 +8,7 @@
import com.flightfeather.uav.domain.mapper.GridDataMapper
import com.flightfeather.uav.domain.mapper.GridGroupMapper
import com.flightfeather.uav.lightshare.bean.AreaVo
import com.github.pagehelper.PageHelper
import org.springframework.stereotype.Repository
import org.springframework.transaction.annotation.Transactional
import tk.mybatis.mapper.entity.Example
@@ -54,12 +55,14 @@
    @Transactional
    fun deleteGridGroup(groupId: Int) {
        gridCellMapper.delete(GridCell().apply { this.groupId = groupId })
        PageHelper.startPage<GridCell>(1, 1)
        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)
        PageHelper.startPage<GridGroup>(1, 1)
        gridGroupMapper.selectByExample(
            Example(GridGroup::class.java).apply { orderBy("id").desc() }
        ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
@@ -136,6 +139,25 @@
        gridDataDetailMapper.updatePM25Batch(gridDataDetails)
    }
    @Transactional
    @Throws
    fun deleteGridData(dataId: Int?) {
        gridDataDetailMapper.delete(GridDataDetail().apply { this.dataId = dataId })
        // Fixme 2025.4.16 此处的重置自增id只在删除最新数据的情况下有效,后续考虑不适用自增主键,改为新的主键生成方式
//        PageHelper.startPage<GridDataDetail>(1, 1)
//        gridDataDetailMapper.selectByExample(Example(GridDataDetail::class.java).apply { orderBy("id").desc() })
//            .takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
//                gridDataDetailMapper.resetAutoIncrement(id + 1)
//            }
        gridDataMapper.deleteByPrimaryKey(dataId)
//        PageHelper.startPage<GridData>(1, 1)
//        gridDataMapper.selectByExample(
//            Example(GridData::class.java).apply { orderBy("id").desc() }
//        ).takeIf { it.isNotEmpty() }?.get(0)?.id?.let { id ->
//            gridDataMapper.resetAutoIncrement(id + 1)
//        }
    }
    /*****************************************************************/
    //    aod 相关操作