From d8db4b32342b47a4ed269f5edae513718103d3bc Mon Sep 17 00:00:00 2001 From: 潘志宝 <979469083@qq.com> Date: 星期二, 24 九月 2024 15:15:39 +0800 Subject: [PATCH] MDK文件配置修改 --- iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/dto/TreeLabelDTO.java | 2 ++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/MpkFileDTO.java | 2 ++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java | 8 ++++++++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java | 17 +++++++++++++++++ iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java | 2 ++ 5 files changed, 31 insertions(+), 0 deletions(-) diff --git a/iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/dto/TreeLabelDTO.java b/iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/dto/TreeLabelDTO.java index cee02cc..cfa0e22 100644 --- a/iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/dto/TreeLabelDTO.java +++ b/iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/dto/TreeLabelDTO.java @@ -12,6 +12,8 @@ @Data public class TreeLabelDTO { + private String value; + private String label; private List<TreeLabelDTO> children; 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 d7ca39d..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 @@ -50,10 +50,12 @@ 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); }); diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java index f172db5..9931ccc 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java @@ -8,6 +8,7 @@ import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.util.CollectionUtils; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; @@ -41,6 +42,10 @@ @GetMapping("{id}") public CommonResult<MpkFileDTO> info(@PathVariable("id") String id) { MpkFileDTO schedule = mpkFileService.get(id); + List<String> menuAndGroup = new ArrayList<>(); + menuAndGroup.add(schedule.getMenuName()); + menuAndGroup.add(schedule.getGroupName()); + schedule.setMenuAndGroup(menuAndGroup); return success(schedule); } @@ -55,6 +60,12 @@ @PreAuthorize("@ss.hasPermission('mpk:file:create')") @PostMapping public CommonResult<Boolean> save(@RequestBody MpkFileDTO dto) { + if (!CollectionUtils.isEmpty(dto.getMenuAndGroup())) { + dto.setMenuName(dto.getMenuAndGroup().get(0)); + if (dto.getMenuAndGroup().size() > 1) { + dto.setGroupName(dto.getMenuAndGroup().get(1)); + } + } mpkFileService.save(dto); return CommonResult.success(true); } @@ -69,6 +80,12 @@ @PreAuthorize("@ss.hasPermission('mpk:file:update')") @PutMapping public CommonResult<Boolean> update(@RequestBody MpkFileDTO dto) { + if (!CollectionUtils.isEmpty(dto.getMenuAndGroup())) { + dto.setMenuName(dto.getMenuAndGroup().get(0)); + if (dto.getMenuAndGroup().size() > 1) { + dto.setGroupName(dto.getMenuAndGroup().get(1)); + } + } mpkFileService.update(dto); return CommonResult.success(true); } diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/MpkFileDTO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/MpkFileDTO.java index e47d22f..90524bb 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/MpkFileDTO.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/MpkFileDTO.java @@ -48,5 +48,7 @@ private Date createDate; + private List<String> menuAndGroup; + private List<ModelMethodDTO> modelMethods; } \ No newline at end of file diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java index ac4490c..b167e85 100644 --- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java +++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java @@ -94,11 +94,19 @@ String pyName = (String) params.get("pyName"); String pyType = (String) params.get("pyType"); String remark = (String) params.get("remark"); + String label = (String) params.get("label"); QueryWrapper<MpkFileEntity> wrapper = new QueryWrapper<>(); wrapper.like(StringUtils.isNotBlank(pyName), "py_name", pyName) .eq(StringUtils.isNotBlank(pyType), "py_type", pyType) .like(StringUtils.isNotBlank(remark), "remark", remark); + + if (StringUtils.isNotBlank(label)) { + wrapper.and(w -> { + w.eq(StringUtils.isNotBlank(label),"menu_name", label) + .or().eq(StringUtils.isNotBlank(label),"group_name", label); + }); + } return wrapper; } -- Gitblit v1.9.3