package org.jeecg.modules.sensor.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.bigScreen.controller.bigScreenController;
import org.jeecg.modules.bigScreen.model.SensorTemperature;
import org.jeecg.modules.bigScreen.model.TableStructure;
import org.jeecg.modules.sensor.entity.BuSensor;
import org.jeecg.modules.sensor.model.DeviceDataRequest;
import org.jeecg.modules.sensor.model.TableNameStatistics;

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

/**
 * @Description: 传感器信息表
 * @Author: jeecg-boot
 * @Date:   2020-12-23
 * @Version: V1.0
 */
public interface BuSensorMapper extends BaseMapper<BuSensor> {

    List<BuSensor> getDataByName(@Param("name") String name);

    List<String> getBatteryVoltage(@Param("deviceName") String deviceName);

    BuSensor getValueById(@Param("deviceId") String deviceId,@Param("item") String item);

    List<String> getIpByName(@Param("deviceName") String deviceName);
    List<String> getHeightIpByName(@Param("deviceName") String deviceName);
    List<String> getElectricIpByName(@Param("deviceName") String deviceName);

    List<TableNameStatistics> getDataByDeviceId(@Param("deviceId") String deviceId);
    List<TableNameStatistics> getItemByDeviceId(@Param("deviceId") String deviceId);

    BuSensor getDataByTypeId(@Param("typeId") String typeId);

    BuSensor getDataByIp(@Param("ip") String ip);

    List<String> getNormalStatus();
    List<BuSensor> getEarlyStatus();
    List<BuSensor> getAlarmStatus();
    List<BuSensor> getRepairStatus();

    List<BuSensor> getPowerData();
    List<BuSensor> getBoardData();

    BuSensor getByCheckItem(@Param("deviceId") String deviceId,@Param("checkItem") String checkItem);
    List<BuSensor> getByCheckName(@Param("deviceId")String deviceId,@Param("name")String name);
    //根据设备id和传感器id
    BuSensor getBySensorId(@Param("deviceId")String deviceId,@Param("sensorId")String sensorId);

    BuSensor getByCode(@Param("deviceId")String deviceId,@Param("code")String code);

    List<String> getVibrationSensorIp();

    double getTemperature(@Param("tableName") String tableName);

    List<DeviceDataRequest> getDeviceData(@Param("tableName") String tableName,@Param("ip")String ip,@Param("beginTime") String beginTime,
                                          @Param("endTime") String endTime);

    SensorTemperature getTestClassData(@Param("tableName") String tableName, @Param("dataId") String dataId);

    List<TableStructure> getTableStrutureData(@Param("tableName") String tableName);

    Map<String, Object> getValueByField(@Param("tableName") String tableName, @Param("dataId") String dataId, @Param("field") String field);

    BuSensor getCodeData(@Param("sensorId")String sensorId);
}
