若依微服务1.2.0版本

监控平台所有方法重写
dev
xins 1 year ago
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,392 @@
package com.ruoyi.business.domain;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
/**
* hw_alarm_rule
*
* @author xins
* @date 2023-09-16
*/
public class HwAlarmRule extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 报警规则ID */
private Long alarmRuleId;
/** 规则名称 */
@Excel(name = "规则名称")
private String alarmRuleName;
/** 租户ID关联hw_tenant的tenant_id */
@Excel(name = "租户ID关联hw_tenant的tenant_id")
private Long tenantId;
/** 所属场景关联hw_scene表的scene_id字段 */
@Excel(name = "所属场景关联hw_scene表的scene_id字段")
private Long sceneId;
/** 报警级别关联表hw_alarm_level字段alarm_level_id */
@Excel(name = "报警级别关联表hw_alarm_level字段alarm_level_id")
private Long alarmLevelId;
/** 报警类型关联表hw_alarm_type字段alarm_type_id */
@Excel(name = "报警类型关联表hw_alarm_type字段alarm_type_id")
private Long alarmTypeId;
/** 规则类型1、设备模型2、设备 */
@Excel(name = "规则类型", readConverterExp = "1=、设备模型2、设备")
private String ruleType;
/** 设备关联表hw_device字段device_id */
@Excel(name = "设备关联表hw_device字段device_id")
private Long deviceId;
/** 设备模型关联表hw_device_mode字段device_mode_id */
@Excel(name = "设备模型关联表hw_device_mode字段device_mode_id")
private Long deviceModeId;
/** 设备属性关联表hw_device_mode_function字段mode_function_id */
@Excel(name = "设备属性关联表hw_device_mode_function字段mode_function_id")
private Long modeFunctionId;
/** 触发条件1、数值大于A2、数值小于B3、数值大于A且小于B4、数值小于A或大于B5、数值等于A */
@Excel(name = "触发条件", readConverterExp = "1=、数值大于A2、数值小于B3、数值大于A且小于B4、数值小于A或大于B5、数值等于A")
private String triggerCondition;
/** 触发定义A值 */
@Excel(name = "触发定义A值")
private String triggerDataA;
/** 触发定义B值 */
@Excel(name = "触发定义B值")
private String triggerDataB;
/** 触发死区 */
@Excel(name = "触发死区")
private String triggerDeadzone;
/** 触发阈值次数 */
@Excel(name = "触发阈值次数")
private Long triggerNumber;
/** 时间范围(单位:分钟) */
@Excel(name = "时间范围", readConverterExp = "单=位:分钟")
private Long triggerTimeFrame;
/** 联动标识1、是0、否 */
@Excel(name = "联动标识", readConverterExp = "1=、是0、否")
private String linkFlag;
/** 联动类型1、控制2、采集 */
@Excel(name = "联动类型", readConverterExp = "1=、控制2、采集")
private String linkType;
/** 联动设备关联表hw_device字段device_id */
@Excel(name = "联动设备关联表hw_device字段device_id")
private Long linkDeviceId;
/** 联动设备功能关联表hw_device_mode_function字段mode_function_id */
@Excel(name = "联动设备功能关联表hw_device_mode_function字段mode_function_id")
private Long linkDeviceFunctionId;
/** 联动设备属性值 */
@Excel(name = "联动设备属性值")
private String linkDeviceFunctionData;
/** 报警启用状态(1、是2、否 */
@Excel(name = "报警启用状态(1、是2、否")
private String alarmRuleStatus;
/** 报警推送标识(1、是2、否 */
@Excel(name = "报警推送标识(1、是2、否")
private String alarmPushFlag;
/** 报警推送内容 */
@Excel(name = "报警推送内容")
private String alarmPushContent;
/** 恢复正常推送内容 */
@Excel(name = "恢复正常推送内容")
private String alarmRecoverContent;
/** 预留字段 */
@Excel(name = "预留字段")
private String alarmRuleField;
public void setAlarmRuleId(Long alarmRuleId)
{
this.alarmRuleId = alarmRuleId;
}
public Long getAlarmRuleId()
{
return alarmRuleId;
}
public void setAlarmRuleName(String alarmRuleName)
{
this.alarmRuleName = alarmRuleName;
}
public String getAlarmRuleName()
{
return alarmRuleName;
}
public void setTenantId(Long tenantId)
{
this.tenantId = tenantId;
}
public Long getTenantId()
{
return tenantId;
}
public void setSceneId(Long sceneId)
{
this.sceneId = sceneId;
}
public Long getSceneId()
{
return sceneId;
}
public void setAlarmLevelId(Long alarmLevelId)
{
this.alarmLevelId = alarmLevelId;
}
public Long getAlarmLevelId()
{
return alarmLevelId;
}
public void setAlarmTypeId(Long alarmTypeId)
{
this.alarmTypeId = alarmTypeId;
}
public Long getAlarmTypeId()
{
return alarmTypeId;
}
public void setRuleType(String ruleType)
{
this.ruleType = ruleType;
}
public String getRuleType()
{
return ruleType;
}
public void setDeviceId(Long deviceId)
{
this.deviceId = deviceId;
}
public Long getDeviceId()
{
return deviceId;
}
public void setDeviceModeId(Long deviceModeId)
{
this.deviceModeId = deviceModeId;
}
public Long getDeviceModeId()
{
return deviceModeId;
}
public void setModeFunctionId(Long modeFunctionId)
{
this.modeFunctionId = modeFunctionId;
}
public Long getModeFunctionId()
{
return modeFunctionId;
}
public void setTriggerCondition(String triggerCondition)
{
this.triggerCondition = triggerCondition;
}
public String getTriggerCondition()
{
return triggerCondition;
}
public void setTriggerDataA(String triggerDataA)
{
this.triggerDataA = triggerDataA;
}
public String getTriggerDataA()
{
return triggerDataA;
}
public void setTriggerDataB(String triggerDataB)
{
this.triggerDataB = triggerDataB;
}
public String getTriggerDataB()
{
return triggerDataB;
}
public void setTriggerDeadzone(String triggerDeadzone)
{
this.triggerDeadzone = triggerDeadzone;
}
public String getTriggerDeadzone()
{
return triggerDeadzone;
}
public void setTriggerNumber(Long triggerNumber)
{
this.triggerNumber = triggerNumber;
}
public Long getTriggerNumber()
{
return triggerNumber;
}
public void setTriggerTimeFrame(Long triggerTimeFrame)
{
this.triggerTimeFrame = triggerTimeFrame;
}
public Long getTriggerTimeFrame()
{
return triggerTimeFrame;
}
public void setLinkFlag(String linkFlag)
{
this.linkFlag = linkFlag;
}
public String getLinkFlag()
{
return linkFlag;
}
public void setLinkType(String linkType)
{
this.linkType = linkType;
}
public String getLinkType()
{
return linkType;
}
public void setLinkDeviceId(Long linkDeviceId)
{
this.linkDeviceId = linkDeviceId;
}
public Long getLinkDeviceId()
{
return linkDeviceId;
}
public void setLinkDeviceFunctionId(Long linkDeviceFunctionId)
{
this.linkDeviceFunctionId = linkDeviceFunctionId;
}
public Long getLinkDeviceFunctionId()
{
return linkDeviceFunctionId;
}
public void setLinkDeviceFunctionData(String linkDeviceFunctionData)
{
this.linkDeviceFunctionData = linkDeviceFunctionData;
}
public String getLinkDeviceFunctionData()
{
return linkDeviceFunctionData;
}
public void setAlarmRuleStatus(String alarmRuleStatus)
{
this.alarmRuleStatus = alarmRuleStatus;
}
public String getAlarmRuleStatus()
{
return alarmRuleStatus;
}
public void setAlarmPushFlag(String alarmPushFlag)
{
this.alarmPushFlag = alarmPushFlag;
}
public String getAlarmPushFlag()
{
return alarmPushFlag;
}
public void setAlarmPushContent(String alarmPushContent)
{
this.alarmPushContent = alarmPushContent;
}
public String getAlarmPushContent()
{
return alarmPushContent;
}
public void setAlarmRecoverContent(String alarmRecoverContent)
{
this.alarmRecoverContent = alarmRecoverContent;
}
public String getAlarmRecoverContent()
{
return alarmRecoverContent;
}
public void setAlarmRuleField(String alarmRuleField)
{
this.alarmRuleField = alarmRuleField;
}
public String getAlarmRuleField()
{
return alarmRuleField;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("alarmRuleId", getAlarmRuleId())
.append("alarmRuleName", getAlarmRuleName())
.append("tenantId", getTenantId())
.append("sceneId", getSceneId())
.append("alarmLevelId", getAlarmLevelId())
.append("alarmTypeId", getAlarmTypeId())
.append("ruleType", getRuleType())
.append("deviceId", getDeviceId())
.append("deviceModeId", getDeviceModeId())
.append("modeFunctionId", getModeFunctionId())
.append("triggerCondition", getTriggerCondition())
.append("triggerDataA", getTriggerDataA())
.append("triggerDataB", getTriggerDataB())
.append("triggerDeadzone", getTriggerDeadzone())
.append("triggerNumber", getTriggerNumber())
.append("triggerTimeFrame", getTriggerTimeFrame())
.append("linkFlag", getLinkFlag())
.append("linkType", getLinkType())
.append("linkDeviceId", getLinkDeviceId())
.append("linkDeviceFunctionId", getLinkDeviceFunctionId())
.append("linkDeviceFunctionData", getLinkDeviceFunctionData())
.append("alarmRuleStatus", getAlarmRuleStatus())
.append("alarmPushFlag", getAlarmPushFlag())
.append("alarmPushContent", getAlarmPushContent())
.append("alarmRecoverContent", getAlarmRecoverContent())
.append("remark", getRemark())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("alarmRuleField", getAlarmRuleField())
.toString();
}
}

