influxdb添加方法
This commit is contained in:
@@ -21,4 +21,7 @@ public interface CommonMapper extends InfluxDbBaseMapper<PowerQualityData> {
|
|||||||
|
|
||||||
StatisticalDataDTO getLineRtData(InfluxQueryWrapper influxQueryWrapper);
|
StatisticalDataDTO getLineRtData(InfluxQueryWrapper influxQueryWrapper);
|
||||||
|
|
||||||
|
List<StatisticalDataDTO> getDeviceRtData(InfluxQueryWrapper influxQueryWrapper);
|
||||||
|
|
||||||
|
List<StatisticalDataDTO> getDeviceRtDataByTime(InfluxQueryWrapper influxQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,4 +24,29 @@ public interface CommonService {
|
|||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
StatisticalDataDTO getLineRtData(String lineId, String tableName, String columnName, String phasic, String dataType);
|
StatisticalDataDTO getLineRtData(String lineId, String tableName, String columnName, String phasic, String dataType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据条件获取监测点数据
|
||||||
|
* @param lineIds 监测点Id
|
||||||
|
* @param tableName 表名
|
||||||
|
* @param columnName 字段名
|
||||||
|
* @param phasic 相别
|
||||||
|
* @param dataType 数据类型
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<StatisticalDataDTO> getDeviceRtData(List<String> lineIds, String tableName, String columnName, String phasic, String dataType);
|
||||||
|
/**
|
||||||
|
* @Description: getDeviceRtDataByTime
|
||||||
|
* @param lineIds 监测点Id
|
||||||
|
* @param tableName 表名
|
||||||
|
* @param columnName 字段名
|
||||||
|
* @param phasic 相别
|
||||||
|
* @param dataType 数据类型
|
||||||
|
*@param startTime start time
|
||||||
|
* @param endTime end time
|
||||||
|
* @return: java.util.List<com.njcn.influx.pojo.dto.StatisticalDataDTO>
|
||||||
|
* @Author: clam
|
||||||
|
* @Date: 2023/6/13
|
||||||
|
*/
|
||||||
|
List<StatisticalDataDTO> getDeviceRtDataByTime(List<String> lineIds, String tableName, String columnName, String phasic, String dataType,String startTime, String endTime);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -58,4 +58,31 @@ public class CommonServiceImpl implements CommonService {
|
|||||||
.eq("value_type",dataType);
|
.eq("value_type",dataType);
|
||||||
return commonMapper.getLineRtData(influxQueryWrapper);
|
return commonMapper.getLineRtData(influxQueryWrapper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatisticalDataDTO> getDeviceRtData(List<String> lineIds, String tableName, String columnName, String phasic, String dataType) {
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class);
|
||||||
|
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||||
|
.select(StatisticalDataDTO::getPhaseType)
|
||||||
|
.select(StatisticalDataDTO::getValueType)
|
||||||
|
.last(columnName)
|
||||||
|
.or("line_id",lineIds)
|
||||||
|
.eq("phasic_type",phasic)
|
||||||
|
.eq("value_type",dataType).groupBy("line_id");
|
||||||
|
return commonMapper.getDeviceRtData(influxQueryWrapper);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatisticalDataDTO> getDeviceRtDataByTime(List<String> lineIds, String tableName, String columnName, String phasic, String dataType, String startTime, String endTime) {
|
||||||
|
InfluxQueryWrapper influxQueryWrapper = new InfluxQueryWrapper(tableName,StatisticalDataDTO.class);
|
||||||
|
influxQueryWrapper.select(StatisticalDataDTO::getLineId)
|
||||||
|
.select(StatisticalDataDTO::getPhaseType)
|
||||||
|
.select(StatisticalDataDTO::getValueType)
|
||||||
|
.select(columnName,"value")
|
||||||
|
.or("line_id",lineIds)
|
||||||
|
.eq("phasic_type",phasic)
|
||||||
|
.between("time", startTime, endTime)
|
||||||
|
.eq("value_type",dataType).groupBy("line_id");
|
||||||
|
return commonMapper.getDeviceRtDataByTime(influxQueryWrapper);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user