将influxDB的数据库名配置调整为配置文件
This commit is contained in:
@@ -4,7 +4,9 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.njcn.event.pojo.po.EventDetail;
|
||||
import com.njcn.event.pojo.vo.EventDetailCount;
|
||||
import com.njcn.influxdb.config.InfluxDbConfig;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.querybuilder.SelectQueryImpl;
|
||||
@@ -12,6 +14,7 @@ import org.influxdb.querybuilder.SelectionQueryImpl;
|
||||
import org.influxdb.querybuilder.clauses.Clause;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.Instant;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -19,7 +22,7 @@ import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.njcn.influxdb.param.InfluxDBPublicParam.DATABASE;
|
||||
|
||||
import static com.njcn.influxdb.param.InfluxDBPublicParam.PQS_EVENT_DETAIL;
|
||||
import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
|
||||
|
||||
@@ -32,6 +35,10 @@ import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
|
||||
*/
|
||||
@Component
|
||||
public class PqsEventDetailQuery extends QueryBuilder {
|
||||
|
||||
@Resource
|
||||
private InfluxDbConfig influxDbConfig;
|
||||
|
||||
protected PqsEventDetailQuery(InfluxDbUtils influxDbUtils) {
|
||||
super(influxDbUtils);
|
||||
}
|
||||
@@ -58,7 +65,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
* @see SelectQueryImpl
|
||||
*/
|
||||
private SelectQueryImpl fromTable(SelectionQueryImpl column) {
|
||||
return column.from(DATABASE, PQS_EVENT_DETAIL);
|
||||
return column.from(influxDbConfig.getDatabase(), PQS_EVENT_DETAIL);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.event.influxdb;
|
||||
|
||||
import com.njcn.event.pojo.po.PqsOnlinerate;
|
||||
import com.njcn.influxdb.config.InfluxDbConfig;
|
||||
import com.njcn.influxdb.utils.InfluxDbUtils;
|
||||
import org.influxdb.dto.QueryResult;
|
||||
import org.influxdb.querybuilder.SelectQueryImpl;
|
||||
@@ -8,15 +9,19 @@ import org.influxdb.querybuilder.SelectionQueryImpl;
|
||||
import org.influxdb.querybuilder.clauses.Clause;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.njcn.influxdb.param.InfluxDBPublicParam.DATABASE;
|
||||
|
||||
import static com.njcn.influxdb.param.InfluxDBPublicParam.PQS_ONLINERATE;
|
||||
import static org.influxdb.querybuilder.BuiltQuery.QueryBuilder.eq;
|
||||
|
||||
@Component
|
||||
public class PqsOnlinerateQuery extends QueryBuilder {
|
||||
|
||||
@Resource
|
||||
private InfluxDbConfig influxDbConfig;
|
||||
|
||||
protected PqsOnlinerateQuery(InfluxDbUtils influxDbUtils) {
|
||||
super(influxDbUtils);
|
||||
@@ -29,7 +34,7 @@ public class PqsOnlinerateQuery extends QueryBuilder {
|
||||
* @see SelectQueryImpl
|
||||
*/
|
||||
private SelectQueryImpl fromTable(SelectionQueryImpl column) {
|
||||
return column.from(DATABASE, PQS_ONLINERATE);
|
||||
return column.from(influxDbConfig.getDatabase(), PQS_ONLINERATE);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user