package com.zcxk.charge.core.dao;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.zcxk.charge.api.dto.*;
import com.zcxk.charge.api.vo.*;
import com.zcxk.charge.core.entity.AlarmDetailsEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

/**
 * @description
 * @author  wangli
 * @data 2020-11-17 14:40
 */
@Mapper
public interface AlarmDetailMapper {

    /**
    * 查询单个设备报警
    * @author Andy
    * @date 17:49 2021/8/17
    * @param id:
    * @return com.zcxk.charge.api.vo.AlarmDetailsEntityVo
    **/
    AlarmDetailsEntityVo selectById(Integer id);

    /**
    * 按设备ID查询报警信息
    * @author Andy
    * @date 17:49 2021/8/17
    * @param sceneId:
    * @param deviceId:
    * @return java.util.List<com.zcxk.charge.api.vo.AlarmDetailsEntityVo>
    **/
    List<AlarmDetailsEntityVo> selectByDeviceId(@Param("sceneId") Long sceneId, @Param("deviceId") Integer deviceId);


    /**
    * 查询设备报警
    * @author Andy
    * @date 14:42 2021/8/13
    * @param ids:
    * @return java.util.List<com.zcxk.charge.api.vo.AlarmDetailsRealTimeVo>
    **/
    List<AlarmDetailsRealTimeVo> selectRealTimeByIds(@Param("ids") List<Integer> ids);

    /**
    * 查询历史
    * @author Andy
    * @date 14:42 2021/8/13
    * @param ids:
    * @return java.util.List<com.zcxk.charge.api.vo.AlarmDetailsHistoryVo>
    **/
    List<AlarmDetailsHistoryVo> selectHistoryByIds(@Param("ids") List<Integer> ids);

    /**
    * 添加设备报警
    * @author Andy
    * @date 17:50 2021/8/17
    * @param alarmDetailsEntity:
    * @return java.lang.Integer
    **/
    Integer insert(AlarmDetailsEntity alarmDetailsEntity);

    /**
     * 批量插入设备报警信息
     * @param alarmDetails
     * @return
     */
    Integer batchInsert(@Param("alarmDetails") List<AlarmDetailsEntity> alarmDetails);

    /**
    * 单条删除设备报警
    * @author Andy
    * @date 17:50 2021/8/17
    * @param id:
    * @return java.lang.Integer
    **/
    Integer deleteById(Integer id);

    /**
    * 设备报警
    * @author Andy
    * @date 17:50 2021/8/17
    * @param ids:
    * @return java.lang.Integer
    **/
    Integer batchDelete(@Param("ids") List<Integer> ids);

    /**
    * 挂起、恢复设备报警
    * @author Andy
    * @date 17:50 2021/8/17
    * @param id:
    * @param opState:
    * @param dateUpdate:
    * @param updateBy:
    * @return java.lang.Integer
    **/
    Integer suspendedById(@Param("id") Integer id, @Param("opState") Integer opState, @Param("dateUpdate") Date dateUpdate, @Param("updateBy") String updateBy);

    /**
    * 修改设备报警信息
    * @author Andy
    * @date 17:50 2021/8/17
    * @param alarmDetailsEntity:
    * @return java.lang.Integer
    **/
    Integer update(AlarmDetailsEntity alarmDetailsEntity);

    /**
    * 查询设备报警信息
    * @author Andy
    * @date 17:50 2021/8/17
    * @param alarmDetailsDto:
    * @return java.util.List<com.zcxk.charge.api.vo.AlarmDetailsEntityVo>
    **/
    List<AlarmDetailsEntityVo> selectList(@Param("alarmDetailsDto") AlarmDetailsDto alarmDetailsDto);

    /**
    * 分页查询
    * @author Andy
    * @date 17:50 2021/8/17
    * @param page:
    * @param alarmDetailsDto:
    * @return com.baomidou.mybatisplus.core.metadata.IPage<com.zcxk.charge.api.vo.AlarmDetailsEntityVo>
    **/
    IPage<AlarmDetailsEntityVo> selectPage(@Param("page") IPage<AlarmDetailsDto> page, @Param("alarmDetailsDto") AlarmDetailsDto alarmDetailsDto);


    /**
    * 查询实时设备报警信息
    * @author Andy
    * @date 17:50 2021/8/17
    * @param alarmDetailsDto:
    * @return java.util.List<com.zcxk.charge.api.vo.AlarmDetailsRealTimeVo>
    **/
    List<AlarmDetailsRealTimeVo> selectRealTimeList(@Param("alarmDetailsDto") AlarmDetailsDto alarmDetailsDto);

