📄 cmscommentdaoimpl.java
字号:
package com.jeecms.cms.dao.impl;
import java.util.List;
import org.springframework.stereotype.Repository;
import com.jeecms.cms.dao.CmsCommentDao;
import com.jeecms.cms.entity.CmsComment;
import com.jeecms.core.JeeCoreDaoImpl;
import com.ponyjava.common.hibernate3.Finder;
import com.ponyjava.common.page.Pagination;
@Repository
public class CmsCommentDaoImpl extends JeeCoreDaoImpl<CmsComment> implements
CmsCommentDao {
@SuppressWarnings("unchecked")
public Pagination getCommentForTag(Long docId, String docType,
Boolean check, Boolean recommend, Boolean disabled,
boolean rcmFirst, int orderBy, boolean isPage, int firstResult,
int pageNo, int pageSize) {
Finder f = Finder.create("from CmsComment bean").append(
" where bean.doc.id=:docId").setParam("docId", docId);
f.append(" and bean.doc.class='" + docType + "'");
if (check != null) {
f.append(" and bean.check=:check");
f.setParam("check", check);
}
if (recommend != null) {
f.append(" and bean.recommend=:recommend");
f.setParam("recommend", recommend);
}
if (disabled != null) {
f.append(" and bean.disabled=:disabled");
f.setParam("disabled", disabled);
}
if (rcmFirst) {
f.append(" order by bean.recommend desc,");
} else {
f.append(" order by");
}
switch (orderBy) {
case 1:
f.append(" bean.id desc");
break;
default:
f.append(" bean.id asc");
break;
}
if (isPage) {
return find(f, pageNo, pageSize);
} else {
f.setFirstResult(firstResult);
f.setMaxResults(pageSize);
List list = find(f);
return new Pagination(1, pageSize, list.size(), list);
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -