我想用一個Map的鍵集作爲一個SQL查詢列表參數:Groovy的SQL命名列表參數
query = "select contentid from content where spaceid = :spaceid and title in (:title)"
sql.eachRow(query, [spaceid: 1234, title: map.keySet().join(',')]) {
rs ->
println rs.contentid
}
我可以使用單一的值,但沒有設置或列表。 這是我到目前爲止已經試過:
map.keySet().join(',')
map.keySet().toListString()
map.keySet().toList()
map.keySet().toString()
地圖使用字符串作爲關鍵
Map<String, String> map = new TreeMap<>(String.CASE_INSENSITIVE_ORDER);
另外,我沒有得到一個錯誤。我只是沒有打印像空白結果集。
嘗試'[spaceid:1234,title:''「+ map.keySet()。join(」','「)+」'「]' – injecteer