package com.huatek.busi.mapper;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import com.github.pagehelper.Page;
import com.huatek.busi.dto.BusiEqmWarningDto;
import com.huatek.busi.vo.BusiEqmWarningVo;
import com.huatek.busi.vo.warning.BusiHomePageWarningVo;

/**
 * 设备预警表 Mapper
 *
 * @author anker_cheng
 * @date Jun 26, 2019 3:31:52 PM
 */
@Repository
    public interface BusiEqmWarningMapper {

    /**
     * 分页查询 设备预警表
     *
     * @param busiEqmWarningDto
     *            设备预警表Dto
     * @return Page 设备预警表List
     */
    Page<BusiEqmWarningVo> selectBusiEqmWarningPage(BusiEqmWarningDto busiEqmWarningDto);

    /**
     * 分页查询 设备预警表
     *
     * @param busiEqmWarningDto
     *            设备预警表Dto
     * @return Page 设备预警表List
     */
    Page<BusiEqmWarningVo> queryThresholdList(BusiEqmWarningDto busiEqmWarningDto);

    /**
     * 按类型获取最近的告警数量
     *sensorCode
     * */
    Integer getCurrentWarningSum(@Param("sensorCode") String sensorCode, @Param("eqType") String eqType, @Param("gzType") String gzType);

    Integer getBusiEqmWarningCount(Map<String, Object> param);

    /**
     *
     * @param busiEqmWarningDto
     * @return
     */
    int wholeupdateBusiEqmWarning(BusiEqmWarningDto busiEqmWarningDto);

    /**
     *
     * @param busiEqmWarningDto
     * @return
     */
    int singleupdateBusiEqmWarning(BusiEqmWarningDto busiEqmWarningDto);

    /**
     * 按时间获取最近的告警列表
     *
     * @param busiEqmWarningDto
     *            BusiEqmWarningDto
     * @return 告警列表
     */
    Page<BusiHomePageWarningVo> findCurrentWarningList(BusiEqmWarningDto busiEqmWarningDto);

    /**
     * 根据sensorCode和报警类型查询告警次数
     *
     * @param sensorCode
     * @param warningType
     * @return
     */
    Integer getWarningCount(@Param("sensorCode") String sensorCode, @Param("warningType") String warningType, @Param("startTime")LocalDateTime startTime,@Param("endTime") LocalDateTime endTime);

    Page<BusiHomePageWarningVo> findCurrentWarningBySensorCodeList(BusiEqmWarningDto busiEqmWarningDto);

    String lockDealStatus(@Param("id") String id);

    List<BusiEqmWarningVo> findBusiEqmWarningList(BusiEqmWarningDto busiEqmWarningDto);

    BusiEqmWarningVo findBusiEqmWarningById(@Param("id") String id);
}
