暂降模块代码合并
终端运行管理接口调整
This commit is contained in:
@@ -35,7 +35,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
protected PqsEventDetailQuery(InfluxDbUtils influxDbUtils) {
|
||||
super(influxDbUtils);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* line_id or条件
|
||||
*
|
||||
@@ -50,7 +50,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
}
|
||||
return lineIdOr;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 指定查询数据库和表
|
||||
*
|
||||
@@ -60,7 +60,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
private SelectQueryImpl fromTable(SelectionQueryImpl column) {
|
||||
return column.from(DATABASE, PQS_EVENT_DETAIL);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询方法
|
||||
* SELECT在包括一个tag时,必须至少指定一个field
|
||||
@@ -76,7 +76,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
QueryResult query = getQueryResult(or, and, selectAppendTable);
|
||||
return toPOJO(query, EventDetail.class);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Count方法
|
||||
*
|
||||
@@ -95,7 +95,18 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
}
|
||||
return eventDetailCounts.get(0).getCount();
|
||||
}
|
||||
|
||||
|
||||
public Integer selectCountUp(List<String> columnNames, List<List<Clause>> or, List<Clause> and) {
|
||||
SelectionQueryImpl selectAppendColumnNames = countAppendColumnNames(columnNames);
|
||||
SelectQueryImpl selectAppendTable = fromTable(selectAppendColumnNames);
|
||||
QueryResult query = getQueryResultUp(or, and, selectAppendTable);
|
||||
List<EventDetailCount> eventDetailCounts = toPOJO(query, EventDetailCount.class);
|
||||
if (CollUtil.isEmpty(eventDetailCounts)) {
|
||||
return 0;
|
||||
}
|
||||
return eventDetailCounts.get(0).getCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* where条件 时间和reason_type
|
||||
*
|
||||
@@ -110,7 +121,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
clauses.add(eq(type, reasonId));
|
||||
return clauses;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计lineIndex的数据
|
||||
*
|
||||
@@ -120,7 +131,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
public static Function<List<String>, Long> countLineIndexes(List<EventDetail> eventDetailList) {
|
||||
return lineIndexes -> eventDetailList.stream().filter(t -> lineIndexes.contains(t.getLineId())).count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 统计eventass_index字段非空的个数
|
||||
*
|
||||
@@ -129,7 +140,7 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
public static Function<List<EventDetail>, Long> countEventassIndexIsNoEmpty() {
|
||||
return eventDetails -> eventDetails.stream().filter(t -> StringUtils.isNotEmpty(t.getEventassIndex())).count();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 时间段内的数据
|
||||
*
|
||||
@@ -142,5 +153,5 @@ public class PqsEventDetailQuery extends QueryBuilder {
|
||||
return timeId.isAfter(beginTime.toInstant()) && timeId.isBefore(endTime.toInstant());
|
||||
}).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -101,6 +101,23 @@ public abstract class QueryBuilder {
|
||||
return query(selectQuery.getCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
* 组装sql语句,包括or语句和and语句添加对多个or语句支持
|
||||
*
|
||||
* @param or or条件
|
||||
* @param and and条件
|
||||
* @return 查询结果
|
||||
* @see SelectionQueryImpl
|
||||
*/
|
||||
public QueryResult getQueryResultUp(List<List<Clause>> or, List<Clause> and, SelectQueryImpl selectQuery) {
|
||||
WhereQueryImpl<SelectQueryImpl> where = selectQuery.where();
|
||||
for(List<Clause> item: or){
|
||||
whereAndNested(where, item);
|
||||
}
|
||||
appendWhereOther(where, and);
|
||||
return query(selectQuery.getCommand());
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼接or条件
|
||||
*
|
||||
@@ -131,7 +148,7 @@ public abstract class QueryBuilder {
|
||||
}
|
||||
where.tz("Asia/Shanghai");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* time and条件
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user