通过使用 CreateCriteria,我想比较两个列表并groups
检查users
. 有类似eq
的东西吗?
领域
class User {
String login
static hasMany = [groups = String]
}
class Project {
String name
static hasMany = [users = User]
}
创建标准
def UserInstance = User.get(1)
def idList = Project.createCriteria().list () {
projections { distinct ( "id" )
property("name")
property("id")
}
eq("users.login", UserInstance.groups) //check if there are at least one element in groups list present in users list.
order("name","desc")
}