package com.sooka.sponest.monitor.device.service.impl;

import com.ruoyi.common.core.utils.uuid.IdUtils;
import com.sooka.sponest.monitor.base.service.impl.BaseService;
import com.sooka.sponest.monitor.device.domain.CentermonitorTMonitoringThresholdWaterVelocity;
import com.sooka.sponest.monitor.device.mapper.CentermonitorTMonitoringDeviceMapper;
import com.sooka.sponest.monitor.device.mapper.CentermonitorTMonitoringDeviceThresholdMapper;
import com.sooka.sponest.monitor.device.service.ICentermonitorTMonitoringDeviceThresholdService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class CentermonitorTMonitoringDeviceThresholdServiceImpl  extends BaseService implements ICentermonitorTMonitoringDeviceThresholdService {
    @Resource
    private CentermonitorTMonitoringDeviceThresholdMapper deviceThresholdMapper;

    /**
     * 通过设备编码查询水流速传感器阈值
     * */
    @Override
    public CentermonitorTMonitoringThresholdWaterVelocity selectWaterVelocityThresholdByCode(String deviceCode) {
        return deviceThresholdMapper.selectWaterVelocityThresholdByCode(deviceCode);
    }

    /**
     * 通过设备编码组查询水流速传感器阈值
     * */
    @Override
    public List<CentermonitorTMonitoringThresholdWaterVelocity> selectWaterVelocityThresholdByCodes(String[] deviceCodes){
        return deviceThresholdMapper.selectWaterVelocityThresholdByCodes(deviceCodes);
    }

    /**
     * 新增水流速监测设备阈值
     */
    @Override
    public int insertWaterVelocityThreshold(CentermonitorTMonitoringThresholdWaterVelocity thresholdWaterVelocity){
        thresholdWaterVelocity.setId(IdUtils.simpleUUID());
        return deviceThresholdMapper.insertWaterVelocityThreshold(thresholdWaterVelocity);
    }

    /**
     * 修改水流速监测设备阈值
     */
    @Override
    public int updateWaterVelocityThreshold(CentermonitorTMonitoringThresholdWaterVelocity thresholdWaterVelocity){
        return deviceThresholdMapper.updateWaterVelocityThreshold(thresholdWaterVelocity);
    }
}
