package com.hw.ems.record.service.impl;

import java.util.List;

import com.hw.common.core.utils.DateUtils;
import com.hw.ems.record.mapper.RecordAlarmRuleMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.hw.ems.record.domain.RecordAlarmRule;
import com.hw.ems.record.service.IRecordAlarmRuleService;

/**
 * 异常告警规则Service业务层处理
 *
 * @author sf
 * @date 2023-04-21
 */
@Service
public class RecordAlarmRuleServiceImpl implements IRecordAlarmRuleService {
    @Autowired
    private RecordAlarmRuleMapper recordAlarmRuleMapper;

    /**
     * 查询异常告警规则
     *
     * @param objId 异常告警规则主键
     * @return 异常告警规则
     */
    @Override
    //@DS("#header.poolName")
    public RecordAlarmRule selectRecordAlarmRuleByObjId(Long objId) {
        return recordAlarmRuleMapper.selectRecordAlarmRuleByObjId(objId);
    }

    /**
     * 查询异常告警规则列表
     *
     * @param recordAlarmRule 异常告警规则
     * @return 异常告警规则
     */
    @Override
    //@DS("#header.poolName")
    public List<RecordAlarmRule> selectRecordAlarmRuleList(RecordAlarmRule recordAlarmRule) {
        return recordAlarmRuleMapper.selectRecordAlarmRuleList(recordAlarmRule);
    }

    /**
     * 新增异常告警规则
     *
     * @param recordAlarmRule 异常告警规则
     * @return 结果
     */
    @Override
    //@DS("#header.poolName")
    public int insertRecordAlarmRule(RecordAlarmRule recordAlarmRule) {
        recordAlarmRule.setCreateTime(DateUtils.getNowDate());
        return recordAlarmRuleMapper.insertRecordAlarmRule(recordAlarmRule);
    }

    /**
     * 修改异常告警规则
     *
     * @param recordAlarmRule 异常告警规则
     * @return 结果
     */
    @Override
    //@DS("#header.poolName")
    public int updateRecordAlarmRule(RecordAlarmRule recordAlarmRule) {
        recordAlarmRule.setUpdateTime(DateUtils.getNowDate());
        return recordAlarmRuleMapper.updateRecordAlarmRule(recordAlarmRule);
    }

    /**
     * 批量删除异常告警规则
     *
     * @param objIds 需要删除的异常告警规则主键
     * @return 结果
     */
    @Override
    //@DS("#header.poolName")
    public int deleteRecordAlarmRuleByObjIds(Long[] objIds) {
        return recordAlarmRuleMapper.deleteRecordAlarmRuleByObjIds(objIds);
    }

    /**
     * 删除异常告警规则信息
     *
     * @param objId 异常告警规则主键
     * @return 结果
     */
    @Override
    //@DS("#header.poolName")
    public int deleteRecordAlarmRuleByObjId(Long objId) {
        return recordAlarmRuleMapper.deleteRecordAlarmRuleByObjId(objId);
    }
}
