我想通过两个领域,其使用动态查找器来搜索status和OpenOn(date).这个查询工作得很好:
render(view:'list', model:[incidentInstanceList:Incident.findAllByStatusIlikeAndOpenOnGreaterThan("closed",new Date()-1,[sort:"id",order:"desc"])])
Run Code Online (Sandbox Code Playgroud)
但是现在我试图通过三个字段搜索动态查找器,即UserId:status和OpenOn(date):
render(view:'list', model:[incidentInstanceList:Incident.findAllByStatusIlikeuserIdIlikeAndOpenOnGreaterThan("closed","${session.user.userId}",new Date()-1,[sort:"id",order:"desc"])])
Run Code Online (Sandbox Code Playgroud)
此查询无法正常运行并显示错误:
No signature of method: app.Incident.findAllByStatusIlikeuserIdIlikeAndOpenOnGreaterThan() is applicable for argument types: (java.lang.String, org.codehaus.groovy.runtime.GStringImpl, java.util.Date, java.util.LinkedHashMap) values: [closed, tt10004, Wed Aug 24 15:12:21 IST 2011, [sort:id, order:desc]] Possible solutions: findAllByStatusIlikeuserIdIlikeAndCreatedOnGreaterThan(java.util.List)
Run Code Online (Sandbox Code Playgroud)
请指导我解决这个问题.
def incidentInstanceList = {
def criteria = Incident.createCriteria()
def results = criteria {
and {
user {
like('userId', "${session.user.userId}").toString()
}
like('status', "Closed" )
gt('closedOn',new Date()-1)
sort("id", "desc")
}
}
render(view:'list', model:[ incidentInstanceList: results, incidentInstanceTotal: Incident.count()])
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2281 次 |
| 最近记录: |