package com.sooka.sponest.monitor.device.mapper;

import com.sooka.sponest.monitor.aidevicedept.domain.CenterdataTAidevicedept;
import com.sooka.sponest.monitor.camera.domain.CentermonitorTCameraType;
import com.sooka.sponest.monitor.device.domain.*;
import org.apache.ibatis.annotations.Param;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

/**
 * 监测设备Mapper接口
 *
 * @author ruoyi
 * @date 2023-03-14
 */
public interface CentermonitorTMonitoringDeviceMapper
{
    /**
     * 查询监测设备
     *
     * @param id 监测设备主键
     * @return 监测设备
     */
     CentermonitorTMonitoringDevice selectCentermonitorTMonitoringDeviceById(String id);

    //水流速
     CentermonitorTMonitoringDataWaterVelocity selectWaterVelocityCentermonitorByST(String id);
    //土壤墒情
     CentermonitorTMonitoringDataSoilMoisture selectSoilMoistureCentermonitorByDeviceCode(String id);
    //大气
     CentermonitorTMonitoringDataAtmosphere selectAtmosphereCentermonitorByDeviceCode(String id);
    //水质
     CentermonitorTMonitoringDataWaterQuality selectWaterQualityCentermonitorByDeviceCode(String id);
    //水压
     CentermonitorTMonitoringDataWaterPressure selectWaterPressureCentermonitorByIMEI(String id);
    //病虫害
     CentermonitorTMonitoringDataInsectPests selectInsectPestsCentermonitorByDeviceCode(String id);

    //水流速
     CentermonitorTMonitoringDataWaterVelocity selectWaterVelocityCentermonitorBySTCode(String deviceCode);
    //土壤墒情
     CentermonitorTMonitoringDataSoilMoisture selectSoilMoistureCentermonitorByCode(String deviceCode);
    //大气
     CentermonitorTMonitoringDataAtmosphere selectAtmosphereCentermonitorByCode(String deviceCode);
    //水质
     CentermonitorTMonitoringDataWaterQuality selectWaterQualityCentermonitorByCode(String deviceCode);
    //水压
     CentermonitorTMonitoringDataWaterPressure selectWaterPressureCentermonitorByIMEICode(String deviceCode);
    //病虫害
     CentermonitorTMonitoringDataInsectPests selectInsectPestsCentermonitorByCode(String deviceCode);

    /**
     * 查询大气传感器PM2.5和PM10的24小时平均值数据
     */
     CentermonitorTMonitoringDataAtmosphere selectAtmosphereAVGData(@Param("deviceCode") String deviceCode, @Param("startTime") String startTime, @Param("endTime") String endTime);

