package org.jeecg.modules.sensor.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.jeecg.modules.energy.entity.BuElectric;
import org.jeecg.modules.sensor.entity.BuSensorDeviceData;
import org.jeecg.modules.sensor.model.SensorDataHourStatistics;
import org.jeecg.modules.sensor.model.SensorDataStatistics;
import org.jeecg.modules.sensor.model.TableNameStatistics;

import java.util.List;

/**
 * @Description: 设备传感器数据表
 * @Author: jeecg-boot
 * @Date:   2021-02-07
 * @Version: V1.0
 */
public interface BuSensorDeviceDataMapper extends BaseMapper<BuSensorDeviceData> {

    public List<SensorDataStatistics> timeDataStatistics(@Param("beginTime") String beginTime,@Param("endTime") String endTime,
                                                         @Param("deviceId") String deviceId,@Param("result") List<String> result,
                                                         @Param("sensorId") String sensorId);

//    public List<SensorDataStatistics> dayDataStatistics(@Param("time") String time,@Param("deviceId") String deviceId, @Param("sensorId") String sensorId);
//    public List<SensorDataStatistics> dayDataStatistics(@Param("time") String time,@Param("deviceId") String deviceId, @Param("result") List<String> result);
//    public List<SensorDataHourStatistics> hourDataStatistics(@Param("time") String time, @Param("deviceId") String deviceId, @Param("result") List<String> result);


    public List<TableNameStatistics> getNameValue(@Param("sensorId") String sensorId,@Param("deviceId") String deviceId);

    public List<SensorDataHourStatistics> getDataValue(@Param("sensorId") String sensorId,@Param("deviceId") String deviceId);

    public List<String> getSelectTimes(@Param("beginTime") String beginTime,@Param("endTime") String endTime);

    public List<String> getSelectTime(@Param("node") String node,@Param("beginTime") String beginTime,@Param("endTime") String endTime);

    public List<BuSensorDeviceData> getTestData(@Param("tableName") String tableName,@Param("sensorId") String sensorId,
                                                @Param("beginTime") String beginTime,@Param("endTime") String endTime);
    public List<BuSensorDeviceData> getOnlineTestData(@Param("tableName") String tableName,@Param("sensorId") String sensorId);

    public List<BuSensorDeviceData> getTimeData(@Param("tableName")String tableName,@Param("sensorId")String sensorId,@Param("year")String year,@Param("month")String month);
    public List<BuSensorDeviceData> getAllTimeData(@Param("sensorId")String sensorId,@Param("year")String year,@Param("month")String month);
    public List<BuSensorDeviceData> getCalendarData(@Param("year")String year,@Param("month")String month);
    public List<BuSensorDeviceData> getTestDatas(@Param("node") String node,@Param("time") String time);

    public BuElectric getLastVoltage(@Param("tableName") String tableName, @Param("sensorId") String sensorId);
    public BuSensorDeviceData getLastVoltages(@Param("tableName") String tableName,@Param("ip") String ip);

    public BuSensorDeviceData getUByTime(@Param("time") String time);
    public BuSensorDeviceData getIByTime(@Param("time") String time);

    List<BuSensorDeviceData> getCustomFieldData(String tableName, String fields, String sensorId, String beginTime, String endTime);

//    public List<BuSensorDeviceData> getChartSelect(@Param("ip") String ip,@Param("tableName") String tableName,
//                                             @Param("beginTime") String beginTime,@Param("endTime") String endTime);


}
