package com.zksy.base.warning.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.zksy.base.warning.domain.EarlyWarning;
import com.zksy.base.warning.mapper.EarlyWarningMapper;
import com.zksy.base.warning.service.IEarlyWarningTodayService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

@Service
public class EarlyWarningTodayServiceImpl implements IEarlyWarningTodayService {

    @Autowired
    private EarlyWarningMapper earlyWarningMapper;

    @Override
    public Map<String, Object> getTodayWarningStats() {
        return earlyWarningMapper.selectTodayWarningStats();
    }

    @Override
    public IPage<EarlyWarning> queryTodayWarningPage(Page<EarlyWarning> page, String status) {
        List<EarlyWarning> list = earlyWarningMapper.selectTodayWarningList(status);
        page.setRecords(list);
        page.setTotal(list.size());
        return page;
    }
}