package org.jeecg.modules.sensor.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.jeecg.modules.energy.entity.BuElectric;
import org.jeecg.modules.sensor.entity.BuSensorDeviceData;
import org.jeecg.modules.sensor.mapper.BuSensorDeviceDataMapper;
import org.jeecg.modules.sensor.model.SensorDataHourStatistics;
import org.jeecg.modules.sensor.model.SensorDataStatistics;
import org.jeecg.modules.sensor.model.TableNameStatistics;
import org.jeecg.modules.sensor.service.IBuSensorDeviceDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Description: 设备传感器数据表
 * @Author: jeecg-boot
 * @Date:   2021-02-07
 * @Version: V1.0
 */
@Service
public class BuSensorDeviceDataServiceImpl extends ServiceImpl<BuSensorDeviceDataMapper, BuSensorDeviceData> implements IBuSensorDeviceDataService {

    @Autowired
    private BuSensorDeviceDataMapper buSensorDeviceDataMapper;

    @Override
    public List<SensorDataStatistics> timeDataStatistics(String beginTime, String endTime, String deviceId, List<String> result, String sensorId){
        return buSensorDeviceDataMapper.timeDataStatistics(beginTime,endTime,deviceId,result,sensorId);
    }
//    @Override
//    public List<SensorDataStatistics> dayDataStatistics(String time,String deviceId, String sensorId){
//        return buSensorDeviceDataMapper.dayDataStatistics(time,deviceId,sensorId);
//    }
//    @Override
//    public List<SensorDataStatistics> dayDataStatistics(String time,String deviceId, List<String> result){
//        return buSensorDeviceDataMapper.dayDataStatistics(time,deviceId,result);
//    }
//    @Override
//    public List<SensorDataHourStatistics> hourDataStatistics(String time, String deviceId, List<String> result){
//        return buSensorDeviceDataMapper.hourDataStatistics(time,deviceId,result);
//    }
    //查询统计表的数据值和传感器名称
    @Override
    public List<TableNameStatistics> getNameValue(String sensorId,String deviceId){
        return buSensorDeviceDataMapper.getNameValue(sensorId,deviceId);
    }

    @Override
    public List<SensorDataHourStatistics> getDataValue(String sensorId,String deviceId){
        return buSensorDeviceDataMapper.getDataValue(sensorId,deviceId);
    }

    @Override
    public List<String> getSelectTimes(String beginTime,String endTime){
        return buSensorDeviceDataMapper.getSelectTimes(beginTime,endTime);
    }

    @Override
    public List<String> getSelectTime(String node,String beginTime,String endTime){
        return buSensorDeviceDataMapper.getSelectTime(node,beginTime,endTime);
    }

    @Override
    public List<BuSensorDeviceData> getTestData(String tableName,String sensorId,String beginTime,String endTime){
        return buSensorDeviceDataMapper.getTestData(tableName,sensorId,beginTime,endTime);
    }

    @Override
    public List<BuSensorDeviceData> getOnlineTestData(String tableName, String sensorId) {
        return buSensorDeviceDataMapper.getOnlineTestData(tableName,sensorId);
    }

    @Override
    public List<BuSensorDeviceData> getTimeData(String tableName, String sensorId,String year,String month) {
        return buSensorDeviceDataMapper.getTimeData(tableName,sensorId,year,month);
    }

    @Override
    public List<BuSensorDeviceData> getAllTimeData(String sensorId, String year, String month) {
        return buSensorDeviceDataMapper.getAllTimeData(sensorId,year,month);
    }

    @Override
    public List<BuSensorDeviceData> getCalendarData(String year, String month) {
        return buSensorDeviceDataMapper.getCalendarData(year,month);
    }

    @Override
    public List<BuSensorDeviceData> getTestDatas(String node,String time){
        return buSensorDeviceDataMapper.getTestDatas(node,time);
    }
    // 大屏显示获取最新电压数据
    @Override
    public BuElectric getLastVoltage(String tableName, String sensorId){
        return buSensorDeviceDataMapper.getLastVoltage(tableName,sensorId);
    }
    @Override
    public BuSensorDeviceData getLastVoltages(String tableName,String ip){
        return buSensorDeviceDataMapper.getLastVoltages(tableName,ip);
    }
    // 大屏查询指定时间的电压电流，计算有功功率
    @Override
    public BuSensorDeviceData getUByTime(String time){
        return buSensorDeviceDataMapper.getUByTime(time);
    }
    @Override
    public BuSensorDeviceData getIByTime(String time){
        return buSensorDeviceDataMapper.getIByTime(time);
    }

    @Override
    public List<BuSensorDeviceData> getCustomFieldData(String tableName, String fields, String sensorId, String beginTime, String endTime) {
        return buSensorDeviceDataMapper.getCustomFieldData(tableName,fields,sensorId,beginTime,endTime);
    }


//    @Override
//    public List<BuSensorDeviceData> getChartSelect(String ip,String tableName,String beginTime,String endTime){
//        return buSensorDeviceDataMapper.getChartSelect(ip,tableName,beginTime,endTime);
//    }


}
