package com.ho.flow.mapper;


import com.ho.common.tools.entity.UserDetailRespVO;
import com.ho.flow.vo.Event;
import com.ho.flow.vo.req.AlarmConfig.AlarmConfigQueryVo;
import com.ho.flow.vo.req.event.EventNumReq;
import com.ho.flow.vo.req.event.EventReqPageVO;
import com.ho.flow.vo.EventVo;
import com.ho.flow.vo.resp.event.EventDayNum;
import com.ho.flow.vo.resp.event.EventLevelNum;
import com.ho.flow.vo.resp.event.EventRespVO;
import com.ho.flow.vo.resp.event.EventTypeNum;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
* @author yule
* @description 针对表【event】的数据库操作Mapper
* @createDate 2022-08-29 10:19:50
* @Entity com.ho.business.entity.Event
*/
@Mapper
public interface EventMapper {

    int deleteByPrimaryKey(Long id);

    int insert(Event record);

    int insertSelective(Event record);

    int insertBatch(@Param("list") List<Event> events);

    int updateBatchById(@Param("event") Event event);

    Event selectByPrimaryKey(Long id);

    int updateByPrimaryKeySelective(Event record);

    int updateByPrimaryKey(Event record);

    List<EventRespVO> selectByInfo(@Param("record") EventReqPageVO vo, @Param("depts") List<Integer> depts );

    int selectCountStatusByInfo(@Param("record") EventReqPageVO vo);

     int updateByIds(@Param("ids")List<Long> ids, @Param("userDetail")UserDetailRespVO userDetail);

    List<EventTypeNum>  selectNumByType(@Param("record")EventReqPageVO vo, @Param("depts") List<Integer> depts );

    List<EventLevelNum> selectNumByLevel(@Param("record")EventReqPageVO vo, @Param("depts") List<Integer> depts );

    List<Event> selectByIds(@Param("list") List<Long> eventIds);

    Event selectByParams(@Param("stationId") Integer stationId,@Param("targetDevice") Integer targetDevice,@Param("signal") String signal,@Param("isRecovery") Integer isRecovery);

    Event selectByParam(@Param("vo") Event vo);

    List<Event> selectByTargetDevice(@Param("alarmConfigQueryVo") AlarmConfigQueryVo alarmConfigQueryVo);

    void setRemarkByIds(List<Long> ids);

    Event selectLastTime(@Param("alarmConfigQueryVo") AlarmConfigQueryVo alarmConfigQueryVo);

    //根据告警恢复查询告警故障
    Event selectByBeforeEventId(Long beforeEventId);

    List<Event> selectByTargetDeviceAsc(@Param("alarmConfigQueryVo") AlarmConfigQueryVo alarmConfigQueryVo);

    //根据天统计告警数目
    List<EventDayNum> countEventByDay(@Param("record")EventReqPageVO vo, @Param("depts") List<Integer> depts );

    int deleteByParam(@Param("vo") Event vo);

    List<Integer> eventDeviceNum(@Param("vo") EventNumReq vo);

}
