|
|
@ -29,6 +29,7 @@ import org.springframework.util.StringUtils; |
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
import java.util.regex.Pattern; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 帖子数据接口 |
|
|
|
* 帖子数据接口 |
|
|
@ -102,6 +103,9 @@ public class ForumDao extends BaseDao<Forum> { |
|
|
|
if (ObjectUtils.isNotEmpty(forumQuery.getForumType())) { |
|
|
|
if (ObjectUtils.isNotEmpty(forumQuery.getForumType())) { |
|
|
|
criteriaList.add(Criteria.where("forumType").in(forumQuery.getForumType())); |
|
|
|
criteriaList.add(Criteria.where("forumType").in(forumQuery.getForumType())); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (!StringUtils.isEmpty(forumQuery.getTitle())) { |
|
|
|
|
|
|
|
criteriaList.add(Criteria.where("title").regex(Pattern.compile(".*" + forumQuery.getTitle() + ".*"))); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
Criteria criteria = new Criteria().andOperator(criteriaList.toArray(new Criteria[]{})); |
|
|
|
Criteria criteria = new Criteria().andOperator(criteriaList.toArray(new Criteria[]{})); |
|
|
|
long count = mongoTemplate.count(new Query(criteria), entityClass()); |
|
|
|
long count = mongoTemplate.count(new Query(criteria), entityClass()); |
|
|
|