parent
c167b547ad
commit
c14cf38b86
@ -0,0 +1,34 @@
|
||||
package com.ruoyi.dataprocess.mapper;
|
||||
|
||||
|
||||
|
||||
import com.ruoyi.dataprocess.domain.HwAlarmRuleLink;
|
||||
import com.ruoyi.dataprocess.domain.HwOfflineRule;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 离线报警规则Mapper接口
|
||||
*
|
||||
* @author xins
|
||||
* @date 2023-11-13
|
||||
*/
|
||||
public interface HwOfflineRuleMapper
|
||||
{
|
||||
/**
|
||||
* 查询离线报警规则
|
||||
*
|
||||
* @param deviceId 设备Id
|
||||
* @return 离线报警规则
|
||||
*/
|
||||
public HwOfflineRule selectHwOfflineRuleByDeviceId(Long deviceId);
|
||||
|
||||
/**
|
||||
* 查询离线报警规则
|
||||
*
|
||||
* @param sceneId 场景Id
|
||||
* @return 离线报警规则
|
||||
*/
|
||||
public HwOfflineRule selectHwOfflineRuleBySceneId(Long sceneId);
|
||||
|
||||
}
|
@ -0,0 +1,118 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.dataprocess.mapper.HwOfflineRuleMapper">
|
||||
|
||||
<resultMap type="HwOfflineRule" id="HwOfflineRuleResult">
|
||||
<result property="offlineRuleId" column="offline_rule_id"/>
|
||||
<result property="offlineRuleName" column="offline_rule_name"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
<result property="sceneId" column="scene_id"/>
|
||||
<result property="alarmLevelId" column="alarm_level_id"/>
|
||||
<result property="ruleType" column="rule_type"/>
|
||||
<result property="offlineTime" column="offline_time"/>
|
||||
<result property="offlineNumberTime" column="offline_number_time"/>
|
||||
<result property="offlineNumber" column="offline_number"/>
|
||||
<result property="triggerTimeFrame" column="trigger_time_frame"/>
|
||||
<result property="consumeTraffic" column="consume_traffic"/>
|
||||
<result property="batteryLevel" column="battery_level"/>
|
||||
<result property="powerDownFlag" column="power_down_flag"/>
|
||||
<result property="linkFlag" column="link_flag"/>
|
||||
<result property="alarmRuleStatus" column="alarm_rule_status"/>
|
||||
<result property="alarmPushFlag" column="alarm_push_flag"/>
|
||||
<result property="alarmPushContent" column="alarm_push_content"/>
|
||||
<result property="alarmRecoverContent" column="alarm_recover_content"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="offlineRuleField" column="offline_rule_field"/>
|
||||
<result property="tenantName" column="tenant_name"/>
|
||||
<result property="sceneName" column="scene_name"/>
|
||||
<result property="alarmLevelName" column="alarm_level_name"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="HwOfflineRuleHwAlarmRuleLinkResult" type="HwOfflineRule" extends="HwOfflineRuleResult">
|
||||
<collection property="hwAlarmRuleLinkList" notNullColumn="sub_rule_link_id" javaType="java.util.List"
|
||||
resultMap="HwAlarmRuleLinkResult"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="HwAlarmRuleLink" id="HwAlarmRuleLinkResult">
|
||||
<result property="ruleLinkId" column="sub_rule_link_id"/>
|
||||
<result property="alarmRuleType" column="sub_alarm_rule_type"/>
|
||||
<result property="alarmRuleId" column="sub_alarm_rule_id"/>
|
||||
<result property="linkType" column="sub_link_type"/>
|
||||
<result property="linkDeviceId" column="sub_link_device_id"/>
|
||||
<result property="linkDeviceFunctionId" column="sub_link_device_function_id"/>
|
||||
<result property="linkDeviceFunctionIdentifier" column="sub_link_device_function_identifier"/>
|
||||
<result property="linkDeviceFunctionData" column="sub_link_device_function_data"/>
|
||||
<result property="linkDeviceCode" column="sub_link_device_code"/>
|
||||
</resultMap>
|
||||
|
||||
|
||||
<select id="selectHwOfflineRuleByDeviceId" parameterType="Long" resultMap="HwOfflineRuleHwAlarmRuleLinkResult">
|
||||
select a.offline_rule_id,
|
||||
a.rule_type,
|
||||
a.offline_time,
|
||||
a.offline_number_time,
|
||||
a.offline_number,
|
||||
a.alarm_level_id,
|
||||
a.trigger_time_frame,
|
||||
a.consume_traffic,
|
||||
a.battery_level,
|
||||
a.power_down_flag,
|
||||
a.link_flag,
|
||||
a.alarm_rule_status,
|
||||
a.alarm_push_flag,
|
||||
a.alarm_push_content,
|
||||
b.rule_link_id as sub_rule_link_id,
|
||||
b.alarm_rule_type as sub_alarm_rule_type,
|
||||
b.alarm_rule_id as sub_alarm_rule_id,
|
||||
b.link_type as sub_link_type,
|
||||
b.link_device_id as sub_link_device_id,
|
||||
b.link_device_function_identifier as sub_link_device_function_identifier,
|
||||
b.link_device_function_data as sub_link_device_function_data,
|
||||
hd.device_code as sub_link_device_code
|
||||
from hw_offline_rule a
|
||||
left join hw_alarm_rule_link b on b.alarm_rule_id = a.offline_rule_id and b.alarm_rule_type = 2
|
||||
left join hw_device hd on b.link_device_id = hd.device_id
|
||||
where exists (select 1
|
||||
from hw_offline_target hot
|
||||
where hot.offline_rule_id = a.offline_rule_id
|
||||
and hot.target_type = '1'
|
||||
and hot.target_id = #{deviceId}) limit 1
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectHwOfflineRuleBySceneId" parameterType="Long" resultMap="HwOfflineRuleHwAlarmRuleLinkResult">
|
||||
select a.offline_rule_id,
|
||||
a.rule_type,
|
||||
a.offline_time,
|
||||
a.offline_number_time,
|
||||
a.offline_number,
|
||||
a.alarm_level_id,
|
||||
a.trigger_time_frame,
|
||||
a.consume_traffic,
|
||||
a.battery_level,
|
||||
a.power_down_flag,
|
||||
a.link_flag,
|
||||
a.alarm_rule_status,
|
||||
a.alarm_push_flag,
|
||||
a.alarm_push_content,
|
||||
b.rule_link_id as sub_rule_link_id,
|
||||
b.alarm_rule_type as sub_alarm_rule_type,
|
||||
b.alarm_rule_id as sub_alarm_rule_id,
|
||||
b.link_type as sub_link_type,
|
||||
b.link_device_id as sub_link_device_id,
|
||||
b.link_device_function_identifier as sub_link_device_function_identifier,
|
||||
b.link_device_function_data as sub_link_device_function_data,
|
||||
hd.device_code as sub_link_device_code
|
||||
from hw_offline_rule a
|
||||
left join hw_alarm_rule_link b on b.alarm_rule_id = a.offline_rule_id and b.alarm_rule_type = 2
|
||||
left join hw_device hd on b.link_device_id = hd.device_id
|
||||
where a.scene_id = #{sceneId} limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
Loading…
Reference in New Issue