package com.pm.waring.service.impl;

import java.util.List;

import com.pm.common.config.PageData;
import com.pm.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pm.waring.mapper.IbmsDeviceAlarmMapper;
import com.pm.waring.service.IIbmsDeviceAlarmService;

/**
 * 设备告警Service业务层处理
 *
 * @author LiXiangFei
 * @date 2025-04-16
 */
@Service
public class IbmsDeviceAlarmServiceImpl implements IIbmsDeviceAlarmService
{
    @Autowired
    private IbmsDeviceAlarmMapper ibmsDeviceAlarmMapper;

    /**
     * 查询设备告警
     *
     * @param id 设备告警主键
     * @return 设备告警
     */
    @Override
    public PageData selectIbmsDeviceAlarmById(Long id)
    {
        return ibmsDeviceAlarmMapper.selectIbmsDeviceAlarmById(id);
    }

    /**
     * 查询设备告警列表
     *
     * @param pd 设备告警
     * @return 设备告警
     */
    @Override
    public List<PageData> selectIbmsDeviceAlarmList(PageData pd)
    {
        return ibmsDeviceAlarmMapper.selectIbmsDeviceAlarmList(pd);
    }

    /**
     * 新增设备告警
     *
     * @param pd 设备告警
     * @return 结果
     */
    @Override
    public int insertIbmsDeviceAlarm(PageData pd)
    {
        pd.put("createTime", DateUtils.getTime());
        return ibmsDeviceAlarmMapper.insertIbmsDeviceAlarm(pd);
    }

    /**
     * 修改设备告警
     *
     * @param pd 设备告警
     * @return 结果
     */
    @Override
    public int updateIbmsDeviceAlarm(PageData pd)
    {
        pd.put("updateTime", DateUtils.getTime());
        return ibmsDeviceAlarmMapper.updateIbmsDeviceAlarm(pd);
    }

    /**
     * 批量删除设备告警
     *
     * @param ids 需要删除的设备告警主键
     * @return 结果
     */
    @Override
    public int deleteIbmsDeviceAlarmByIds(Long[] ids)
    {
        return ibmsDeviceAlarmMapper.deleteIbmsDeviceAlarmByIds(ids);
    }

    /**
     * 删除设备告警信息
     *
     * @param id 设备告警主键
     * @return 结果
     */
    @Override
    public int deleteIbmsDeviceAlarmById(Long id)
    {
        return ibmsDeviceAlarmMapper.deleteIbmsDeviceAlarmById(id);
    }
}
