0
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);
上面的代碼是我如何嘗試。 我想我可以通過迭代這個列表來創建一個字符串。有沒有更好的方法。如何在java中使用couchbase n1ql中的「in」條件傳遞列表?