@@ -11,4 +11,6 @@ import java.util.List;
public interface PlcCostomAddressHistoryMapper extends SuperMapper<PlcCostomAddressHistory> {
PlcCostomAddressHistory getGroupByList();
+
+ void deleteHistory30();
}
public interface ToolCostomAddressHistoryMapper extends SuperMapper<ToolCostomAddressHistory> {
List<ToolCostomAddressHistory> getGroupByList();
@@ -493,4 +493,13 @@ public class DeviceCollectionTaskJob {
+ /**
+ * 保留30天内的数据
+ */
+ @Scheduled(cron = "0 0 * * *")
+ public void deleteHistory30(){
+ plcCostomAddressHistoryMapper.deleteHistory30();
+ toolCostomAddressHistoryMapper.deleteHistory30();
+ }
@@ -9,4 +9,9 @@
</select>
+ <delete id="deleteHistory30">
+ DELETE FROM plc_costom_address_history
+ WHERE create_time < NOW() - INTERVAL 30 DAY
+ </delete>
</mapper>
+ DELETE FROM tool_costom_address_history