你可以使用像 list 方法中的参数来排序对象:def airports = Airport.list(sort:'name')当然,你也可以定义一个排序的声明:class Airport {
…
static mapping = {
sort "name"
}
}必要的话你可以配置这个排序:class Airport {
…
static mapping = {
sort name:"desc"
}
}另外,您也可以在关联中配置排序:class Airport {
…
static hasMany = [flights:Flight]
static mapping = {
flights sort:'number'
}
}