From 0a2f6f78683ba1c4e07f1359c1e7bf105a4bd507 Mon Sep 17 00:00:00 2001
From: 潘志宝 <979469083@qq.com>
Date: 星期一, 23 九月 2024 13:59:07 +0800
Subject: [PATCH] mpk 分组管理

---
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/FileGroupDTO.java                     |    2 ++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileGroupServiceImpl.java    |   10 ++++++----
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileMenuServiceImpl.java     |   12 +++++++-----
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileMenuController.java  |    8 ++++++++
 iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileGroupController.java |    8 ++++++++
 5 files changed, 31 insertions(+), 9 deletions(-)

diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileGroupController.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileGroupController.java
index db9d1e1..8928393 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileGroupController.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/controller/admin/FileGroupController.java
@@ -1,6 +1,7 @@
 package com.iailab.module.model.mpk.controller.admin;
 
 import com.iailab.framework.common.pojo.CommonResult;
+import com.iailab.framework.common.util.object.ConvertUtils;
 import com.iailab.module.model.mpk.dto.FileGroupDTO;
 import com.iailab.module.model.mpk.entity.FileGroupEntity;
 import com.iailab.module.model.mpk.service.FileGroupService;
@@ -33,6 +34,13 @@
         return success(list);
     }
 
+    @GetMapping("/get")
+    @Operation(summary = "获取详情")
+    public CommonResult<FileGroupDTO> get(@RequestParam("id") String id) {
+        FileGroupDTO data = ConvertUtils.sourceToTarget(fileGroupService.get(id), FileGroupDTO.class);
+        return success(data);
+    }
+
     @PostMapping("/create")
     public CommonResult<Boolean> create(@Valid @RequestBody FileGroupEntity entity) {
         fileGroupService.create(entity);
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 f46d255..bf3818c 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,6 +1,7 @@
 package com.iailab.module.model.mpk.controller.admin;
 
 import com.iailab.framework.common.pojo.CommonResult;
+import com.iailab.framework.common.util.object.ConvertUtils;
 import com.iailab.module.model.mpk.dto.FileMenuDTO;
 import com.iailab.module.model.mpk.entity.FileMenuEntity;
 import com.iailab.module.model.mpk.service.FileMenuService;
@@ -34,6 +35,13 @@
         return success(list);
     }
 
+    @GetMapping("/get")
+    @Operation(summary = "获取详情")
+    public CommonResult<FileMenuDTO> get(@RequestParam("id") String id) {
+        FileMenuEntity data = fileMenuService.get(id);
+        return success(ConvertUtils.sourceToTarget(data, FileMenuDTO.class));
+    }
+
     @PostMapping("/create")
     public CommonResult<Boolean> create(@Valid @RequestBody FileMenuEntity entity) {
         fileMenuService.create(entity);
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/FileGroupDTO.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/FileGroupDTO.java
index a8dbe96..e26ea46 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/FileGroupDTO.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/dto/FileGroupDTO.java
@@ -13,6 +13,8 @@
 public class FileGroupDTO implements Serializable {
     private static final long serialVersionUID = 1L;
 
+    private String id;
+
     private String menuId;
 
     private String name;
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileGroupServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileGroupServiceImpl.java
index 4d9045f..fe639d5 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileGroupServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileGroupServiceImpl.java
@@ -11,6 +11,7 @@
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.UUID;
 
 /**
  * @author PanZhibao
@@ -38,13 +39,14 @@
     }
 
     @Override
-    public void create(FileGroupEntity fileMenuEntity) {
-        fileGroupDao.insert(fileMenuEntity);
+    public void create(FileGroupEntity entity) {
+        entity.setId(UUID.randomUUID().toString());
+        fileGroupDao.insert(entity);
     }
 
     @Override
-    public void update(FileGroupEntity fileMenuEntity) {
-        fileGroupDao.updateById(fileMenuEntity);
+    public void update(FileGroupEntity entity) {
+        fileGroupDao.updateById(entity);
     }
 
     @Override
diff --git a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileMenuServiceImpl.java b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileMenuServiceImpl.java
index aeb8c59..e3ccd38 100644
--- a/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileMenuServiceImpl.java
+++ b/iailab-module-model/iailab-module-model-biz/src/main/java/com/iailab/module/model/mpk/service/impl/FileMenuServiceImpl.java
@@ -12,6 +12,7 @@
 
 import javax.annotation.Resource;
 import java.util.List;
+import java.util.UUID;
 
 /**
  * @author PanZhibao
@@ -34,7 +35,7 @@
         wrapper.orderByAsc("sort");
         List<FileMenuDTO> list = ConvertUtils.sourceToTarget(fileMenuDao.selectList(wrapper), FileMenuDTO.class);
         list.forEach(item -> {
-            fileGroupService.list(item.getId());
+            item.setGroups(fileGroupService.list(item.getId()));
         });
         return list;
     }
@@ -45,13 +46,14 @@
     }
 
     @Override
-    public void create(FileMenuEntity fileMenuEntity) {
-        fileMenuDao.insert(fileMenuEntity);
+    public void create(FileMenuEntity entity) {
+        entity.setId(UUID.randomUUID().toString());
+        fileMenuDao.insert(entity);
     }
 
     @Override
-    public void update(FileMenuEntity fileMenuEntity) {
-        fileMenuDao.updateById(fileMenuEntity);
+    public void update(FileMenuEntity entity) {
+        fileMenuDao.updateById(entity);
     }
 
     @Override

--
Gitblit v1.9.3