}
private Finder byTagIds(Integer[] tagIds, Integer[] siteIds,
Integer[] channelIds, Integer[] typeIds, Integer excludeId,
Boolean titleImg, Boolean recommend, String title, int orderBy) {
Finder f = Finder.create();
int len = tagIds.length;
if (len == 1) {
f.append("select bean from Content bean join bean.tags tag");
f.append(" join bean.contentExt as ext");
f.append(" where tag.id=:tagId").setParam("tagId", tagIds[0]);
} else {
f.append("select distinct bean from Content bean");
f.append(" join bean.contentExt as ext");
f.append(" join bean.tags tag");
f.append(" where tag.id in(:tagIds)");
f.setParamList("tagIds", tagIds);
}
if (titleImg != null) {
f.append(" and bean.hasTitleImg=:titleImg");
f.setParam("titleImg", titleImg);
}
if (recommend != null) {
f.append(" and bean.recommend=:recommend");
f.setParam("recommend", recommend);
}
appendReleaseDate(f);
appendTypeIds(f, typeIds);
appendChannelIds(f, channelIds);
appendSiteIds(f, siteIds);
if (excludeId != null) {
f.append(" and bean.id<>:excludeId");
f.setParam("excludeId", excludeId);
}
f.append(" and bean.status=" + ContentCheck.CHECKED);
if (!StringUtils.isBlank(title)) {
f.append(" and bean.contentExt.title like :title");
f.setParam("title", "%" + title + "%");
}
appendOrder(f, orderBy);
return f;
}