QueryResultresult= influxTemplate.query("SELECT * FROM \"zt_gas_waste\" order by time desc limit 100\n"); List<QueryResult.Series> series = result.getResults().get(0).getSeries();
查询数据并转换为List<Map<String, Object>>
1 2 3
Stringsql="SELECT * FROM cq_test order by time desc"; List<Map<String, Object>> resList = influxTemplate.queryMapList(sql); log.info(JsonUtil.toJson(resList));
查询数据并将时间格式化为指定类型
1 2 3
Stringsql="SELECT * FROM cq_test order by time desc"; List<Map<String, Object>> resList = influxTemplate.queryMapList(sql, "yyyy年MM月dd日HH时mm分ss秒"); log.info(JsonUtil.toJson(resList));
转为实体类 List
1 2 3
Stringsql="SELECT * FROM cq_test order by time desc"; List<CqTest> resList = influxTemplate.queryBeanList(sql, CqTest.class); log.info(resList.toString());