我正在尝试在 grails 中使用创建标准方法,但我返回一个空列表,我不知道为什么。我的代码如下
def results = PostOrder.createCriteria().list() {
posts{
author{
eq('username', lookupPerson().username)
}
}
picture{
user{
eq('username', lookupPerson().username)
}
}
}
PostOrder 域如下:
class PostOrder {
String pOrder
Date dateCreated
Picture picture
Post posts
Video video
Boolean favorite = false
static hasMany = [children : Child]
static constraints = {
picture nullable: true
posts nullable: true
video nullable: true
}
}
帖子如下:
class Post {
String message
User author
Date dateCreated
Child child
boolean postedToAll
String tag
static hasMany = [tags:Tag]
static constraints = {
child nullable: true
tags nullable: true
tag nullable: true
}
}
最后图片如下:
class Picture {
String orgName
String urlOrg
String urlWeb
String urlThumb
Date dateCreated
String caption
Child child
User user
Album contained
String tag
boolean postedToAll
static hasMany = [tags:Tag]
static constraints = {
orgName blank: false
caption maxSize: 500
tags nullable: true
caption nullable: true
tag nullable: true
child nullable: true
}
}
对我来说,这会很好用,任何人都可以看到为什么不可以吗?