我有一个域类(缩小)为: -
class Expense {
Date dateOfExpense
int amount
}
我正在尝试获取按费用日期的周/月/年分组的金额总和。参考 grails doc http://grails.org/doc/latest/guide/GORM.html中的“sqlGroupProjection”方法,
我尝试使用以下代码:-
def results = c {
between("dateOfExpense", fromDate, toDate)
projections {
sqlGroupProjection 'dateOfExpense,sum(amount) as summed',
'MONTH(dateOfExpense)',['date','summed'],[DATE,NUMBER]
}
}
抛出异常:
No such property: DATE for class: grails.orm.HibernateCriteriaBuilder. Stacktrace follows:
Message: No such property: DATE for class: grails.orm.HibernateCriteriaBuilder
请提出一种使用方法的sqlGroupProjection
方法