return (Long) find(f).iterator().next();
}
public long guestbookStatistic(TimeRange timeRange,
Map<String, Object> restrictions) {
Finder f = createCacheableFinder("select count(*) from CmsGuestbook bean where bean.site.id=:siteId");
f.setParam("siteId", restrictions.get(SITEID));
if (timeRange != null) {
f.append(" and bean.createTime >= :begin");
f.append(" and bean.createTime < :end");
f.setParam("begin", timeRange.getBegin());
f.setParam("end", timeRange.getEnd());
}
Boolean isReplyed = (Boolean) restrictions.get(ISREPLYED);
if (isReplyed != null) {
if (isReplyed) {
f.append(" and bean.replayTime is not null");
} else {
f.append(" and bean.replayTime is null");
}
}
return (Long) find(f).iterator().next();
}