feiyu02
2025-09-30 94fee0b511279679b43e210878d3d36e5a14384b
src/main/kotlin/com/flightfeather/uav/domain/repository/RealTimeDataRepDelegate.kt
@@ -89,6 +89,32 @@
    }
    /**
     * 统一的update方法
     * @param deviceType 设备类型
     * @param type 数据统计周期,0:秒级值;1:分钟值
     * @param data 数据
     */
    fun updateByDeviceType(deviceType: UWDeviceType?, type: Int? = 0, data: List<BaseRealTimeData>): Int {
        return byDeviceType(deviceType, type, {
            var count = 0
            data.forEach { count += realTimeDataVehicleMapper.updateByPrimaryKeySelective(it as RealTimeDataVehicle) }
            count
        }, {
            var count = 0
            data.forEach { count += realTimeDataUavMapper.updateByPrimaryKeySelective(it as RealTimeDataUav) }
            count
        }, {
            var count = 0
            data.forEach { count += realTimeDataGridMapper.updateByPrimaryKeySelective(it as RealTimeDataGrid) }
            count
        }, {
            var count = 0
            data.forEach { count += realTimeDataGridMinMapper.updateByPrimaryKeySelective(it as RealTimeDataGridMin) }
            count
        }) ?: 0
    }
    /**
     * 统一的delete方法
     * @param deviceType 设备类型
     * @param type 数据统计周期,0:秒级值;1:分钟值