From 303715d81f0c1cd8b32cd659b7734c01565369a6 Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期一, 30 九月 2024 17:46:55 +0800 Subject: [PATCH] Merge branch 'master' of ssh://172.16.8.100:29418/iailab-plat --- iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java | 23 +++++++++++++++++++++++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java index f8d4bba..899742d 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java @@ -1,5 +1,6 @@ package com.iailab.module.model.mpk.controller.admin; +import com.iailab.framework.common.dto.TreeLabelDTO; import com.iailab.framework.common.pojo.CommonResult; import com.iailab.framework.common.util.object.ConvertUtils; import com.iailab.module.model.mpk.dto.FileMenuDTO; @@ -11,6 +12,7 @@ import org.springframework.web.bind.annotation.*; import javax.validation.Valid; +import java.util.ArrayList; import java.util.List; import static com.iailab.framework.common.pojo.CommonResult.success; @@ -42,6 +44,27 @@ return success(ConvertUtils.sourceToTarget(data, FileMenuDTO.class)); } + @GetMapping("/tree") + public CommonResult<List<TreeLabelDTO>> tree() { + List<TreeLabelDTO> data = new ArrayList<>(); + List<FileMenuDTO> list = fileMenuService.list(); + list.forEach(menu -> { + TreeLabelDTO tree0 = new TreeLabelDTO(); + tree0.setValue(menu.getName()); + tree0.setLabel(menu.getName()); + List<TreeLabelDTO> groups = new ArrayList<>(); + menu.getGroups().forEach(group -> { + TreeLabelDTO tree1 = new TreeLabelDTO(); + tree1.setValue(group.getName()); + tree1.setLabel(group.getName()); + groups.add(tree1); + }); + tree0.setChildren(groups); + data.add(tree0); + }); + return success(ConvertUtils.sourceToTarget(data, TreeLabelDTO.class)); + } + @PostMapping("/create") public CommonResult<Boolean> create(@Valid @RequestBody FileMenuEntity entity) { fileMenuService.create(entity); -- Gitblit v1.9.3