class A {
hasMany = [b: B]
}
class B {
int type
String title
belongsTo = [a: A]
}
是否有任何方法可以将
get
或list
类型设置为A
,将B
类型的集合在一种情况下按类型排序,在另一种情况下按标题排序? 最佳答案
试试这个代码:
def listOfA = A.withCriteria {
eq "id", 123456
b {
and {
order "type", "desc"
order "title", "desc"
}
}
}