0
通過使用CreateCriteria,我想比較兩個列表並檢查users
中是否存在至少一個groups
中的元素。 有沒有像eq
這樣的表演?Grails/CreateCriteria - 比較兩個列表
域
class User {
String login
static hasMany = [groups = String]
}
class Project {
String name
static hasMany = [users = User]
}
個createCriteria
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")
}