package com.gyee.wisdom.alarm.sharding.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.gyee.wisdom.alarm.sharding.entity.*;
import com.gyee.wisdom.alarm.sharding.model.CodeValue;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;


@Mapper
public interface AlarmCountMapper extends BaseMapper<AlarmCount> {

    void singleInsert( @Param("item") AlarmCount alarmCount);

    void batchInsert(  @Param("list") List<AlarmCount> alarmCounts);


    List<AlarmHistory> selectAlarmHistoryBySnapid(@Param("alarmhistory")String alarmhistory,
                                                  @Param("snapid")Long snapid,
                                                  @Param("startdate") Date startDate,
                                                  @Param("enddate") Date endDate);


    List<AlarmStat1> statAlarmCount1(@Param("stationid")String stationId,
                                     @Param("startdate") Date startDate,
                                     @Param("enddate") Date endDate);

    List<AlarmStat1> statAlarmCount5(@Param("stationid")String stationId,
                                     @Param("windturbineid")String windturbineid,
                                     @Param("startdate") Date startDate,
                                     @Param("enddate") Date endDate);

    List<AlarmStat> statAlarmCount(@Param("stationid")String stationId,
                                   @Param("startdate") Date startDate,
                                   @Param("enddate") Date endDate);

    List<AlarmStat> statAlarmCount3(@Param("stationid")String stationid,
                                   @Param("startdate") Date startDate,
                                   @Param("enddate") Date endDate,
                                   @Param("windturbineid") String windturbineid);

    List<AlarmStat> statAlarmCountByName(@Param("stationid")String stationId,
                                   @Param("startdate") Date startDate,
                                   @Param("enddate") Date endDate,
                                   @Param("name") String name);

    @MapKey("key")
    List<CodeValue> selectAlertRuleNames();


    List<AlarmStat1> statAlarmCount2(@Param("stationid")String stationId,
                                     @Param("currentDate") Date currentDate);

    List<AlarmCountInfo> getAlarmCountInfo(@Param("windturbineid")String wtId,
                                         @Param("currentDate") Date currentDate);
}
