feat(iot): 添加设备日志定时清理功能
- 在DeviceMapper中新增批量删除设备、事件、功能日志的方法 - 在DeviceMapper.xml中添加对应的SQL删除语句 - 在DeviceServiceImpl中实现批量删除日志逻辑和定时清理方法 - 创建DevLogDeleteJob定时任务类执行日志清理 - 在IDeviceService接口中添加devLogDelete方法定义 - 实现按天数阈值分批删除历史日志数据 - 添加日志清理进度监控和统计功能 Signed-off-by: Gjm <你的邮箱>
This commit is contained in:
@@ -968,4 +968,22 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where d.product_id = #{productId,jdbcType=BIGINT}
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteDeviceLogBatch">
|
||||
DELETE FROM iot_device_log
|
||||
WHERE create_time < #{cutoffDate}
|
||||
LIMIT #{batchSize}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteEventLogBatch">
|
||||
DELETE FROM iot_event log
|
||||
WHERE create_time < #{cutoffDate}
|
||||
LIMIT #{batchSize}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteFunctionLogBatch">
|
||||
DELETE FROM iot_alert_log
|
||||
WHERE create_time < #{cutoffDate}
|
||||
LIMIT #{batchSize}
|
||||
</delete>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user