    /**
    * 查询历史设备报警信息
    * @author Andy
    * @date 17:51 2021/8/17
    * @param alarmDetailsDto:
    * @return java.util.List<com.zcxk.charge.api.vo.AlarmDetailsHistoryVo>
    **/
    List<AlarmDetailsHistoryVo> selectHistoryList(@Param("alarmDetailsDto") AlarmDetailsDto alarmDetailsDto);


    /**
    * 分页查询实时数据
    * @author Andy
    * @date 17:51 2021/8/17
    * @param page:
    * @param alarmDetailsDto:
    * @return com.baomidou.mybatisplus.core.metadata.IPage<com.zcxk.charge.api.vo.AlarmDetailsRealTimeVo>
    **/
    IPage<AlarmDetailsRealTimeVo> selectRealTimePage(@Param("page") IPage<AlarmDetailsRealTimeDto> page, @Param("alarmDetailsDto") AlarmDetailsDto alarmDetailsDto);


    /**
    * 分页查询历史数据
    * @author Andy
    * @date 17:51 2021/8/17
    * @param page:
    * @param alarmDetailsDto:
    * @return com.baomidou.mybatisplus.core.metadata.IPage<com.zcxk.charge.api.vo.AlarmDetailsHistoryVo>
    **/
    IPage<AlarmDetailsHistoryVo> selectHistoryPage(@Param("page") IPage<AlarmDetailsHistoryDto> page, @Param("alarmDetailsDto") AlarmDetailsDto alarmDetailsDto);


    /**
    * 查询报警规则数据
    * @author Andy
    * @date 17:51 2021/8/17
    * @param deviceId:
    * @param alarmType:
    * @return java.util.List<com.zcxk.charge.api.vo.DeviceCheckAlarmVo>
    **/
    List<DeviceCheckAlarmVo> selectDeviceForCheckAlarm(@Param("deviceId") Integer deviceId, @Param("alarmType") String alarmType);

    /**
    * 查询设备报警信息
    * @author Andy
    * @date 17:51 2021/8/17
    * @param deviceId:
    * @param alarmType:
    * @param alarmSettingIds:
    * @return java.util.List<com.zcxk.charge.api.vo.AlarmDetailsEntityVo>
    **/
    List<AlarmDetailsEntityVo> selectStateAlarm(@Param("deviceId") Integer deviceId, @Param("alarmType") String alarmType, @Param("alarmSettingIds") List<Long> alarmSettingIds);

    /**
    * udpateLastUpdateTime
    * @author Andy
    * @date 17:51 2021/8/17
    * @param deviceId:
    * @param lastUpdateTime:
    * @return java.lang.Integer
    **/
    Integer udpateLastUpdateTime(@Param("deviceId") Integer deviceId, @Param("lastUpdateTime") Date lastUpdateTime);

    /**
    * getAlarmInfoForWorkOrderManage
    * @author Andy
    * @date 17:51 2021/8/17
    * @param :
    * @return java.util.List<com.zcxk.charge.api.vo.DeviceAlarmInfoForOrderVo>
    **/
    List<DeviceAlarmInfoForOrderVo> getAlarmInfoForWorkOrderManage();

    /**
    * updateAlarmSendMessageState
    * @author Andy
    * @date 17:51 2021/8/17
    * @param list:
    * @return java.lang.Integer
    **/
    Integer updateAlarmSendMessageState(List<DeviceAlarmInfoForOrderVo> list);

    /**
    * selectBySceneId
    * @author Andy
    * @date 17:51 2021/8/17
    * @param sceneId:
    * @return java.util.List<com.zcxk.charge.api.vo.AlarmDetailsEntityVo>
    **/
    List<AlarmDetailsEntityVo> selectBySceneId(@Param("sceneId") Integer sceneId);

    /**
    * selectByDeviceAttributeId
    * @author Andy
    * @date 17:52 2021/8/17
    * @param sceneId:
    * @param deviceId:
    * @param attributeId:
    * @return java.util.List<com.zcxk.charge.api.vo.AlarmDetailsEntityVo>
    **/
    List<AlarmDetailsEntityVo> selectByDeviceAttributeId(@Param("sceneId") Long sceneId, @Param("deviceId") Integer deviceId, @Param("attributeId") Integer attributeId);
}
