Browse Source

修改组件分类

tags/v20240126
fans 2 years ago
parent
commit
0d5c6037e3
5 changed files with 14 additions and 9 deletions
  1. +2
    -2
      react-ui/config/proxy.ts
  2. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java
  3. +2
    -2
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsController.java
  4. +1
    -1
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ComponentService.java
  5. +8
    -3
      ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java

+ 2
- 2
react-ui/config/proxy.ts View File

@@ -15,14 +15,14 @@ export default {
// localhost:8000/api/** -> https://preview.pro.ant.design/api/**
'/api/': {
// 要代理的地址
target: 'http://localhost:8081',
target: 'http://localhost:8082',
// 配置了这个可以从 http 代理到 https
// 依赖 origin 的功能可能需要这个,比如 cookie
changeOrigin: true,
pathRewrite: { '^/api': '' },
},
'/profile/avatar/': {
target: 'http://localhost:8081',
target: 'http://localhost:8082',
changeOrigin: true,
}
},


+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/component/ComponentController.java View File

@@ -53,7 +53,7 @@ public class ComponentController {
*/
@GetMapping("/components/all")
@ApiOperation("查询全部")
public ResponseEntity<List> queryAll(){
public ResponseEntity<List> queryAll() throws Exception {
return ResponseEntity.ok(this.componentService.queryAllGroupedByCategory());
}



+ 2
- 2
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/controller/model/ModelsController.java View File

@@ -116,8 +116,8 @@ public class ModelsController {
* @return 上传结果
*/
@PostMapping("/upload_pipeline")
@ApiOperation(value = "从流水线上传模型", notes = "并将信息存入数据库")
public ResponseEntity<String> uploadModelsPipeline(@RequestBody ModelsVersion modelsVersion) throws Exception {
@ApiOperation("从流水线上传模型,并将信息存入数据库")
public ResponseEntity<String> uploadModelsPipeline(@RequestBody ModelsVersion modelsVersion){
return ResponseEntity.ok(this.modelsService.uploadModelsPipeline(modelsVersion));
}



+ 1
- 1
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/ComponentService.java View File

@@ -59,6 +59,6 @@ public interface ComponentService {

String removeById(Integer id);

List<Map> queryAllGroupedByCategory();
List<Map> queryAllGroupedByCategory() throws Exception;

}

+ 8
- 3
ruoyi-modules/management-platform/src/main/java/com/ruoyi/platform/service/impl/ComponentServiceImpl.java View File

@@ -7,6 +7,7 @@ import com.ruoyi.platform.service.ComponentService;
import com.ruoyi.platform.mapper.ComponentDao;
import com.ruoyi.platform.utils.ConvertUtil;
import com.ruoyi.platform.vo.ComponentVo;
import com.ruoyi.system.api.domain.SysDictData;
import com.ruoyi.system.api.model.LoginUser;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Value;
@@ -51,18 +52,22 @@ public class ComponentServiceImpl implements ComponentService {
}

@Override
public List<Map> queryAllGroupedByCategory() {
public List<Map> queryAllGroupedByCategory() throws Exception {
List<Component> componentList = this.componentDao.queryAll();
List<Map> result = new ArrayList<>();
if (componentList.isEmpty()){
return result;
}
List<SysDictData> categoryTypeList = DictUtils.getDictCache("category_type");
Map<Integer,List<Component>> groupedComponent = componentList.stream().collect(Collectors.groupingBy(Component::getCategoryId));
for (Map.Entry <Integer,List<Component>> entry : groupedComponent.entrySet()) {
String name = DictUtils.getCacheKey(String.valueOf(entry.getKey()));
List<SysDictData> categorys = categoryTypeList.stream().filter(sysDictData -> StringUtils.equals(sysDictData.getDictValue(), String.valueOf(entry.getKey()))).collect(Collectors.toList());
if (categorys.size() ==0){
throw new Exception("组件类型不存在");
}
Map map = new HashMap();
map.put("key", entry.getKey());
map.put("name", name);
map.put("name", categorys.get(0).getDictLabel());
map.put("value", entry.getValue());
result.add(map);
}


Loading…
Cancel
Save