AlarmRuleConfigMapper.java 3.9 KB
package com.skua.modules.alarm.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.alarm.entity.AlarmRuleConfig;
import com.skua.modules.alarm.vo.AlarmRuleAndAlarmRuleLevelVO;
import com.skua.modules.alarm.vo.AlarmRuleConfigVO;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @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,factory_id,(select depart_name " +
            "from sys_depart sd where sd.id = arc.factory_id) factory_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);



    @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,factory_id,(select depart_name from sys_depart sd where sd.id = arc.factory_id) factory_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> getAlarmRuleAndAlarmRuleLeveList(@Param(Constants.WRAPPER) QueryWrapper<AlarmRuleAndAlarmRuleLevelVO> queryWrapper);



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


}