|
|
@@ -110,13 +110,15 @@ public class LearnQuestionsServiceImpl implements ILearnQuestionsService
|
|
|
return;
|
|
|
}
|
|
|
List<Long> ids = questions.stream().map(LearnQuestions::getId).collect(Collectors.toList());
|
|
|
- Map<String, Object> map = new HashMap<String, Object>();
|
|
|
- map.put("userId", userId);
|
|
|
- map.put("ids", ids);
|
|
|
- List<LearnQuestions> collectInfos = learnQuestionsMapper.selectCollectInfo(map);
|
|
|
- Set<Long> collected = collectInfos.stream().map(LearnQuestions::getId).collect(Collectors.toSet());
|
|
|
- questions.forEach(e -> {
|
|
|
- e.setCollect(collected.contains(e.getId()));
|
|
|
- });
|
|
|
+ if (CollectionUtils.isNotEmpty(ids)){
|
|
|
+ Map<String, Object> map = new HashMap<String, Object>();
|
|
|
+ map.put("userId", userId);
|
|
|
+ map.put("ids", ids);
|
|
|
+ List<LearnQuestions> collectInfos = learnQuestionsMapper.selectCollectInfo(map);
|
|
|
+ Set<Long> collected = collectInfos.stream().map(LearnQuestions::getId).collect(Collectors.toSet());
|
|
|
+ questions.forEach(e -> {
|
|
|
+ e.setCollect(collected.contains(e.getId()));
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|