List<String> spotIdList = new ArrayList<>();
list.add("spot-1");
String historyQry = "SELECT refId ,deviceId as senseId, lastLogAt as lastSeenTime,spotId, META(`beacon-core`).cas as _CAS, "
+ "META(`beacon-core`).id as _ID from `beacon-core` WHERE _class='LiveState' "
+ "and deploymentId=$deploymentId and (spotId in $spotIds) and live='true' ORDER BY refId ";
JsonObject params = JsonObject.create().put("deploymentId", deploymentId).put("spotId", spotIdList);
List<SpotTagView> tags = coreTemplate.findByN1QL(N1qlQuery.parameterized(historyQry, params), SpotTagView.class);
以上代码是我尝试的方式。 我想我可以通过迭代这个列表创建一个字符串来做到这一点。有没有更好的方法。
答案 0 :(得分:0)
相同的代码工作正常。问题是拼写错误。在JsonObject而不是putId中,它是spotIds。