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

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.gyee.wisdom.alarm.sharding.entity.FaultInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

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

@Repository
@Mapper
public interface FaultInfoMapper extends BaseMapper<FaultInfo> {

    List<FaultInfo> queryFaultInfo(@Param("stid") String stationId,
                                    @Param("keyword") String keyword,
                                    @Param("starttime") Date startTime,
                                    @Param("endtime") Date endTime,
                                   @Param("messageType") Integer messageType,
                                   @Param("likeString") String likeString

    ) throws Exception;


    List<FaultInfo>  getRecentFault(@Param("faulttime") Date faultTime);


    List<FaultInfo>  getTopNumFault(@Param("topnum") int topNum) throws Exception;

    IPage<FaultInfo> queryFaultInfo1(Page page,
                                    @Param("stid")String stationId,
                                    @Param("keyword") String keyword,
                                    @Param("category1") String cateGory1,
                                    @Param("starttime") Date startTime,
                                    @Param("endtime") Date endTime,
                                    @Param("isopened") Integer isOpened
    )throws Exception;


    /**
     * 根据ID获取报警信息
     */
    List<FaultInfo> getFaultInfoByIds(String[] ids);
}
