我写了一个 Realm 类(class)
class ReportCallByUser {
Integer userId;
String userName;
String reportName;
Date timeOfReportCall;
static constraints = {
}
static mapping = {
timeOfReportCall index: 'time_of_report_call_index'
}
最后一行在数据库中创建索引,但升序排列。如何在'timeOfReportCall'上以降序创建索引?
提前致谢。
最佳答案
关于索引创建,没有order
这样的东西。查询指定顺序的能力:
ReportCallByUser.list( [ sort:'timeOfReportCall', order:'[desc|asc]' ] )
关于grails - 如何在grails域类中按降序应用索引?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38565895/