package com.njcn.influx.service.impl;

import com.njcn.influx.imapper.DataHarmPowerPMapper;
import com.njcn.influx.pojo.po.DataHarmPowerP;
import com.njcn.influx.query.InfluxQueryWrapper;
import com.njcn.influx.service.DataHarmPowerPService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author hongawen
 * @version 1.0.0
 * @date 2023年05月05日 09:51
 */
@Service
public class DataHarmPowerPServiceImpl implements DataHarmPowerPService {
    @Resource
    private DataHarmPowerPMapper dataHarmPowerPMapper;
    @Override
    public List<DataHarmPowerP> getHarmonicPowerP(String lineIndex, String startTime, String endTime) {
        List<DataHarmPowerP> result1 ;
        InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(DataHarmPowerP.class);
        influxQueryWrapper.eq(DataHarmPowerP::getLineId, lineIndex)
                .eq(DataHarmPowerP::getValueType, "AVG")
                .eq(DataHarmPowerP::getPhaseType, "T")
                .between(DataHarmPowerP::getTime, startTime, endTime);
        result1 = dataHarmPowerPMapper.getStatisticsByWraper(influxQueryWrapper);
        return result1;
    }
}
