我正试图从我的参数中获取一个id列表,但是当我读取它们时,我最终会得到与预期值不同的值。预期值为2和8,我最终得到50和56.有人知道这些结果来自何处?
代码
println 'Params ' + params
Long[] departments = params.list('departmentIds');
println 'departmentIds ' + departments
输出
Params [start:2016-02-28, departmentIds:[2, 8], end:2016-04-10, action:calendarRequest, format:json, controller:calendar]
departmentIds [50, 56]
答案 0 :(得分:2)
println 'Params ' + params
Long[] departments = params.list('departmentIds').collect { Long.parseLong(it) }
println 'departmentIds ' + departments
或类似的......