|
|
@@ -1,5 +1,6 @@ |
|
|
package com.ruoyi.platform.service.impl; |
|
|
package com.ruoyi.platform.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import com.ruoyi.common.security.utils.DictUtils; |
|
|
import com.ruoyi.common.security.utils.SecurityUtils; |
|
|
import com.ruoyi.common.security.utils.SecurityUtils; |
|
|
import com.ruoyi.platform.domain.Component; |
|
|
import com.ruoyi.platform.domain.Component; |
|
|
import com.ruoyi.platform.service.ComponentService; |
|
|
import com.ruoyi.platform.service.ComponentService; |
|
|
@@ -15,9 +16,7 @@ import org.springframework.data.domain.PageImpl; |
|
|
import org.springframework.data.domain.PageRequest; |
|
|
import org.springframework.data.domain.PageRequest; |
|
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
import javax.annotation.Resource; |
|
|
import java.util.Date; |
|
|
|
|
|
import java.util.List; |
|
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
import java.util.*; |
|
|
import java.util.stream.Collectors; |
|
|
import java.util.stream.Collectors; |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
@@ -52,10 +51,22 @@ public class ComponentServiceImpl implements ComponentService { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@Override |
|
|
@Override |
|
|
public Map<Integer, List<Component>> queryAllGroupedByCategory() { |
|
|
|
|
|
|
|
|
public List<Map> queryAllGroupedByCategory() { |
|
|
List<Component> componentList = this.componentDao.queryAll(); |
|
|
List<Component> componentList = this.componentDao.queryAll(); |
|
|
|
|
|
List<Map> result = new ArrayList<>(); |
|
|
|
|
|
if (componentList.size()==0){ |
|
|
|
|
|
return result; |
|
|
|
|
|
} |
|
|
Map<Integer,List<Component>> groupedComponent = componentList.stream().collect(Collectors.groupingBy(Component::getCategoryId)); |
|
|
Map<Integer,List<Component>> groupedComponent = componentList.stream().collect(Collectors.groupingBy(Component::getCategoryId)); |
|
|
return groupedComponent; |
|
|
|
|
|
|
|
|
for (Map.Entry <Integer,List<Component>> entry : groupedComponent.entrySet()) { |
|
|
|
|
|
String name = DictUtils.getCacheKey(String.valueOf(entry.getKey())); |
|
|
|
|
|
Map map = new HashMap(); |
|
|
|
|
|
map.put("key", entry.getKey()); |
|
|
|
|
|
map.put("name", name); |
|
|
|
|
|
map.put("value", entry.getValue()); |
|
|
|
|
|
result.add(map); |
|
|
|
|
|
} |
|
|
|
|
|
return result; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
|