AlarmRuleConfigMapper.java 6.9 KB
package com.skua.modules.alarmtmp.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.skua.modules.alarmtmp.entity.AlarmParamStandardConfig;
import com.skua.modules.alarmtmp.entity.AlarmRuleConfig;
import com.skua.modules.alarmtmp.vo.*;
import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

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

/**
 * @program: skboot
 * @description:
 * @author: xie chao
 * @create: 2020-11-02 10:01
 */
public interface AlarmRuleConfigMapper extends BaseMapper<AlarmRuleConfig> {


    @Select({"select arc.id alarm_rule_id,alarm_rule_name,alarm_param_type,alarm_rule_type,alarm_param_everyday_avg_time,arc.alarm_param_name,alarm_rule_status," +
            "alarm_program_code,arc.alarm_param_code,arc.alarm_param_unit,alarm_time_interval,alarm_data_over_standard_rate,depart_id,(select depart_name " +
            "from sys_depart sd where sd.id = arc.depart_id) depart_name,arlc.id alarm_rule_level_id,alarm_rule_level_name,effective_upper_limit,effective_lower_limit," +
            "alarm_param_is_standardize,alarm_param_standardize_id,case arlc.alarm_param_is_standardize when 0 then arlc.alarm_param_lower_limit " +
            "WHEN 1 then apsc.alarm_param_lower_limit  end alarm_param_lower_limit,case arlc.alarm_param_is_standardize when 0 then arlc.alarm_param_upper_limit " +
            "WHEN 1 then apsc.alarm_param_upper_limit end alarm_param_upper_limit,is_send_sms,sms_send_frequency,sms_allow_send_time,is_send_notice," +
            "alarm_sms_recipient,alarm_sms_recipient_phone,alarm_notice_recipient from alarm_rule_config arc left join alarm_rule_level_config arlc " +
            "on arc.id = arlc.alarm_rule_id left join alarm_param_standard_config apsc on apsc.id = arlc.alarm_param_standardize_id " +
            "${ew.customSqlSegment}"})
    List<AlarmRuleAndAlarmRuleLevelVO> getAlarmRuleAndAlarmRuleLevePage(Page page, @Param(Constants.WRAPPER) QueryWrapper<AlarmRuleAndAlarmRuleLevelVO> queryWrapper);


    List<AlarmRuleAndAlarmRuleLevelVO> getAlarmRuleAndAlarmRuleLeveList();


    @Select({"select arc.*,sd.depart_name depart_name from alarm_rule_config arc  left join sys_depart sd on sd.id=arc.depart_id " +
            "${ew.customSqlSegment}"})
    List<AlarmRuleConfigVO> getList(Page<AlarmRuleConfigVO> page, @Param(Constants.WRAPPER) QueryWrapper<AlarmRuleConfigVO> queryWrapper);


    @Select({"select id from sys_factory_datasource where depart_id like concat('%',#{departId},'%')"})
    List<Map<String, String>> getDataSourceBydepartId(@Param("departId") String departId);


    List<AlarmRuleConfigBatchInfoVO> queryBatchInfoList(@Param("alarmRuleName") String alarmRuleName);

    @Select("SELECT id,\n" +
            "\tbatch_id,\n" +
            "\talarm_rule_name,\n" +
            "\tmin( alarm_param_type ) alarm_param_type,\n" +
            "\tmin( alarm_rule_type ) alarm_rule_type,\n" +
            "\tmin( alarm_param_name ) alarm_param_name,\n" +
            "\tmin( alarm_param_code ) alarm_param_code,\n" +
            "\tmin( alarm_data_over_standard_rate ) alarm_data_over_standard_rate,\n" +
            "\tmin( alarm_param_everyday_avg_time ) alarm_param_everyday_avg_time,\n" +
            "\tmin( alarm_param_unit ) alarm_param_unit,\n" +
            "\tmin( alarm_time_interval ) alarm_time_interval,\n" +
            "\tmin( effective_upper_limit ) effective_upper_limit,\n" +
            "\tmin( effective_lower_limit ) effective_lower_limit,\n" +
            "\tgroup_concat(depart_id) departId,\n" +
            "\tmin( alarm_rule_status ) alarm_rule_status \n" +
            "FROM\n" +
            "\talarm_rule_config \n" +
            "WHERE\n" +
            "\tbatch_id = #{batchId}")
    AlarmRuleConfigBatchInfoVO queryBatchInfoByBatchId(@Param("batchId") String batchId);

    void deleteAlarmConfig(@Param("departId") String departId);

    List<AlarmParamStandardConfig> selectEffluentStandard(@Param("departId") String departId);

    String selectAlarmParamStandardizeId(@Param("effluentStandard") String effluentStandard);

    List<String> selectAlarmRuleConfigId(@Param("departId") String departId);

    void deleteAlarmRuleLevelConfig(@Param("configIds") List<String> configIds);

    void removeByBatchId(@Param("batchId") String batchId);

    Map queryLevelInfoByParam(@Param("departId") String departId, @Param("alarmProgramCode") String alarmProgramCode, @Param("alarmRuleLevelName") String alarmRuleLevelName);

    List<String> queryFacByBatchId(@Param("batchId") String batchId);

    List<SysMonitorMetricInfo> queryMonitorParam(@Param("departId") String departId, @Param("tabPageType") String tabPageType, @Param("monitorType") String monitorType);

    String getAlarmTypeByTag(@Param("metricUidTag") String metricUidTag);

    List<Map<String, Object>> getMonitorByType(@Param("type") String type, @Param("departId") String departId);

    List<NewAlarmRuleConfigVO> getEquipAlarmInfo();

    Map<String, Object> getEquipStatus(@Param("equipId") String equipId);
    /**
     * <pre>
     * 根据处理类名称获取报警配置
     * </pre>
     * @param tag
     * @return
     * @author Li Yuanyuan, 2023年12月13日 上午10:42:50
     * @Description: TODO(这里描述这个方法的需求变更情况)
     */
    List<AlarmRuleConfigAndLevelVO> getAlarmRuleConfigList(@Param("tag")String tag);

    Map<String, String> queryUpLowByParam(@Param("alarmParamStandardizeId") String alarmParamStandardizeId, @Param("configId") String configId);

    List<String> getDepartIds();

    List<Map<String, Object>> queryUpLow(@Param("id") String id);

    Map<String, Object> queryUpLowByAlarm(@Param("id") String id);

    /**
     * <pre>
     * 	获取已配置报警规则,工艺数据项数据标签变更报警数据
     * </pre>
     * @param departId
     * @param tabPageType
     * @return
     * @author Li Yuanyuan, 2023年3月25日 下午2:01:58
     * @Description: TODO(这里描述这个方法的需求变更情况)
     */
	List<AlarmRuleConfigVO> queryMonitorModifyParam(String departId, String tabPageType);

	/**
	 * <pre>
	 * 报警配置同步更新采集数据标签分类变更数据
	 * </pre>
	 * @author Li Yuanyuan, 2023年3月27日 上午10:39:10
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	void updateAlarmRuleTypeFormMetricDict();

	/**
	 * <pre>
	 * 获取已配置报警规则并属于设计标准的指标信息
	 * </pre>
	 * @param departId
	 * @param tabPageType
	 * @return
	 * @author Li Yuanyuan, 2023年3月28日 下午4:22:53
	 * @Description: TODO(这里描述这个方法的需求变更情况)
	 */
	List<Map<String,Object>> getStandardParamsConfig(String departId, String tabPageType);
}