package com.pm.subsystem.service.impl;

import java.util.List;
import com.pm.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pm.subsystem.mapper.IbmsBroadcastDeviceMapper;
import com.pm.subsystem.service.IIbmsBroadcastDeviceService;
import com.pm.common.config.PageData;

/**
 * 广播设备Service业务层处理
 *
 * @author system
 * @date 2025-01-06
 */
@Service
public class IbmsBroadcastDeviceServiceImpl implements IIbmsBroadcastDeviceService
{
    @Autowired
    private IbmsBroadcastDeviceMapper ibmsBroadcastDeviceMapper;

    /**
     * 查询广播设备
     *
     * @param id 广播设备主键
     * @return 广播设备
     */
    @Override
    public PageData selectIbmsBroadcastDeviceById(Long id)
    {
        return ibmsBroadcastDeviceMapper.selectIbmsBroadcastDeviceById(id);
    }

    /**
     * 查询广播设备列表
     *
     * @param pd
     * @return 广播设备
     */
    @Override
    public List<PageData> selectIbmsBroadcastDeviceList(PageData pd)
    {
        return ibmsBroadcastDeviceMapper.selectIbmsBroadcastDeviceList(pd);
    }

    /**
     * 获取设备统计信息
     *
     * @return 统计信息
     */
    @Override
    public PageData getDeviceStatistics()
    {
        return ibmsBroadcastDeviceMapper.selectDeviceStatistics();
    }

    /**
     * 根据分区ID查询设备
     *
     * @param zoneId 分区ID
     * @return 设备集合
     */
    @Override
    public List<PageData> getDevicesByZoneId(Long zoneId)
    {
        return ibmsBroadcastDeviceMapper.selectDevicesByZoneId(zoneId);
    }

    /**
     * 新增广播设备
     *
     * @param pd
     * @return 结果
     */
    @Override
    public int insertIbmsBroadcastDevice(PageData pd)
    {
        pd.put("createTime", DateUtils.getTime());
        pd.put("updateTime", DateUtils.getTime());
        return ibmsBroadcastDeviceMapper.insertIbmsBroadcastDevice(pd);
    }

    /**
     * 修改广播设备
     *
     * @param pd
     * @return 结果
     */
    @Override
    public int updateIbmsBroadcastDevice(PageData pd)
    {
        pd.put("updateTime", DateUtils.getTime());
        return ibmsBroadcastDeviceMapper.updateIbmsBroadcastDevice(pd);
    }

    /**
     * 批量删除广播设备
     *
     * @param ids 需要删除的广播设备主键
     * @return 结果
     */
    @Override
    public int deleteIbmsBroadcastDeviceByIds(Long[] ids)
    {
        return ibmsBroadcastDeviceMapper.deleteIbmsBroadcastDeviceByIds(ids);
    }

    /**
     * 删除广播设备信息
     *
     * @param id 广播设备主键
     * @return 结果
     */
    @Override
    public int deleteIbmsBroadcastDeviceById(Long id)
    {
        return ibmsBroadcastDeviceMapper.deleteIbmsBroadcastDeviceById(id);
    }
}