package com.ruoyi.rocketmq.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.rocketmq.mapper.RmAlarmRuleMapper;
import com.ruoyi.rocketmq.domain.RmAlarmRule;
import com.ruoyi.rocketmq.service.IRmAlarmRuleService;

/**
 * 告警规则Service业务层处理
 * 
 * @author gyt
 * @date 2025-09-12
 */
@Service
public class RmAlarmRuleServiceImpl implements IRmAlarmRuleService 
{
    @Autowired
    private RmAlarmRuleMapper rmAlarmRuleMapper;

    /**
     * 查询告警规则
     * 
     * @param id 告警规则主键
     * @return 告警规则
     */
    @Override
    public RmAlarmRule selectRmAlarmRuleById(Long id)
    {
        return rmAlarmRuleMapper.selectRmAlarmRuleById(id);
    }

    /**
     * 查询告警规则列表
     * 
     * @param rmAlarmRule 告警规则
     * @return 告警规则
     */
    @Override
    public List<RmAlarmRule> selectRmAlarmRuleList(RmAlarmRule rmAlarmRule)
    {
        return rmAlarmRuleMapper.selectRmAlarmRuleList(rmAlarmRule);
    }

    /**
     * 新增告警规则
     * 
     * @param rmAlarmRule 告警规则
     * @return 结果
     */
    @Override
    public int insertRmAlarmRule(RmAlarmRule rmAlarmRule)
    {
        rmAlarmRule.setCreateTime(DateUtils.getNowDate());
        return rmAlarmRuleMapper.insertRmAlarmRule(rmAlarmRule);
    }

    /**
     * 修改告警规则
     * 
     * @param rmAlarmRule 告警规则
     * @return 结果
     */
    @Override
    public int updateRmAlarmRule(RmAlarmRule rmAlarmRule)
    {
        rmAlarmRule.setUpdateTime(DateUtils.getNowDate());
        return rmAlarmRuleMapper.updateRmAlarmRule(rmAlarmRule);
    }

    /**
     * 批量删除告警规则
     * 
     * @param ids 需要删除的告警规则主键
     * @return 结果
     */
    @Override
    public int deleteRmAlarmRuleByIds(Long[] ids)
    {
        return rmAlarmRuleMapper.deleteRmAlarmRuleByIds(ids);
    }

    /**
     * 删除告警规则信息
     * 
     * @param id 告警规则主键
     * @return 结果
     */
    @Override
    public int deleteRmAlarmRuleById(Long id)
    {
        return rmAlarmRuleMapper.deleteRmAlarmRuleById(id);
    }
}
