|
@@ -16,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.HashMap;
|
|
|
import java.util.HashSet;
|
|
|
import java.util.List;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -43,7 +44,7 @@ public class HotIconServiceImpl extends ServiceImpl<IHotIconMapper, HotIcon> imp
|
|
|
.orderByDesc(HotIcon::getIsNew) // 新增
|
|
|
.orderByDesc(HotIcon::getLastUse) // 上次使用
|
|
|
.orderByDesc(HotIcon::getUseNum) // 使用次数
|
|
|
- .orderByDesc(HotIcon::getSort)
|
|
|
+ .orderByAsc(HotIcon::getSort)
|
|
|
.orderByDesc(HotIcon::getCreateTime);
|
|
|
return this.list(wrapper);
|
|
|
}
|
|
@@ -109,7 +110,7 @@ public class HotIconServiceImpl extends ServiceImpl<IHotIconMapper, HotIcon> imp
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public Object getListByFusionId(Integer fusionId) {
|
|
|
+ public List<HotIcon> getListByFusionId(Integer fusionId) {
|
|
|
HashSet<Integer> hotIconIds = new HashSet<>();
|
|
|
List<CaseTag> list = caseTagService.getListByFusionId(fusionId);
|
|
|
if(list.size() >0){
|
|
@@ -137,8 +138,37 @@ public class HotIconServiceImpl extends ServiceImpl<IHotIconMapper, HotIcon> imp
|
|
|
LambdaQueryWrapper<HotIcon> wrapper = new LambdaQueryWrapper<>();
|
|
|
wrapper.in(HotIcon::getIconId,hotIconIds);
|
|
|
wrapper.orderByDesc(HotIcon::getIsSystem) // 官方默认
|
|
|
- .orderByAsc(HotIcon::getIconTitle)
|
|
|
.orderByAsc(HotIcon::getSort);
|
|
|
return this.list(wrapper);
|
|
|
}
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<HotIcon> treeList(List<HotIcon> iconList) {
|
|
|
+ HashMap<Integer,HotIcon> map = new HashMap<>();
|
|
|
+
|
|
|
+ List<HotIcon> list = new ArrayList<>();
|
|
|
+ List<HotIcon> result = new ArrayList<>();
|
|
|
+
|
|
|
+ for (HotIcon hotIcon : iconList) {
|
|
|
+ if(hotIcon.getParentId() == null){
|
|
|
+ list.add(hotIcon);
|
|
|
+ }
|
|
|
+ map.put(hotIcon.getIconId(),hotIcon);
|
|
|
+ }
|
|
|
+ for (HotIcon hotIcon : iconList) {
|
|
|
+ if(hotIcon.getParentId() == null){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ HotIcon parent = map.get(hotIcon.getParentId());
|
|
|
+ if(parent.getChildrenList() == null){
|
|
|
+ parent.setChildrenList(new ArrayList<>());
|
|
|
+ }
|
|
|
+ parent.getChildrenList().add(hotIcon);
|
|
|
+ }
|
|
|
+ for (HotIcon hotIcon : list) {
|
|
|
+ result.add( map.get(hotIcon.getIconId()));
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|