指标通用查询
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
package com.njcn.influx.service;
|
||||
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/6/2 16:00【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
public interface CommonService {
|
||||
List<StatisticalDataDTO> commonquery(String lineId, String tableName, String columnName);
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.njcn.influx.service.impl;
|
||||
|
||||
import com.njcn.influx.imapper.CommonMapper;
|
||||
import com.njcn.influx.pojo.dto.StatisticalDataDTO;
|
||||
import com.njcn.influx.pojo.po.HarmonicRatioData;
|
||||
import com.njcn.influx.query.InfluxQueryWrapper;
|
||||
import com.njcn.influx.service.CommonService;
|
||||
import com.njcn.influx.utils.ReflectUitl;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Date: 2023/6/2 16:04【需求编号】
|
||||
*
|
||||
* @author clam
|
||||
* @version V1.0.0
|
||||
*/
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class CommonServiceImpl implements CommonService {
|
||||
private final CommonMapper commonMapper;
|
||||
|
||||
@Override
|
||||
public List<StatisticalDataDTO> commonquery(String lineId ,String tableName, String columnName) {
|
||||
HashMap<String, Class<?>> entityClassesByAnnotation = ReflectUitl.getEntityClassesByAnnotation();
|
||||
Class<?> aClass = entityClassesByAnnotation.get(tableName);
|
||||
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(aClass,StatisticalDataDTO.class);
|
||||
influxQueryWrapper.eq("LineId",lineId).
|
||||
last(columnName,"statisticalData").
|
||||
groupBy(StatisticalDataDTO::getLineId, StatisticalDataDTO::getStatMethod, StatisticalDataDTO::getPhase);
|
||||
|
||||
List<StatisticalDataDTO> statistical = commonMapper.getStatistical(influxQueryWrapper);
|
||||
|
||||
return statistical;
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user