diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java index 30be5cc..bf75ffc 100644 --- a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwAlarmRuleServiceImpl.java @@ -117,14 +117,21 @@ public class HwAlarmRuleServiceImpl implements IHwAlarmRuleService { @Transactional @Override public int insertHwAlarmRule(HwAlarmRule hwAlarmRule) { - String triggerExpression = this.getTriggerExpression(hwAlarmRule); - hwAlarmRule.setTriggerExpression(triggerExpression); - hwAlarmRule.setAlarmPushFlag(HwDictConstants.ALARM_PUSH_FLAG_NO); - hwAlarmRule.setCreateTime(DateUtils.getNowDate()); - hwAlarmRule.setTenantId(SecurityUtils.getTenantId()); - hwAlarmRule.setCreateBy(SecurityUtils.getUsername()); - int rows = hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule); - insertHwAlarmRuleLink(hwAlarmRule); + List ruleDeviceIds = hwAlarmRule.getRuleDeviceIds(); + int rows = 0; + for (Long ruleDeviceId : ruleDeviceIds) { + hwAlarmRule.setRuleDeviceId(ruleDeviceId); + String triggerExpression = this.getTriggerExpression(hwAlarmRule); + hwAlarmRule.setTriggerExpression(triggerExpression); + hwAlarmRule.setAlarmPushFlag(HwDictConstants.ALARM_PUSH_FLAG_NO); + hwAlarmRule.setCreateTime(DateUtils.getNowDate()); + hwAlarmRule.setTenantId(SecurityUtils.getTenantId()); + hwAlarmRule.setCreateBy(SecurityUtils.getUsername()); + int rowsAdd = hwAlarmRuleMapper.insertHwAlarmRule(hwAlarmRule); + insertHwAlarmRuleLink(hwAlarmRule); + rows += rowsAdd; + } + return rows; } diff --git a/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java new file mode 100644 index 0000000..f9ffec5 --- /dev/null +++ b/ruoyi-modules/hw-business/src/main/java/com/ruoyi/business/service/impl/HwOfflineRuleServiceImpl.java @@ -0,0 +1,19 @@ +package com.ruoyi.business.service.impl; + +import com.ruoyi.business.domain.HwOfflineRule; +import com.ruoyi.business.mapper.HwOfflineRuleMapper; +import com.ruoyi.business.service.HwOfflineRuleService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import java.util.List; +@Service +public class HwOfflineRuleServiceImpl implements HwOfflineRuleService { + @Autowired + private HwOfflineRuleMapper hwOfflineRuleMapper; + @Override + public List selectRuleList(HwOfflineRule hwOfflineRule) { + List hwOfflineRules = hwOfflineRuleMapper.selectHwOfflineRuleJoinList(hwOfflineRule); + return hwOfflineRules; + } +}