|
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
@@ -87,19 +88,32 @@ public class HotIconServiceImpl extends ServiceImpl<IHotIconMapper, HotIcon> imp
|
|
|
|
|
|
@Override
|
|
|
public List<HotIcon> getListByCaseId(Integer caseId) {
|
|
|
- List<Integer> hotIconId = new ArrayList<>();
|
|
|
+ HashSet<Integer> hotIconIds = new HashSet<>();
|
|
|
List<CaseTag> list = caseTagService.getListByCaseId(caseId);
|
|
|
if(list.size() >0){
|
|
|
- hotIconId = list.parallelStream().map(CaseTag::getHotIconId).collect(Collectors.toList());
|
|
|
+ List<Integer> ids = list.parallelStream().map(CaseTag::getHotIconId).collect(Collectors.toList());
|
|
|
+ if(!ids.isEmpty()){
|
|
|
+ hotIconIds.addAll(ids);
|
|
|
+ }
|
|
|
}
|
|
|
- hotIconId.add(getDefaultIcon().getIconId());
|
|
|
- return this.getByIds(hotIconId);
|
|
|
+ hotIconIds.add(getDefaultIcon().getIconId());
|
|
|
+ LambdaQueryWrapper<HotIcon> wrapper = new LambdaQueryWrapper<>();
|
|
|
+ wrapper.eq(HotIcon::getCaseId,caseId);
|
|
|
+ List<HotIcon> list1 = this.list(wrapper);
|
|
|
+ List<Integer> ids = list1.stream().map(HotIcon::getIconId).collect(Collectors.toList());
|
|
|
+ if(!ids.isEmpty()){
|
|
|
+ hotIconIds.addAll(ids);
|
|
|
+ }
|
|
|
+ if(hotIconIds.isEmpty()){
|
|
|
+ return new ArrayList<>();
|
|
|
+ }
|
|
|
+ return this.getByIds(hotIconIds);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public List<HotIcon> getByIds(List<Integer> hotIconId) {
|
|
|
+ public List<HotIcon> getByIds( HashSet<Integer> hotIconIds) {
|
|
|
LambdaQueryWrapper<HotIcon> wrapper = new LambdaQueryWrapper<>();
|
|
|
- wrapper.in(HotIcon::getIconId,hotIconId);
|
|
|
+ wrapper.in(HotIcon::getIconId,hotIconIds);
|
|
|
wrapper.orderByDesc(HotIcon::getIsSystem) // 官方默认
|
|
|
.orderByDesc(HotIcon::getIsNew) // 新增
|
|
|
.orderByDesc(HotIcon::getLastUse) // 上次使用
|