package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.UnableToAccessWebsiteListToday;
import com.ruoyi.system.domain.WebSiteTenDaysHits;
import com.ruoyi.system.domain.WebsiteAvailabilityMonitor;
import com.ruoyi.system.mapper.WebsiteAvailabilityMonitorMapper;
import com.ruoyi.system.service.IWebsiteAvailabilityMonitorService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import java.util.List;


@Service
public class WebsiteAvailabilityMonitorServiceImpl implements IWebsiteAvailabilityMonitorService {


    @Autowired
    private WebsiteAvailabilityMonitorMapper websiteAvailabilityMonitorMapper;

    @Override
    public List<WebsiteAvailabilityMonitor> selectWebsiteAvailabilityMonitorList() {
        return websiteAvailabilityMonitorMapper.selectWebsiteAvailabilityMonitorList();
    }

    /**
     * 网站可用性实时监测-数据推送接口
     */
    @Override
    public void insertBatch(List<WebsiteAvailabilityMonitor> list) {
        if (!CollectionUtils.isEmpty(list)) {
            websiteAvailabilityMonitorMapper.deleteWebsiteAvailabilityMonitorAll();
        }
        websiteAvailabilityMonitorMapper.insertBatch(list);
    }

}
