Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我的 Grails 应用程序中有一个域类,如下所示:
class Event { Date date }
我想编写一个条件查询,选择某年某月发生的事件,有什么建议吗?
谢谢,唐
您可能只使用between:
between
def firstDayOfMonthInYear, lastDayOfMonthInYear; /* set the two values using Calendar or some other mechanism */ Event.withCriteria { between('date', firstDayOfMonthInYear, lastDayOfMonthInYear) }
我不确定的包容性between- 如果它不包括两端,您可能需要调整您的开始/结束日期。