Commit acb44665 authored by 刘基明's avatar 刘基明

话题列表fix

parent 5d29373d
...@@ -7,6 +7,7 @@ import com.tanpu.community.api.enums.DeleteTagEnum; ...@@ -7,6 +7,7 @@ import com.tanpu.community.api.enums.DeleteTagEnum;
import com.tanpu.community.api.enums.TopicStatusEnum; import com.tanpu.community.api.enums.TopicStatusEnum;
import com.tanpu.community.dao.entity.community.CommentEntity; import com.tanpu.community.dao.entity.community.CommentEntity;
import com.tanpu.community.dao.mapper.community.CommentMapper; import com.tanpu.community.dao.mapper.community.CommentMapper;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
...@@ -38,6 +39,9 @@ public class CommentService { ...@@ -38,6 +39,9 @@ public class CommentService {
//统计主题集合的评论量 //统计主题集合的评论量
public Integer getCommentCountByThemeIds(List<String> themeIds) { public Integer getCommentCountByThemeIds(List<String> themeIds) {
if (CollectionUtils.isEmpty(themeIds)){
return 0;
}
return commentMapper.selectList((new LambdaQueryWrapper<CommentEntity>() return commentMapper.selectList((new LambdaQueryWrapper<CommentEntity>()
.in(CommentEntity::getThemeId, themeIds))) .in(CommentEntity::getThemeId, themeIds)))
.size(); .size();
......
...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; ...@@ -12,6 +12,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.stream.Collectors; import java.util.stream.Collectors;
...@@ -95,6 +96,9 @@ public class ThemeService { ...@@ -95,6 +96,9 @@ public class ThemeService {
//根据话题查询所有的主题Id //根据话题查询所有的主题Id
public List<String> queryThemeIdsByTopic(String topidId) { public List<String> queryThemeIdsByTopic(String topidId) {
if(StringUtils.isEmpty(topidId)){
return Collections.emptyList();
}
LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>() LambdaQueryWrapper<ThemeEntity> queryWrapper = new LambdaQueryWrapper<ThemeEntity>()
.eq(ThemeEntity::getTopicId, topidId); .eq(ThemeEntity::getTopicId, topidId);
queryWrapper.select(ThemeEntity::getThemeId); queryWrapper.select(ThemeEntity::getThemeId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment