潘志宝
2024-09-24 d8db4b32342b47a4ed269f5edae513718103d3bc
MDK文件配置修改
已修改5个文件
31 ■■■■■ 文件已修改
iailab-framework/iailab-common/src/main/java/com/iailab/framework/common/dto/TreeLabelDTO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/MpkFileController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/MpkFileDTO.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/MpkFileServiceImpl.java 8 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
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;
    }