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.CentermonitorTMonitoringThresholdSoilMoisture;
import com.sooka.sponest.monitor.device.mapper.CentermonitorTMonitoringDeviceSoilMoistureThresholdMapper;
import com.sooka.sponest.monitor.device.mapper.CentermonitorTMonitoringDeviceThresholdMapper;
import com.sooka.sponest.monitor.device.service.ICentermonitorTMonitoringDeviceSoilMoistureThresholdService;
import com.sooka.sponest.monitor.device.service.ICentermonitorTMonitoringDeviceThresholdService;
import org.springframework.stereotype.Service;

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

@Service
public class CentermonitorTMonitoringDeviceSoilMoistureThresholdServiceImpl extends BaseService implements ICentermonitorTMonitoringDeviceSoilMoistureThresholdService {
    @Resource
    private CentermonitorTMonitoringDeviceSoilMoistureThresholdMapper deviceSoilMoistureThresholdMapper;

    /**
     * 通过设备编码查询土壤传感器阈值
     * */
    @Override
    public CentermonitorTMonitoringThresholdSoilMoisture selectSoilMoistureThresholdByCode(String deviceCode) {
        return deviceSoilMoistureThresholdMapper.selectSoilMoistureThresholdByCode(deviceCode);
    }

    /**
     * 通过设备编码组查询土壤传感器阈值
     * */
    @Override
    public List<CentermonitorTMonitoringThresholdSoilMoisture> selectSoilMoistureThresholdByCodes(String[] deviceCodes){
        return deviceSoilMoistureThresholdMapper.selectSoilMoistureThresholdByCodes(deviceCodes);
    }

    /**
     * 新增土壤监测设备阈值
     */
    @Override
    public int insertSoilMoistureThreshold(CentermonitorTMonitoringThresholdSoilMoisture thresholdSoilMoisture){
        thresholdSoilMoisture.setId(IdUtils.simpleUUID());
        return deviceSoilMoistureThresholdMapper.insertSoilMoistureThreshold(thresholdSoilMoisture);
    }

    /**
     * 修改土壤监测设备阈值
     */
    @Override
    public int updateSoilMoistureThreshold(CentermonitorTMonitoringThresholdSoilMoisture thresholdSoilMoisture){
        return deviceSoilMoistureThresholdMapper.updateSoilMoistureThreshold(thresholdSoilMoisture);
    }
}
