微调
This commit is contained in:
@@ -47,6 +47,10 @@ public class InfluxQueryWrapper {
|
||||
*/
|
||||
private final List<String> orderColumn = new ArrayList<>();
|
||||
|
||||
/***
|
||||
* LIMIT 子句,返回查询结果的前N条points
|
||||
*/
|
||||
private String limitSql = "";
|
||||
|
||||
/***
|
||||
* 查询目标表
|
||||
@@ -1361,6 +1365,17 @@ public class InfluxQueryWrapper {
|
||||
return this;
|
||||
}
|
||||
|
||||
/***
|
||||
* LIMIT 子句,返回查询结果的前N条points
|
||||
* @author hongawen
|
||||
* @return InfluxQueryWrapper
|
||||
* 输出 limit 10
|
||||
*/
|
||||
public InfluxQueryWrapper limit(int limit) {
|
||||
limitSql = InfluxDbSqlConstant.LIMIT + limit;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
* 根据配置后的实体生成对应的sql
|
||||
@@ -1414,6 +1429,11 @@ public class InfluxQueryWrapper {
|
||||
.append(String.join(StrPool.COMMA, orderColumn));
|
||||
}
|
||||
|
||||
//判断是否有limit子句
|
||||
if(StrUtil.isNotBlank(limitSql)){
|
||||
sqlSelect.append(limitSql);
|
||||
}
|
||||
|
||||
//最后拼接上时区
|
||||
sqlSelect.append(InfluxDbSqlConstant.TZ);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user