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; 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); }); 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); } 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; } 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; }