package com.aucma.dms.service.impl;

//import com.hw.common.core.utils.DateUtils;
//import com.aucma.dms.domain.DmsBaseAlarmRule;
//import com.aucma.dms.mapper.DmsBaseAlarmRuleMapper;
//import com.aucma.dms.service.IDmsBaseAlarmRuleService;

import com.aucma.common.utils.DateUtils;
import com.aucma.dms.domain.DmsBaseAlarmRule;
import com.aucma.dms.mapper.DmsBaseAlarmRuleMapper;
import com.aucma.dms.service.IDmsBaseAlarmRuleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 设备报警规则Service业务层处理
 *
 * @author Yinq
 * @date 2024-08-13
 */
@Service
public class DmsBaseAlarmRuleServiceImpl implements IDmsBaseAlarmRuleService {
    @Autowired
    private DmsBaseAlarmRuleMapper dmsBaseAlarmRuleMapper;

    /**
     * 查询设备报警规则
     *
     * @param alarmRuleId 设备报警规则主键
     * @return 设备报警规则
     */
    @Override
    public DmsBaseAlarmRule selectDmsBaseAlarmRuleByAlarmRuleId(Long alarmRuleId) {
        return dmsBaseAlarmRuleMapper.selectDmsBaseAlarmRuleByAlarmRuleId(alarmRuleId);
    }

    /**
     * 查询设备报警规则列表
     *
     * @param dmsBaseAlarmRule 设备报警规则
     * @return 设备报警规则
     */
    @Override
    public List<DmsBaseAlarmRule> selectDmsBaseAlarmRuleList(DmsBaseAlarmRule dmsBaseAlarmRule) {
        return dmsBaseAlarmRuleMapper.selectDmsBaseAlarmRuleList(dmsBaseAlarmRule);
    }

    /**
     * 新增设备报警规则
     *
     * @param dmsBaseAlarmRule 设备报警规则
     * @return 结果
     */
    @Override
    public int insertDmsBaseAlarmRule(DmsBaseAlarmRule dmsBaseAlarmRule) {
        dmsBaseAlarmRule.setCreateTime(DateUtils.getNowDate());
        return dmsBaseAlarmRuleMapper.insertDmsBaseAlarmRule(dmsBaseAlarmRule);
    }

    /**
     * 修改设备报警规则
     *
     * @param dmsBaseAlarmRule 设备报警规则
     * @return 结果
     */
    @Override
    public int updateDmsBaseAlarmRule(DmsBaseAlarmRule dmsBaseAlarmRule) {
        dmsBaseAlarmRule.setUpdateTime(DateUtils.getNowDate());
        return dmsBaseAlarmRuleMapper.updateDmsBaseAlarmRule(dmsBaseAlarmRule);
    }

    /**
     * 批量删除设备报警规则
     *
     * @param alarmRuleIds 需要删除的设备报警规则主键
     * @return 结果
     */
    @Override
    public int deleteDmsBaseAlarmRuleByAlarmRuleIds(Long[] alarmRuleIds) {
        return dmsBaseAlarmRuleMapper.deleteDmsBaseAlarmRuleByAlarmRuleIds(alarmRuleIds);
    }

    /**
     * 删除设备报警规则信息
     *
     * @param alarmRuleId 设备报警规则主键
     * @return 结果
     */
    @Override
    public int deleteDmsBaseAlarmRuleByAlarmRuleId(Long alarmRuleId) {
        return dmsBaseAlarmRuleMapper.deleteDmsBaseAlarmRuleByAlarmRuleId(alarmRuleId);
    }
}
