package com.yeejoin.amos.boot.module.jxiop.biz.mapper2;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yeejoin.amos.boot.module.jxiop.biz.entity.IdxBizFanWarningRuleSet;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 *  Mapper 接口
 *
 * @author system_generator
 * @date 2023-08-15
 */
public interface IdxBizFanWarningRuleSetMapper extends BaseMapper<IdxBizFanWarningRuleSet> {

   List<Map<String,Object>> queryList(int current,int size);

   int queryListCount();

   @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_fan_warning_rule_set WHERE ANALYSIS_TYPE = '按10分钟'")
   Integer getMaxWaringCycleOfMinutes();

   @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_fan_warning_rule_set WHERE ANALYSIS_TYPE = '按10分钟' and GATEWAY_ID = #{gatewayId}")
   Integer getMaxWaringCycleOfMinutesByGatewayId(String gatewayId);
   @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_fan_warning_rule_set WHERE ANALYSIS_TYPE = '按小时'")
   Integer getMaxWaringCycleOfHour();
   @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_fan_warning_rule_set WHERE ANALYSIS_TYPE = '按小时' and GATEWAY_ID = #{gatewayId}")
   Integer getMaxWaringCycleOfHourByGatewayId(String gatewayId);
   @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_fan_warning_rule_set WHERE ANALYSIS_TYPE = '按天'")
   Integer getMaxWaringCycleOfDay();
   @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_fan_warning_rule_set WHERE ANALYSIS_TYPE = '按天' and GATEWAY_ID = #{gatewayId}")
   Integer getMaxWaringCycleOfDayByGatewayId(String gatewayId);
   @Select("SELECT GATEWAY_ID FROM idx_biz_pv_warning_rule_set GROUP BY GATEWAY_ID")
   List<String> getGatewayIds();
}
