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.IdxBizPvWarningRuleSet;
import io.swagger.models.auth.In;
import javafx.beans.binding.DoubleExpression;
import org.apache.ibatis.annotations.Select;

import java.util.List;

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

    @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_pv_warning_rule_set WHERE ANALYSIS_TYPE = '按10分钟'")
    Integer getMaxWaringCycleOfMinutes();
    @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_pv_warning_rule_set WHERE ANALYSIS_TYPE = '按10分钟' and GATEWAY_ID = #{gateWayId}")
    Integer getMaxWaringCycleOfMinutesByGatewayId(String gateWayId);
    @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_pv_warning_rule_set WHERE ANALYSIS_TYPE = '按小时'")
    Integer getMaxWaringCycleOfHour();
    @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_pv_warning_rule_set WHERE ANALYSIS_TYPE = '按小时' and GATEWAY_ID = #{gateWayId}")
    Integer getMaxWaringCycleOfHourByGatewayId(String gateWayId);
    @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_pv_warning_rule_set WHERE ANALYSIS_TYPE = '按天'")
    Integer getMaxWaringCycleOfDay();
    @Select("SELECT MAX(WARNING_CYCLE) FROM idx_biz_pv_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();
}
