}
private Finder getFinder(Integer siteId, Integer contentId,Integer toUserId,Integer fromUserId,
Integer greaterThen, Boolean checked, Boolean recommend,
boolean desc, boolean cacheable) {
Finder f = Finder.create("from CmsComment bean where 1=1");
if (contentId != null) {
f.append(" and bean.content.id=:contentId");
f.setParam("contentId", contentId);
} else if (siteId != null) {
f.append(" and bean.site.id=:siteId");
f.setParam("siteId", siteId);
}
if(toUserId!=null){
f.append(" and bean.commentUser.id=:commentUserId");
f.setParam("commentUserId", toUserId);
}else if(fromUserId!=null){
f.append(" and bean.content.user.id=:fromUserId");
f.setParam("fromUserId", fromUserId);
}
if (greaterThen != null) {
f.append(" and bean.ups>=:greatTo");
f.setParam("greatTo", greaterThen);
}
if (checked != null) {
f.append(" and bean.checked=:checked");
f.setParam("checked", checked);
}
if(recommend!=null){
if (recommend) {
f.append(" and bean.recommend=true");
}
}
if (desc) {
f.append(" order by bean.id desc");
} else {
f.append(" order by bean.id asc");
}
f.setCacheable(cacheable);
return f;
}