@ -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);
}

@ -23,8 +23,6 @@ public interface IHwSceneService
public List<HwScene> selectHwSceneBySceneModeId(Long sceneModeId);
//场景选择
List<HwScene> selectHwSceneByTenantId(Long tenantId);
/**
*
*

@ -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);
}
}

@ -7,6 +7,7 @@ import java.util.List;
import com.ruoyi.business.domain.HwSceneMode;
import com.ruoyi.business.domain.VO.HwSceneVo;
import com.ruoyi.common.core.constant.HwDictConstants;
import com.ruoyi.common.core.utils.DateUtils;
import com.ruoyi.common.redis.service.RedisService;
import com.ruoyi.common.security.utils.SecurityUtils;
@ -26,8 +27,7 @@ import com.ruoyi.business.service.IHwSceneService;
* @date 2023-08-23
*/
@Service
public class HwSceneServiceImpl implements IHwSceneService
{
public class HwSceneServiceImpl implements IHwSceneService {
@Autowired
private HwSceneMapper hwSceneMapper;
@Autowired
@ -41,8 +41,7 @@ public class HwSceneServiceImpl implements IHwSceneService
* @return
*/
@Override
public HwScene selectHwSceneBySceneId(Long sceneId)
{
public HwScene selectHwSceneBySceneId(Long sceneId) {
return hwSceneMapper.selectHwSceneBySceneId(sceneId);
}
@ -53,17 +52,6 @@ public class HwSceneServiceImpl implements IHwSceneService
return hwScenes;
}
@Override
public List<HwScene> selectHwSceneByTenantId(Long tenantId) {
if (tenantId == 0){
return hwSceneMapper.selectHwSceneByTenantId0(tenantId);
}
else
return hwSceneMapper.selectHwSceneByTenantIdNot0(tenantId);
}
/**
*
*
@ -71,9 +59,26 @@ public class HwSceneServiceImpl implements IHwSceneService
* @return
*/
@Override
public List<HwScene> selectHwSceneList(HwScene hwScene)
{
return hwSceneMapper.selectHwSceneList(hwScene);
public List<HwScene> selectHwSceneList(HwScene hwScene) {
// LoginUser loginUser = SecurityUtils.getLoginUser();
// SysUser sysUser = loginUser.getSysUser();
// Long tenantId = sysUser.getTenantId();
Long tenantId = 1L;
if (tenantId != 0L) {//如果不是金瑞铭,则只能返回租户自己的场景
hwScene.setTenantId(tenantId);
}
List<HwScene> scenes = hwSceneMapper.selectHwSceneList(hwScene);
boolean defaultFlag = false;
for (HwScene scene : scenes) {
if (defaultFlag) {
scene.setDefaultFlag(HwDictConstants.DEVICE_DEFAULT_FLAG_NO);
} else {
if (scene.getDefaultFlag().equalsIgnoreCase(HwDictConstants.DEVICE_DEFAULT_FLAG_YES)) {
defaultFlag = true;
}
}
}
return scenes;
}
@Override
@ -89,10 +94,9 @@ public class HwSceneServiceImpl implements IHwSceneService
* @return
*/
@Override
public int insertHwScene(HwScene hwScene)
{
if(hwScene.getDefaultFlag() == "1"){
hwSceneMapper.updateDefaultFlag(hwScene.getTenantId());
public int insertHwScene(HwScene hwScene) {
if (hwScene.getDefaultFlag() == "1") {
hwSceneMapper.updateDefaultFlag(hwScene.getTenantId());
}
hwScene.setDefaultFlag("1");
LoginUser loginUser = SecurityUtils.getLoginUser();
@ -102,20 +106,20 @@ public class HwSceneServiceImpl implements IHwSceneService
hwScene.setSceneId(lon);
hwScene.setCreateBy(sysUser.getNickName());
if (hwScene.getPreserveTime()==null){
if (hwScene.getPreserveTime() == null) {
hwScene.setPreserveTime(new BigDecimal(90));
}
if (hwScene.getTestPreserveTime()==null){
if (hwScene.getTestPreserveTime() == null) {
hwScene.setTestPreserveTime(new BigDecimal(30));
}
String randomKey = RandomStringUtils.random(12, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789");
String randomSecret = RandomStringUtils.random(16,"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789");
String randomSecret = RandomStringUtils.random(16, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123456789");
hwScene.setModeKey(randomKey);
hwScene.setModeSecret(randomSecret);
hwScene.setCreateTime(DateUtils.getNowDate());
List<HwScene> list = new ArrayList<HwScene>();
list.add(hwScene);
redisService.setCacheList(hwScene.getSceneId()+"",list);
redisService.setCacheList(hwScene.getSceneId() + "", list);
return hwSceneMapper.insertHwScene(hwScene);
}
@ -127,16 +131,15 @@ public class HwSceneServiceImpl implements IHwSceneService
* @return
*/
@Override
public int updateHwScene(HwScene hwScene)
{
if(hwScene.getDefaultFlag() == "1"){
public int updateHwScene(HwScene hwScene) {
if (hwScene.getDefaultFlag() == "1") {
hwSceneMapper.updateDefaultFlag(hwScene.getTenantId());
}
hwScene.setDefaultFlag("1");
hwScene.setUpdateTime(DateUtils.getNowDate());
List<HwScene> list = new ArrayList<HwScene>();
list.add(hwScene);
redisService.setCacheList(hwScene.getSceneId()+"",list);
redisService.setCacheList(hwScene.getSceneId() + "", list);
return hwSceneMapper.updateHwScene(hwScene);
}
@ -147,13 +150,12 @@ public class HwSceneServiceImpl implements IHwSceneService
* @return
*/
@Override
public int deleteHwSceneBySceneIds(Long[] sceneIds)
{
public int deleteHwSceneBySceneIds(Long[] sceneIds) {
List<Long> list = new ArrayList<>();
for (int i = 0; i < sceneIds.length;i++){
for (int i = 0; i < sceneIds.length; i++) {
list.add(sceneIds[i]);
}
redisService.deleteObject(sceneIds+"");
redisService.deleteObject(sceneIds + "");
return hwSceneMapper.deleteHwSceneBySceneIds(sceneIds);
}
@ -164,9 +166,8 @@ public class HwSceneServiceImpl implements IHwSceneService
* @return
*/
@Override
public int deleteHwSceneBySceneId(Long sceneId)
{
redisService.deleteObject(sceneId+"");
public int deleteHwSceneBySceneId(Long sceneId) {
redisService.deleteObject(sceneId + "");
return hwSceneMapper.deleteHwSceneBySceneId(sceneId);
}
}

@ -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>

@ -88,6 +88,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="sceneEnvironment != null and sceneEnvironment != ''"> and scene_environment = #{sceneEnvironment}</if>
<if test="sceneField != null and sceneField != ''"> and scene_field = #{sceneField}</if>
</where>
order by scene_id desc
</select>
<select id="selectHwSceneByTenantId0" parameterType="Long" resultMap="HwSceneResult">
<include refid="selectHwSceneVo"/>

Loading…
Cancel
Save