嗨,我想用groovy得到一个列表的总计数 totalCount 但它抛出:
totalCount
Exception evaluating property 'totalCount' for java.util.ArrayList, Reason: groovy.lang.MissingPropertyException: No such property: totalCount
我能用groovy得到总数吗 总计数 而不是 .size ?
总计数
.size
当您在Grails中执行条件查询时,返回的列表将只提供 totalCount 如果使用分页参数调用查询( offset 和 max )
offset
max
params.max = params.max ?: 10 def resultWithTotalCount = MyDomain.createCriteria().list(params) { // ... }
平原 list 没有分页的调用将返回一个没有 总计数 所有物
list
def resultWithoutTotalCount = MyDomain.createCriteria().list { // ... }