我正在尝试获取用户等于当前登录用户的域的每个实例。我现在的代码是:
def list(Integer max) {
params.max = Math.min(max ?: 10, 100)
if (lookupPerson().username == "admin"){
adminList(max)
}
else{
def childList = []
def i = 1
Child.list().each(){
if(Child.get(i).user.username == lookupPerson().username){
def child = Child.get(i)
childList.add(child)
}
i++
}
[childInstanceList: childList.list(params), childInstanceTotal: childList.count()]
}
}
这给了我以下错误 No signature of method: java.util.ArrayList.list() is applicable for argument types: (org.codehaus.groovy.grails.web.servlet.mvc.GrailsParameterMap) values: [[action:list , controller:child, max:10]] 可能的解决方案:last(), first(), asList(), toList(), is(java.lang.Object), wait()
我确信必须有一种更简单、更好的方法来做到这一点。有任何想法吗?