parent
d75aa67860
commit
a1030e6180
@ -0,0 +1,105 @@
|
|||||||
|
package com.ruoyi.business.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import java.io.IOException;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.ruoyi.common.log.annotation.Log;
|
||||||
|
import com.ruoyi.common.log.enums.BusinessType;
|
||||||
|
import com.ruoyi.common.security.annotation.RequiresPermissions;
|
||||||
|
import com.ruoyi.business.domain.HwAlarmRule;
|
||||||
|
import com.ruoyi.business.service.IHwAlarmRuleService;
|
||||||
|
import com.ruoyi.common.core.web.controller.BaseController;
|
||||||
|
import com.ruoyi.common.core.web.domain.AjaxResult;
|
||||||
|
import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
||||||
|
import com.ruoyi.common.core.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报警规则Controller
|
||||||
|
*
|
||||||
|
* @author xins
|
||||||
|
* @date 2023-09-16
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/alarmRule")
|
||||||
|
public class HwAlarmRuleController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IHwAlarmRuleService hwAlarmRuleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报警规则列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:alarmRule:list")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(HwAlarmRule hwAlarmRule)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<HwAlarmRule> list = hwAlarmRuleService.selectHwAlarmRuleList(hwAlarmRule);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出报警规则列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:alarmRule:export")
|
||||||
|
@Log(title = "报警规则", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, HwAlarmRule hwAlarmRule)
|
||||||
|
{
|
||||||
|
List<HwAlarmRule> list = hwAlarmRuleService.selectHwAlarmRuleList(hwAlarmRule);
|
||||||
|
ExcelUtil<HwAlarmRule> util = new ExcelUtil<HwAlarmRule>(HwAlarmRule.class);
|
||||||
|
util.exportExcel(response, list, "报警规则数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取报警规则详细信息
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:alarmRule:query")
|
||||||
|
@GetMapping(value = "/{alarmRuleId}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("alarmRuleId") Long alarmRuleId)
|
||||||
|
{
|
||||||
|
return success(hwAlarmRuleService.selectHwAlarmRuleByAlarmRuleId(alarmRuleId));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增报警规则
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:alarmRule:add")
|
||||||
|
@Log(title = "报警规则", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody HwAlarmRule hwAlarmRule)
|
||||||
|
{
|
||||||
|
return toAjax(hwAlarmRuleService.insertHwAlarmRule(hwAlarmRule));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改报警规则
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:alarmRule:edit")
|
||||||
|
@Log(title = "报警规则", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody HwAlarmRule hwAlarmRule)
|
||||||
|
{
|
||||||
|
return toAjax(hwAlarmRuleService.updateHwAlarmRule(hwAlarmRule));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除报警规则
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("business:alarmRule:remove")
|
||||||
|
@Log(title = "报警规则", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{alarmRuleIds}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] alarmRuleIds)
|
||||||
|
{
|
||||||
|
return toAjax(hwAlarmRuleService.deleteHwAlarmRuleByAlarmRuleIds(alarmRuleIds));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.business.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.business.domain.HwAlarmRule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报警规则Mapper接口
|
||||||
|
*
|
||||||
|
* @author xins
|
||||||
|
* @date 2023-09-16
|
||||||
|
*/
|
||||||
|
public interface HwAlarmRuleMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询报警规则
|
||||||
|
*
|
||||||
|
* @param alarmRuleId 报警规则主键
|
||||||
|
* @return 报警规则
|
||||||
|
*/
|
||||||
|
public HwAlarmRule selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报警规则列表
|
||||||
|
*
|
||||||
|
* @param hwAlarmRule 报警规则
|
||||||
|
* @return 报警规则集合
|
||||||
|
*/
|
||||||
|
public List<HwAlarmRule> selectHwAlarmRuleList(HwAlarmRule hwAlarmRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增报警规则
|
||||||
|
*
|
||||||
|
* @param hwAlarmRule 报警规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertHwAlarmRule(HwAlarmRule hwAlarmRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改报警规则
|
||||||
|
*
|
||||||
|
* @param hwAlarmRule 报警规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateHwAlarmRule(HwAlarmRule hwAlarmRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除报警规则
|
||||||
|
*
|
||||||
|
* @param alarmRuleId 报警规则主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHwAlarmRuleByAlarmRuleId(Long alarmRuleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除报警规则
|
||||||
|
*
|
||||||
|
* @param alarmRuleIds 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHwAlarmRuleByAlarmRuleIds(Long[] alarmRuleIds);
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.ruoyi.business.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.business.domain.HwAlarmRule;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报警规则Service接口
|
||||||
|
*
|
||||||
|
* @author xins
|
||||||
|
* @date 2023-09-16
|
||||||
|
*/
|
||||||
|
public interface IHwAlarmRuleService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询报警规则
|
||||||
|
*
|
||||||
|
* @param alarmRuleId 报警规则主键
|
||||||
|
* @return 报警规则
|
||||||
|
*/
|
||||||
|
public HwAlarmRule selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报警规则列表
|
||||||
|
*
|
||||||
|
* @param hwAlarmRule 报警规则
|
||||||
|
* @return 报警规则集合
|
||||||
|
*/
|
||||||
|
public List<HwAlarmRule> selectHwAlarmRuleList(HwAlarmRule hwAlarmRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增报警规则
|
||||||
|
*
|
||||||
|
* @param hwAlarmRule 报警规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertHwAlarmRule(HwAlarmRule hwAlarmRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改报警规则
|
||||||
|
*
|
||||||
|
* @param hwAlarmRule 报警规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateHwAlarmRule(HwAlarmRule hwAlarmRule);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除报警规则
|
||||||
|
*
|
||||||
|
* @param alarmRuleIds 需要删除的报警规则主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHwAlarmRuleByAlarmRuleIds(Long[] alarmRuleIds);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除报警规则信息
|
||||||
|
*
|
||||||
|
* @param alarmRuleId 报警规则主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteHwAlarmRuleByAlarmRuleId(Long alarmRuleId);
|
||||||
|
}
|
@ -0,0 +1,96 @@
|
|||||||
|
package com.ruoyi.business.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.common.core.utils.DateUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.business.mapper.HwAlarmRuleMapper;
|
||||||
|
import com.ruoyi.business.domain.HwAlarmRule;
|
||||||
|
import com.ruoyi.business.service.IHwAlarmRuleService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报警规则Service业务层处理
|
||||||
|
*
|
||||||
|
* @author xins
|
||||||
|
* @date 2023-09-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private HwAlarmRuleMapper hwAlarmRuleMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报警规则
|
||||||
|
*
|
||||||
|
* @param alarmRuleId 报警规则主键
|
||||||
|
* @return 报警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public HwAlarmRule selectHwAlarmRuleByAlarmRuleId(Long alarmRuleId)
|
||||||
|
{
|
||||||
|
return hwAlarmRuleMapper.selectHwAlarmRuleByAlarmRuleId(alarmRuleId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询报警规则列表
|
||||||
|
*
|
||||||
|
* @param hwAlarmRule 报警规则
|
||||||
|
* @return 报警规则
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<HwAlarmRule> selectHwAlarmRuleList(HwAlarmRule hwAlarmRule)
|
||||||
|
{
|
||||||
|
return hwAlarmRuleMapper.selectHwAlarmRuleList(hwAlarmRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增报警规则
|
||||||
|
*
|
||||||
|
* @param hwAlarmRule 报警规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertHwAlarmRule(HwAlarmRule hwAlarmRule)
|
||||||
|
{
|
||||||
|
hwAlarmRule.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改报警规则
|
||||||
|
*
|
||||||
|
* @param hwAlarmRule 报警规则
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateHwAlarmRule(HwAlarmRule hwAlarmRule)
|
||||||
|
{
|
||||||
|
hwAlarmRule.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return hwAlarmRuleMapper.updateHwAlarmRule(hwAlarmRule);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除报警规则
|
||||||
|
*
|
||||||
|
* @param alarmRuleIds 需要删除的报警规则主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteHwAlarmRuleByAlarmRuleIds(Long[] alarmRuleIds)
|
||||||
|
{
|
||||||
|
return hwAlarmRuleMapper.deleteHwAlarmRuleByAlarmRuleIds(alarmRuleIds);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除报警规则信息
|
||||||
|
*
|
||||||
|
* @param alarmRuleId 报警规则主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteHwAlarmRuleByAlarmRuleId(Long alarmRuleId)
|
||||||
|
{
|
||||||
|
return hwAlarmRuleMapper.deleteHwAlarmRuleByAlarmRuleId(alarmRuleId);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,196 @@
|
|||||||
|
<?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.business.mapper.HwAlarmRuleMapper">
|
||||||
|
|
||||||
|
<resultMap type="HwAlarmRule" id="HwAlarmRuleResult">
|
||||||
|
<result property="alarmRuleId" column="alarm_rule_id" />
|
||||||
|
<result property="alarmRuleName" column="alarm_rule_name" />
|
||||||
|
<result property="tenantId" column="tenant_id" />
|
||||||
|
<result property="sceneId" column="scene_id" />
|
||||||
|
<result property="alarmLevelId" column="alarm_level_id" />
|
||||||
|
<result property="alarmTypeId" column="alarm_type_id" />
|
||||||
|
<result property="ruleType" column="rule_type" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="deviceModeId" column="device_mode_id" />
|
||||||
|
<result property="modeFunctionId" column="mode_function_id" />
|
||||||
|
<result property="triggerCondition" column="trigger_condition" />
|
||||||
|
<result property="triggerDataA" column="trigger_data_a" />
|
||||||
|
<result property="triggerDataB" column="trigger_data_b" />
|
||||||
|
<result property="triggerDeadzone" column="trigger_deadzone" />
|
||||||
|
<result property="triggerNumber" column="trigger_number" />
|
||||||
|
<result property="triggerTimeFrame" column="trigger_time_frame" />
|
||||||
|
<result property="linkFlag" column="link_flag" />
|
||||||
|
<result property="linkType" column="link_type" />
|
||||||
|
<result property="linkDeviceId" column="link_device_id" />
|
||||||
|
<result property="linkDeviceFunctionId" column="link_device_function_id" />
|
||||||
|
<result property="linkDeviceFunctionData" column="link_device_function_data" />
|
||||||
|
<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="alarmRuleField" column="alarm_rule_field" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectHwAlarmRuleVo">
|
||||||
|
select alarm_rule_id, alarm_rule_name, tenant_id, scene_id, alarm_level_id, alarm_type_id, rule_type, device_id, device_mode_id, mode_function_id, trigger_condition, trigger_data_a, trigger_data_b, trigger_deadzone, trigger_number, trigger_time_frame, link_flag, link_type, link_device_id, link_device_function_id, link_device_function_data, alarm_rule_status, alarm_push_flag, alarm_push_content, alarm_recover_content, remark, create_by, create_time, update_by, update_time, alarm_rule_field from hw_alarm_rule
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectHwAlarmRuleList" parameterType="HwAlarmRule" resultMap="HwAlarmRuleResult">
|
||||||
|
<include refid="selectHwAlarmRuleVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="alarmRuleName != null and alarmRuleName != ''"> and alarm_rule_name like concat('%', #{alarmRuleName}, '%')</if>
|
||||||
|
<if test="tenantId != null "> and tenant_id = #{tenantId}</if>
|
||||||
|
<if test="sceneId != null "> and scene_id = #{sceneId}</if>
|
||||||
|
<if test="alarmLevelId != null "> and alarm_level_id = #{alarmLevelId}</if>
|
||||||
|
<if test="alarmTypeId != null "> and alarm_type_id = #{alarmTypeId}</if>
|
||||||
|
<if test="ruleType != null and ruleType != ''"> and rule_type = #{ruleType}</if>
|
||||||
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||||
|
<if test="deviceModeId != null "> and device_mode_id = #{deviceModeId}</if>
|
||||||
|
<if test="modeFunctionId != null "> and mode_function_id = #{modeFunctionId}</if>
|
||||||
|
<if test="triggerCondition != null and triggerCondition != ''"> and trigger_condition = #{triggerCondition}</if>
|
||||||
|
<if test="triggerDataA != null and triggerDataA != ''"> and trigger_data_a = #{triggerDataA}</if>
|
||||||
|
<if test="triggerDataB != null and triggerDataB != ''"> and trigger_data_b = #{triggerDataB}</if>
|
||||||
|
<if test="triggerDeadzone != null and triggerDeadzone != ''"> and trigger_deadzone = #{triggerDeadzone}</if>
|
||||||
|
<if test="triggerNumber != null "> and trigger_number = #{triggerNumber}</if>
|
||||||
|
<if test="triggerTimeFrame != null "> and trigger_time_frame = #{triggerTimeFrame}</if>
|
||||||
|
<if test="linkFlag != null and linkFlag != ''"> and link_flag = #{linkFlag}</if>
|
||||||
|
<if test="linkType != null and linkType != ''"> and link_type = #{linkType}</if>
|
||||||
|
<if test="linkDeviceId != null "> and link_device_id = #{linkDeviceId}</if>
|
||||||
|
<if test="linkDeviceFunctionId != null "> and link_device_function_id = #{linkDeviceFunctionId}</if>
|
||||||
|
<if test="linkDeviceFunctionData != null and linkDeviceFunctionData != ''"> and link_device_function_data = #{linkDeviceFunctionData}</if>
|
||||||
|
<if test="alarmRuleStatus != null and alarmRuleStatus != ''"> and alarm_rule_status = #{alarmRuleStatus}</if>
|
||||||
|
<if test="alarmPushFlag != null and alarmPushFlag != ''"> and alarm_push_flag = #{alarmPushFlag}</if>
|
||||||
|
<if test="alarmPushContent != null and alarmPushContent != ''"> and alarm_push_content = #{alarmPushContent}</if>
|
||||||
|
<if test="alarmRecoverContent != null and alarmRecoverContent != ''"> and alarm_recover_content = #{alarmRecoverContent}</if>
|
||||||
|
<if test="alarmRuleField != null and alarmRuleField != ''"> and alarm_rule_field = #{alarmRuleField}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectHwAlarmRuleByAlarmRuleId" parameterType="Long" resultMap="HwAlarmRuleResult">
|
||||||
|
<include refid="selectHwAlarmRuleVo"/>
|
||||||
|
where alarm_rule_id = #{alarmRuleId}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertHwAlarmRule" parameterType="HwAlarmRule" useGeneratedKeys="true" keyProperty="alarmRuleId">
|
||||||
|
insert into hw_alarm_rule
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="alarmRuleName != null and alarmRuleName != ''">alarm_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="alarmTypeId != null">alarm_type_id,</if>
|
||||||
|
<if test="ruleType != null and ruleType != ''">rule_type,</if>
|
||||||
|
<if test="deviceId != null">device_id,</if>
|
||||||
|
<if test="deviceModeId != null">device_mode_id,</if>
|
||||||
|
<if test="modeFunctionId != null">mode_function_id,</if>
|
||||||
|
<if test="triggerCondition != null and triggerCondition != ''">trigger_condition,</if>
|
||||||
|
<if test="triggerDataA != null and triggerDataA != ''">trigger_data_a,</if>
|
||||||
|
<if test="triggerDataB != null">trigger_data_b,</if>
|
||||||
|
<if test="triggerDeadzone != null">trigger_deadzone,</if>
|
||||||
|
<if test="triggerNumber != null">trigger_number,</if>
|
||||||
|
<if test="triggerTimeFrame != null">trigger_time_frame,</if>
|
||||||
|
<if test="linkFlag != null and linkFlag != ''">link_flag,</if>
|
||||||
|
<if test="linkType != null">link_type,</if>
|
||||||
|
<if test="linkDeviceId != null">link_device_id,</if>
|
||||||
|
<if test="linkDeviceFunctionId != null">link_device_function_id,</if>
|
||||||
|
<if test="linkDeviceFunctionData != null">link_device_function_data,</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="alarmRuleField != null">alarm_rule_field,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="alarmRuleName != null and alarmRuleName != ''">#{alarmRuleName},</if>
|
||||||
|
<if test="tenantId != null">#{tenantId},</if>
|
||||||
|
<if test="sceneId != null">#{sceneId},</if>
|
||||||
|
<if test="alarmLevelId != null">#{alarmLevelId},</if>
|
||||||
|
<if test="alarmTypeId != null">#{alarmTypeId},</if>
|
||||||
|
<if test="ruleType != null and ruleType != ''">#{ruleType},</if>
|
||||||
|
<if test="deviceId != null">#{deviceId},</if>
|
||||||
|
<if test="deviceModeId != null">#{deviceModeId},</if>
|
||||||
|
<if test="modeFunctionId != null">#{modeFunctionId},</if>
|
||||||
|
<if test="triggerCondition != null and triggerCondition != ''">#{triggerCondition},</if>
|
||||||
|
<if test="triggerDataA != null and triggerDataA != ''">#{triggerDataA},</if>
|
||||||
|
<if test="triggerDataB != null">#{triggerDataB},</if>
|
||||||
|
<if test="triggerDeadzone != null">#{triggerDeadzone},</if>
|
||||||
|
<if test="triggerNumber != null">#{triggerNumber},</if>
|
||||||
|
<if test="triggerTimeFrame != null">#{triggerTimeFrame},</if>
|
||||||
|
<if test="linkFlag != null and linkFlag != ''">#{linkFlag},</if>
|
||||||
|
<if test="linkType != null">#{linkType},</if>
|
||||||
|
<if test="linkDeviceId != null">#{linkDeviceId},</if>
|
||||||
|
<if test="linkDeviceFunctionId != null">#{linkDeviceFunctionId},</if>
|
||||||
|
<if test="linkDeviceFunctionData != null">#{linkDeviceFunctionData},</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="alarmRuleField != null">#{alarmRuleField},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateHwAlarmRule" parameterType="HwAlarmRule">
|
||||||
|
update hw_alarm_rule
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="alarmRuleName != null and alarmRuleName != ''">alarm_rule_name = #{alarmRuleName},</if>
|
||||||
|
<if test="tenantId != null">tenant_id = #{tenantId},</if>
|
||||||
|
<if test="sceneId != null">scene_id = #{sceneId},</if>
|
||||||
|
<if test="alarmLevelId != null">alarm_level_id = #{alarmLevelId},</if>
|
||||||
|
<if test="alarmTypeId != null">alarm_type_id = #{alarmTypeId},</if>
|
||||||
|
<if test="ruleType != null and ruleType != ''">rule_type = #{ruleType},</if>
|
||||||
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||||
|
<if test="deviceModeId != null">device_mode_id = #{deviceModeId},</if>
|
||||||
|
<if test="modeFunctionId != null">mode_function_id = #{modeFunctionId},</if>
|
||||||
|
<if test="triggerCondition != null and triggerCondition != ''">trigger_condition = #{triggerCondition},</if>
|
||||||
|
<if test="triggerDataA != null and triggerDataA != ''">trigger_data_a = #{triggerDataA},</if>
|
||||||
|
<if test="triggerDataB != null">trigger_data_b = #{triggerDataB},</if>
|
||||||
|
<if test="triggerDeadzone != null">trigger_deadzone = #{triggerDeadzone},</if>
|
||||||
|
<if test="triggerNumber != null">trigger_number = #{triggerNumber},</if>
|
||||||
|
<if test="triggerTimeFrame != null">trigger_time_frame = #{triggerTimeFrame},</if>
|
||||||
|
<if test="linkFlag != null and linkFlag != ''">link_flag = #{linkFlag},</if>
|
||||||
|
<if test="linkType != null">link_type = #{linkType},</if>
|
||||||
|
<if test="linkDeviceId != null">link_device_id = #{linkDeviceId},</if>
|
||||||
|
<if test="linkDeviceFunctionId != null">link_device_function_id = #{linkDeviceFunctionId},</if>
|
||||||
|
<if test="linkDeviceFunctionData != null">link_device_function_data = #{linkDeviceFunctionData},</if>
|
||||||
|
<if test="alarmRuleStatus != null and alarmRuleStatus != ''">alarm_rule_status = #{alarmRuleStatus},</if>
|
||||||
|
<if test="alarmPushFlag != null and alarmPushFlag != ''">alarm_push_flag = #{alarmPushFlag},</if>
|
||||||
|
<if test="alarmPushContent != null">alarm_push_content = #{alarmPushContent},</if>
|
||||||
|
<if test="alarmRecoverContent != null">alarm_recover_content = #{alarmRecoverContent},</if>
|
||||||
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="alarmRuleField != null">alarm_rule_field = #{alarmRuleField},</if>
|
||||||
|
</trim>
|
||||||
|
where alarm_rule_id = #{alarmRuleId}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteHwAlarmRuleByAlarmRuleId" parameterType="Long">
|
||||||
|
delete from hw_alarm_rule where alarm_rule_id = #{alarmRuleId}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteHwAlarmRuleByAlarmRuleIds" parameterType="String">
|
||||||
|
delete from hw_alarm_rule where alarm_rule_id in
|
||||||
|
<foreach item="alarmRuleId" collection="array" open="(" separator="," close=")">
|
||||||
|
#{alarmRuleId}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
Loading…
Reference in New Issue