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