package com.bonus.canteen.core.device.service.impl;

import java.util.List;
import com.bonus.common.core.exception.ServiceException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.bonus.canteen.core.device.mapper.DeviceGlobalSettingMapper;
import com.bonus.canteen.core.device.domain.DeviceGlobalSetting;
import com.bonus.canteen.core.device.service.IDeviceGlobalSettingService;

/**
 * 设备参数Service业务层处理
 * 
 * @author xsheng
 * @date 2025-05-25
 */
@Service
public class DeviceGlobalSettingServiceImpl implements IDeviceGlobalSettingService {
    @Autowired
    private DeviceGlobalSettingMapper deviceGlobalSettingMapper;

    /**
     * 查询设备参数
     * 
     * @param id 设备参数主键
     * @return 设备参数
     */
    @Override
    public DeviceGlobalSetting selectDeviceGlobalSettingById(Long id) {
        return deviceGlobalSettingMapper.selectDeviceGlobalSettingById(id);
    }

    /**
     * 查询设备参数列表
     * 
     * @param deviceGlobalSetting 设备参数
     * @return 设备参数
     */
    @Override
    public List<DeviceGlobalSetting> selectDeviceGlobalSettingList(DeviceGlobalSetting deviceGlobalSetting) {
        return deviceGlobalSettingMapper.selectDeviceGlobalSettingList(deviceGlobalSetting);
    }

    /**
     * 新增设备参数
     * 
     * @param deviceGlobalSetting 设备参数
     * @return 结果
     */
    @Override
    public int insertDeviceGlobalSetting(DeviceGlobalSetting deviceGlobalSetting) {
        try {
            return deviceGlobalSettingMapper.insertDeviceGlobalSetting(deviceGlobalSetting);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 修改设备参数
     * 
     * @param deviceGlobalSetting 设备参数
     * @return 结果
     */
    @Override
    public int updateDeviceGlobalSetting(DeviceGlobalSetting deviceGlobalSetting) {
        try {
            return deviceGlobalSettingMapper.updateDeviceGlobalSetting(deviceGlobalSetting);
        } catch (Exception e) {
            throw new ServiceException(e.getMessage());
        }
    }

    /**
     * 批量删除设备参数
     * 
     * @param ids 需要删除的设备参数主键
     * @return 结果
     */
    @Override
    public int deleteDeviceGlobalSettingByIds(Long[] ids) {
        return deviceGlobalSettingMapper.deleteDeviceGlobalSettingByIds(ids);
    }

    /**
     * 删除设备参数信息
     * 
     * @param id 设备参数主键
     * @return 结果
     */
    @Override
    public int deleteDeviceGlobalSettingById(Long id) {
        return deviceGlobalSettingMapper.deleteDeviceGlobalSettingById(id);
    }
}