    /**
     * 查询监测设备列表
     *
     * @param centermonitorTMonitoringDevice 监测设备
     * @return 监测设备集合
     */
     List<CentermonitorTMonitoringDevice> selectCentermonitorTMonitoringDeviceList(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    /**
     * 根据部门ID和工作状态查询传感器列表
     *
     * @param centermonitorTMonitoringDevice 传感器
     * @return 传感器集合
     */
     List<CentermonitorTMonitoringDevice> selectDeviceListByDeptIdAndWorkingStatus(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    /**
     * 查询监测设备列表(所有)
     *
     * @param centermonitorTMonitoringDevice 监测设备
     * @return 监测设备集合
     */
     List<CentermonitorTMonitoringDevice> selectCentermonitorTMonitoringDeviceListAll(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    /**
     * 新增监测设备
     *
     * @param centermonitorTMonitoringDevice 监测设备
     * @return 结果
     */
     int insertCentermonitorTMonitoringDevice(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);
     int insertCentermonitorTCameraType(CentermonitorTCameraType type);
     List<CentermonitorTMonitoringDevice> SelectTypeById(String id);

    /**
     * 删除监测设备
     *
     * @param id 需要删除的监测设备主键
     * @return 结果
     */
     int deleteTypeById(String id);
     int deleteDeviceDeptById(String id);
     int deleteAtmosphereThresholdByCode(String id);
     int deleteSoilMoistureThresholdByCode(String id);
     int deleteWaterQualityThresholdByCode(String id);
     int deleteWaterVelocityThresholdByCode(String id);
     int deleteWaterPressureThresholdByCode(String id);


    /**
     * 删除监测设备
     *
     * @param id 需要删除的监测设备主键
     * @return 结果
     */

    int deleteAtmosphereDataByCode(String id);
    int deleteSoilMoistureDataByCode(String id);
    int deleteWaterQualityDataByCode(String id);
    int deleteInsectPestsDataByCode(String id);
    int deleteWaterPressureDataByCode(String id);
    int deleteWaterVelocityDataByCode(String id);


    /**
     * 修改监测设备
     *
     * @param centermonitorTMonitoringDevice 监测设备
     * @return 结果
     */
     int updateCentermonitorTMonitoringDevice(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    /**
     * 删除监测设备
     *
     * @param id 监测设备主键
     * @return 结果
     */
     int deleteCentermonitorTMonitoringDeviceById(String id);

    /**
     * 批量删除监测设备
     *
     * @param ids 需要删除的数据主键集合
     * @return 结果
     */
     int deleteCentermonitorTMonitoringDeviceByIds(String[] ids);

    /**
     * 查询监测设备根据部门id
     *
     * @param str  监测设备
     * @return 监测设备设备集合
     */
     List<CentermonitorTMonitoringDevice> selectListByDeptId(@Param("str") List<String> str);

    /**
     * 查询水流速传感器数据列表
     *
     * @param centermonitorTMonitoringDataWaterVelocity 水质传感器
     * @return 监测设备集合
     */
     List<CentermonitorTMonitoringDataWaterVelocity> selectWaterVelocityMonitoringData(CentermonitorTMonitoringDataWaterVelocity centermonitorTMonitoringDataWaterVelocity);

    /**
     * 查询水质传感器数据列表
     *
     * @param centermonitorTMonitoringDataWaterQuality 水质传感器
     * @return 监测设备集合
     */
     List<CentermonitorTMonitoringDataWaterQuality> selectWaterQualityMonitoringData(CentermonitorTMonitoringDataWaterQuality centermonitorTMonitoringDataWaterQuality);

    /**
     * 查询土壤墒情传感器数据列表
     *
     * @param centermonitorTMonitoringDataSoilMoisture 水质传感器
     * @return 监测设备集合
     */
     List<CentermonitorTMonitoringDataSoilMoisture> selectSoilMoistureMonitoringData(CentermonitorTMonitoringDataSoilMoisture centermonitorTMonitoringDataSoilMoisture);

    /**
     * 查询大气传感器数据列表
     *
     * @param centermonitorTMonitoringDataAtmosphere 水质传感器
     * @return 监测设备集合
     */
     List<CentermonitorTMonitoringDataAtmosphere> selectAtmosphereMonitoringData(CentermonitorTMonitoringDataAtmosphere centermonitorTMonitoringDataAtmosphere);

    /**
     * 水压查询
     *
     * @param centermonitorTMonitoringDataWaterPressure 水压传感器
     * @return 监测设备集合
     */
     List<CentermonitorTMonitoringDataWaterPressure> selectWaterPressureMonitoringData(CentermonitorTMonitoringDataWaterPressure centermonitorTMonitoringDataWaterPressure);

    /**
     * 病虫害查询
     *
     * @param centermonitorTMonitoringDataInsectPests 病虫害传感器
     * @return 监测设备集合
     */
     List<CentermonitorTMonitoringDataInsectPests> selectInsectPestsMonitoringData(CentermonitorTMonitoringDataInsectPests centermonitorTMonitoringDataInsectPests);

    /**
     * 病虫害查询
     *
     * @param centerdataTAidevicedept 病虫害传感器
     * @return 监测设备集合
     */
     List<CenterdataTAidevicedept> selectDeptMonitoringData(CenterdataTAidevicedept centerdataTAidevicedept);

    /**
     * 按类型查询传感器设备编码数组
     * */
     List<Map<String,String>> selectDeviceCodeMap(CentermonitorTMonitoringDevice device);

    /**
     * 查询最新一条水质传感器监测数据 -- 根据设备编码数组
     */
     List<CentermonitorTMonitoringDataWaterQuality> selectWaterQualityDataByDeviceCodes(String[]  deviceCodes);

    /**
     * 查询最新一条土壤墒情传感器监测数据 -- 根据设备编码数组
     */
     List<CentermonitorTMonitoringDataSoilMoisture> selectSoilMoistureDataByDeviceCodes(String[]  deviceCodes);

    /**
     * 查询最新一条大气监测传感器监测数据 -- 根据设备编码数组
     */
     List<CentermonitorTMonitoringDataAtmosphere> selectAtmosphereDataByDeviceCodes(String[]  deviceCodes);

    /**
     * 查询最新一条水压监测传感器监测数据 -- 根据设备编码数组
     */
     List<CentermonitorTMonitoringDataWaterPressure> selectWaterPressureDataByDeviceCodes(String[]  deviceCodes);

    /**
     * 查询最新一条水流速传感器监测数据 -- 根据设备编码数组
     */
     List<CentermonitorTMonitoringDataWaterVelocity> selectWaterVelocityDataByDeviceCodes(String[]  deviceCodes);

    /**
     * 查询最新一条病虫害传感器监测数据 -- 根据设备编码数组
     */
     List<CentermonitorTMonitoringDataInsectPests> selectInsectPestsDataByDeviceCodes(String[]  deviceCodes);


    /**
     * 查询最新一条水质传感器监测数据 -- 根据设备编码
     */
     CentermonitorTMonitoringDataWaterQuality selectWaterQualityDataByDeviceCode(String  deviceCode);

    List<DeviceIoTEquipmentStatisticsResult> getIoTEquipmentStatistics(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    List<DeviceIoTEquipmentStatisticsResult> getOnLineSensorStatistics(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    List<CentermonitorTMonitoringDevice> getDeviceAnalysis(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    List<DeviceIoTEquipmentStatisticsResult> getOfflineReasonCountStatistics(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    List<CentermonitorTMonitoringDevice> getFaultDistribution(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    List<CentermonitorTMonitoringDevice> getSensorDataCount(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    List<CentermonitorTMonitoringDevice> getDeviceSquareNumber(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    CenterMonitorIoTEquipmentDetailsVO getIoTEquipmentDetails(CentermonitorTMonitoringDevice centermonitorTMonitoringDevice);

    CentermonitorTMonitoringDataWaterQualityIoTResult getIoTWaterQuality(@Param("deviceCode") String deviceCode, @Param("date") String date);

    CentermonitorTMonitoringDataSoilMoistureIoTResult getIoTSoil(@Param("deviceCode") String deviceCode, @Param("date") String date);

    CentermonitorTMonitoringDataInsectPestsIoTResult getIoTInsectPests(@Param("deviceCode") String deviceCode, @Param("date") String date);
    CentermonitorTMonitoringDataAtmosphereIoTResult getIoTAtmosphere(@Param("deviceCode") String deviceCode, @Param("date") String date);
    CentermonitorTMonitoringDataWaterPressureIoTResult getIoTWaterPressure(@Param("deviceCode") String deviceCode, @Param("date") String date);
    CentermonitorTMonitoringDataWaterVelocityIoTResult getIoTWaterVelocity(@Param("deviceCode") String deviceCode, @Param("date") String date);

    /**
     * 新增监测设备图片
     */
    int insertCentermonitorTDeviceImg(List<CentermonitorTMonitoringDeviceImg> images);

    /**
     * 查询监测设备图片
     */
    ArrayList<CentermonitorTMonitoringDeviceImg> selectCentermonitorTDeviceImgByDeviceId(String id);

    /**
     * 移除监测设备图片
     */
    void deleteImageByDeviceId(@Param("deviceId")String deviceId);
}
