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


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.jeecg.modules.energy.entity.BuElectric;
import org.jeecg.modules.energy.mapper.BuElectricMapper;
import org.jeecg.modules.energy.service.IBuElectricService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import java.util.List;

/**
 * @Description: bu_electric
 * @Author: jeecg-boot
 * @Date:   2024-05-09
 * @Version: V1.0
 */
@Service
public class BuElectricServiceImpl extends ServiceImpl<BuElectricMapper, BuElectric> implements IBuElectricService {

    @Autowired
    private BuElectricMapper buElectricMapper;

//    @Override
//    public BuElectric getBySensorId(String tableName,String sensorId){
//        return buElectricMapper.getBySensorId(tableName,sensorId);
//    }
    @Override
    public List<BuElectric> getBySensorId(String tableName,String sensorId){
        return buElectricMapper.getBySensorId(tableName,sensorId);
    }
    @Override
    public List<BuElectric> getElectricData() {
        return buElectricMapper.getElectricData();
    }
    @Override
    public List<BuElectric> getElectricByStatus() {
        return buElectricMapper.getElectricByStatus();
    }

    @Override
    public void insertElectric(String id,String sensorId,String createTime,Double udy,Double vdy,Double wdy,Double udl,Double vdl,Double wdl, Double eng) {
        buElectricMapper.insertElectric(id,sensorId,createTime,udy,vdy,wdy,udl, vdl, wdl,eng);
    }

    @Override
    public BuElectric getYesterdayFirstData(String tableName,String sensorId,String time) {
        return buElectricMapper.getYesterdayFirstData( tableName, sensorId, time);
    }
    @Override
    public BuElectric getYesterdayLastData(String tableName,String sensorId,String time) {
        return buElectricMapper.getYesterdayLastData( tableName, sensorId, time);
    }
    @Override
    public String getAverage(String tableName,String sensorId,String time) {
        return buElectricMapper.getAverage( tableName, sensorId, time);
    }

    @Override
    public IPage<BuElectric> selectByDynamicTable(Page<BuElectric> page, String tableName, String deviceId, String sensorId, String beginTime, String endTime) {
        return buElectricMapper.selectByDynamicTable(page,tableName,deviceId,sensorId,beginTime,endTime);
    }
    @Override
    public List<BuElectric> selectByDynamicTable(String tableName, String deviceId, String sensorId, String beginTime, String endTime) {
        return buElectricMapper.selectByDynamicTable(tableName,deviceId,sensorId,beginTime,endTime);
    }

}
