@ -195,6 +195,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<delete id= "deleteHwAlarmRuleLinkByAlarmRuleId" parameterType= "Long" >
delete from hw_alarm_rule_link where alarm_rule_id = #{alarmRuleId}
</delete>
<delete id= "deleteOfflineRuleById" parameterType= "java.lang.Long" >
update hw_offline_rule set deleted_flag = 1
</delete>
<insert id= "batchHwAlarmRuleLink" >
insert into hw_alarm_rule_link( rule_link_id, alarm_rule_type, alarm_rule_id, link_type, link_device_id, link_device_function_id, link_device_function_identifier, link_device_function_data) values
@ -202,7 +205,59 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
( #{item.ruleLinkId}, #{item.alarmRuleType}, #{item.alarmRuleId}, #{item.linkType}, #{item.linkDeviceId}, #{item.linkDeviceFunctionId}, #{item.linkDeviceFunctionIdentifier}, #{item.linkDeviceFunctionData})
</foreach>
</insert>
<insert id= "addOfflineRule" parameterType= "com.ruoyi.business.domain.HwOfflineRule" >
insert into hw_offline_rule
<trim prefix= "(" suffix= ")" suffixOverrides= "," >
<if test= "offlineRuleName != null and offlineRuleName != ''" > offline_rule_name,</if>
<if test= "tenantId != null" > tenant_id,</if>
<if test= "sceneId != null" > scene_id,</if>
<if test= "alarmLevelId != null" > alarm_level_id,</if>
<if test= "ruleType != null and ruleType != ''" > rule_type,</if>
<if test= "offlineTime != null" > offline_time,</if>
<if test= "offlineNumberTime != null" > offline_number_time,</if>
<if test= "offlineNumber != null" > offline_number,</if>
<if test= "triggerTimeFrame != null" > trigger_time_frame,</if>
<if test= "consumeTraffic != null" > consume_traffic,</if>
<if test= "batteryLevel != null" > battery_level,</if>
<if test= "powerDownFlag != null" > power_down_flag,</if>
<if test= "linkFlag != null and linkFlag != ''" > link_flag,</if>
<if test= "alarmRuleStatus != null and alarmRuleStatus != ''" > alarm_rule_status,</if>
<if test= "alarmPushFlag != null and alarmPushFlag != ''" > alarm_push_flag,</if>
<if test= "alarmPushContent != null" > alarm_push_content,</if>
<if test= "alarmRecoverContent != null" > alarm_recover_content,</if>
<if test= "remark != null" > remark,</if>
<if test= "createBy != null" > create_by,</if>
<if test= "createTime != null" > create_time,</if>
<if test= "updateBy != null" > update_by,</if>
<if test= "updateTime != null" > update_time,</if>
<if test= "offlineRuleField != null" > offline_rule_field,</if>
</trim>
<trim prefix= "values (" suffix= ")" suffixOverrides= "," >
<if test= "offlineRuleName != null and offlineRuleName != ''" > #{offlineRuleName},</if>
<if test= "tenantId != null" > #{tenantId},</if>
<if test= "sceneId != null" > #{sceneId},</if>
<if test= "alarmLevelId != null" > #{alarmLevelId},</if>
<if test= "ruleType != null and ruleType != ''" > #{ruleType},</if>
<if test= "offlineTime != null" > #{offlineTime},</if>
<if test= "offlineNumberTime != null" > #{offlineNumberTime},</if>
<if test= "offlineNumber != null" > #{offlineNumber},</if>
<if test= "triggerTimeFrame != null" > #{triggerTimeFrame},</if>
<if test= "consumeTraffic != null" > #{consumeTraffic},</if>
<if test= "batteryLevel != null" > #{batteryLevel},</if>
<if test= "powerDownFlag != null" > #{powerDownFlag},</if>
<if test= "linkFlag != null and linkFlag != ''" > #{linkFlag},</if>
<if test= "alarmRuleStatus != null and alarmRuleStatus != ''" > #{alarmRuleStatus},</if>
<if test= "alarmPushFlag != null and alarmPushFlag != ''" > #{alarmPushFlag},</if>
<if test= "alarmPushContent != null" > #{alarmPushContent},</if>
<if test= "alarmRecoverContent != null" > #{alarmRecoverContent},</if>
<if test= "remark != null" > #{remark},</if>
<if test= "createBy != null" > #{createBy},</if>
<if test= "createTime != null" > #{createTime},</if>
<if test= "updateBy != null" > #{updateBy},</if>
<if test= "updateTime != null" > #{updateTime},</if>
<if test= "offlineRuleField != null" > #{offlineRuleField},</if>
</trim>
</insert>
<select id= "selectHwOfflineRuleJoinList" parameterType= "HwOfflineRule" resultMap= "HwOfflineRuleResult" >
@ -212,7 +267,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
left join hw_scene hs on hor.scene_id=hs.scene_id
left join hw_alarm_level hal on hor.alarm_level_id=hal.alarm_level_id
<where >
hor.deleted_flag = ' 0'
hor.deleted_flag = 0
<if test= "offlineRuleName != null and offlineRuleName != ''" > and hor.offline_rule_name like concat('%',
#{offlineRuleName}, '%')
</if>
@ -238,5 +293,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id= "selectRuleList" resultType= "com.ruoyi.business.domain.HwOfflineRule"
parameterType="com.ruoyi.business.domain.HwOfflineRule"></select>
<select id= "selectOfflineRuleById" resultType= "com.ruoyi.business.domain.HwOfflineRule"
parameterType="java.lang.Long">
select hor.offline_rule_id,hor.offline_rule_name,hor.tenant_id,hor.scene_id,hor.alarm_level_id,hor.rule_type,hor.link_flag,hor.alarm_rule_status,
ht.tenant_name,hs.scene_name,hal.alarm_level_name
from hw_offline_rule hor left join hw_tenant ht on hor.tenant_id = ht.tenant_id
left join hw_scene hs on hor.scene_id=hs.scene_id
left join hw_alarm_level hal on hor.alarm_level_id=hal.alarm_level_id
<where >
hor.deleted_flag = 0
and hor.offline_rule_id = #{offlineRuleId}
</where>
order by hor.offline_rule_id desc
</select>
</mapper>