Преглед изворни кода

对接素材库接口及调整

tsurumure пре 1 месец
родитељ
комит
a9fcf6013d
22 измењених фајлова са 89 додато и 89 уклоњено
  1. 12 12
      db/ai_material.sql
  2. 2 2
      db/sys_user_role_menu.sql
  3. 5 6
      db/sys_user_role_permission_relation.sql
  4. 1 1
      db/sys_user_role_relation.sql
  5. 5 6
      src/main/java/com/backendsys/modules/material/controller/MaterialCategoryController.java
  6. 8 9
      src/main/java/com/backendsys/modules/material/controller/MaterialController.java
  7. 5 5
      src/main/java/com/backendsys/modules/material/controller/MaterialTagController.java
  8. 2 2
      src/main/java/com/backendsys/modules/material/dao/MaterialCategoryDao.java
  9. 2 2
      src/main/java/com/backendsys/modules/material/dao/MaterialDao.java
  10. 2 2
      src/main/java/com/backendsys/modules/material/dao/MaterialTagDao.java
  11. 1 3
      src/main/java/com/backendsys/modules/material/entity/Material.java
  12. 1 1
      src/main/java/com/backendsys/modules/material/entity/MaterialCategory.java
  13. 1 1
      src/main/java/com/backendsys/modules/material/entity/MaterialTag.java
  14. 2 3
      src/main/java/com/backendsys/modules/material/service/MaterialCategoryService.java
  15. 2 2
      src/main/java/com/backendsys/modules/material/service/MaterialService.java
  16. 2 2
      src/main/java/com/backendsys/modules/material/service/MaterialTagService.java
  17. 4 8
      src/main/java/com/backendsys/modules/material/service/impl/MaterialCategoryImpl.java
  18. 8 8
      src/main/java/com/backendsys/modules/material/service/impl/MaterialServiceImpl.java
  19. 16 6
      src/main/java/com/backendsys/modules/material/service/impl/MaterialTagImpl.java
  20. 2 2
      src/main/resources/mapper/ai/material/MaterialCategoryDao.xml
  21. 4 4
      src/main/resources/mapper/ai/material/MaterialDao.xml
  22. 2 2
      src/main/resources/mapper/ai/material/MaterialTagDao.xml

+ 12 - 12
db/ai_material.sql

@@ -26,17 +26,17 @@ CREATE TABLE `ai_material` (
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='素材表';
 
 INSERT INTO ai_material(user_id, category_id, tag_ids, material_name, image_thumb_url, image_url, fla_url, psd_url, is_copyright, create_time) VALUES
-    (1, 1, '1,2', '御姐魔女-1', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:00'),
-    (1, 1, '1,2', '御姐魔女-2', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:01'),
-    (1, 1, '1,2', '御姐魔女-3', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:02'),
-    (1, 1, '1,2', '御姐魔女-4', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:03'),
-    (1, 1, '1,2', '御姐魔女-5', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:04'),
-    (1, 1, '1,2', '御姐魔女-6', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:05'),
-    (1, 1, '1,2', '御姐魔女-7', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:06'),
-    (1, 1, '1,2', '御姐魔女-8', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:07'),
-    (1, 1, '4,5', '御姐魔女-9', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:08'),
-    (1, 1, '3,4,5', '御姐魔女-10', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:09'),
-    (1, 1, '3', '御姐魔女-11', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:10'),
-    (1, 1, '1,2', '御姐魔女-12', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:11')
+    (1, 1, '1,2', '御姐魔女-1', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:01'),
+    (1, 1, '1,2', '御姐魔女-2', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:02'),
+    (1, 1, '1,2', '御姐魔女-3', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:03'),
+    (1, 1, '1,2', '御姐魔女-4', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:04'),
+    (1, 1, '1,2', '御姐魔女-5', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:05'),
+    (1, 1, '1,2', '御姐魔女-6', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:06'),
+    (1, 1, '1,2', '御姐魔女-7', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:07'),
+    (1, 1, '4,5', '御姐魔女-8', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:08'),
+    (1, 1, '3,4,5', '御姐魔女-9', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:09'),
+    (1, 1, '3', '御姐魔女-10', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:10'),
+    (1, 2, '1,2', '御姐魔女-11', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.png', 'https://www.xxx.com/xx.fla', 'https://www.xxx.com/xx.psd', 1, '2025-07-28 08:30:11'),
+    (1, 1, '1,2', '竹屋内', 'https://cos.daogu.ai/temp/d2361395-6e39-4a01-8c3b-1c79095f4391.png?imageMogr2/thumbnail/315x180/pad/1/color/I2Y4ZjhmOA==', 'https://cos.daogu.ai/temp/d2361395-6e39-4a01-8c3b-1c79095f4391.png', 'https://cos.daogu.ai/temp/2d0e951d-d894-4f88-8904-bf9f1d4797f5.fla', 'https://cos.daogu.ai/temp/aba04bf3-fa42-48d7-923f-b223b7aee22c.psd', 1, '2025-07-30 08:30:00')
 ;
 

+ 2 - 2
db/sys_user_role_menu.sql

@@ -43,8 +43,8 @@ INSERT INTO sys_user_role_menu(id, parent_id, menu_name, menu_name_en, type, pat
     (11, -1, 'AI成片', 'AI Video', 1, '/ai/generate/video/broadcast/my/broadcast', '', '{}', 'VideoCamera', '34', 909),
 
 
-    (20, -1, '素材管理', 'Material', 1, '/material', '', '{}', 'MessageBox', '20', 10),
-    (21, 20, '素材列表', 'Material List', 1, '/material/list', '/src/views/material/materialList.vue', '{}', null, '20.1', 10),
+    (20, -1, '素材管理', 'Material', 1, '/material', '', '{}', 'MessageBox', '20', 13),
+    (21, 20, '素材列表', 'Material List', 1, '/material/materialList', '/src/views/material/materialList.vue', '{}', null, '20.1', 13),
 #
 #     (-1, '我的', 'Account', 1, '/account', '', '{}', 'User', '21', 11),
 #     (8, '我的素材', 'My MaterialService', 1, '/account/myMaterial', '', '{}', null, '21.1', 11),

+ 5 - 6
db/sys_user_role_permission_relation.sql

@@ -76,13 +76,12 @@ INSERT INTO sys_user_role_permission_relation(role_id, permission_id) VALUES
         (1, '11.6'),
             (1, '11.6.1'), (1, '11.6.2'), (1, '11.6.3'), (1, '11.6.4'),
 
+    (1, '20'),
+        (1, '20.1'),
+            (1, '20.1.1'), (1, '20.1.2'), (1, '20.1.3'), (1, '20.1.4'),
+        (1, '20.2'),
+        (1, '20.3'),
 
-#     (1, '20'),
-#         (1, '20.1'),
-#             (1, '20.1.1'), (1, '20.1.2'), (1, '20.1.3'), (1, '20.1.4'), (1, '20.1.5'), (1, '20.1.6'),
-#         (1, '20.2'),
-#             (1, '20.2.1'), (1, '20.2.2'), (1, '20.2.3'), (1, '20.2.4'),
-#
 #     (1, '21'),
 #         (1, '21.1'),
 #             (1, '21.1.1'), (1, '21.1.2'), (1, '21.1.3'), (1, '21.1.4'), (1, '21.1.5'), (1, '21.1.6'),

+ 1 - 1
db/sys_user_role_relation.sql

@@ -15,7 +15,7 @@ CREATE TABLE `sys_user_role_relation` (
 ) ENGINE=INNODB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8mb4 COMMENT='系统用户角色关系表';
 
 INSERT INTO sys_user_role_relation(user_id, role_id) VALUES
-    (1, 4), (2, 1), (3, 3), (4, 2), (5, 2), (6, 2),
+    (1, 1), (2, 4), (3, 3), (4, 2), (5, 2), (6, 2),
     (7, 2), (8, 2), (9, 2), (10, 2), (11, 2), (12, 2),
     (13, 1), (14, 1), (15, 1), (16, 1)
 ;

+ 5 - 6
src/main/java/com/backendsys/modules/ai/material/controller/MaterialCategoryController.java → src/main/java/com/backendsys/modules/material/controller/MaterialCategoryController.java

@@ -1,12 +1,11 @@
-package com.backendsys.modules.ai.material.controller;
+package com.backendsys.modules.material.controller;
 
-import com.backendsys.modules.ai.material.entity.MaterialCategory;
-import com.backendsys.modules.ai.material.service.MaterialCategoryService;
+import com.backendsys.modules.material.entity.MaterialCategory;
+import com.backendsys.modules.material.service.MaterialCategoryService;
 import com.backendsys.modules.common.utils.Result;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.RestController;
@@ -21,14 +20,14 @@ public class MaterialCategoryController {
 
     @Operation(summary = "获取素材分类列表")
 //    @PreAuthorize("@sr.hasPermission('20.2')")
-    @GetMapping("/api/ai/material/getMaterialCategoryList")
+    @GetMapping("/api/material/getMaterialCategoryList")
     public Result getMaterialCategoryList(MaterialCategory materialCategory) {
         return Result.success().put("data", materialCategoryService.selectMaterialCategoryList(materialCategory));
     }
 
     @Operation(summary = "获取素材分类列表(下拉)")
 //    @PreAuthorize("@sr.hasPermission('20.2')")
-    @GetMapping("/api/ai/material/getMaterialCategoryPopover")
+    @GetMapping("/api/material/getMaterialCategoryPopover")
     public Result getMaterialCategoryPopover() {
         return Result.success().put("data", materialCategoryService.selectMaterialCategoryPopover());
     }

+ 8 - 9
src/main/java/com/backendsys/modules/ai/material/controller/MaterialController.java → src/main/java/com/backendsys/modules/material/controller/MaterialController.java

@@ -1,8 +1,7 @@
-package com.backendsys.modules.ai.material.controller;
+package com.backendsys.modules.material.controller;
 
-import com.backendsys.modules.ai.material.entity.Material;
-import com.backendsys.modules.ai.material.entity.MaterialTag;
-import com.backendsys.modules.ai.material.service.MaterialService;
+import com.backendsys.modules.material.entity.Material;
+import com.backendsys.modules.material.service.MaterialService;
 import com.backendsys.modules.common.aspect.SysLog;
 import com.backendsys.modules.common.config.security.utils.SecurityUtil;
 import com.backendsys.modules.common.utils.Result;
@@ -23,21 +22,21 @@ public class MaterialController {
 
     @Operation(summary = "获取素材列表")
     @PreAuthorize("@sr.hasPermission('20.1')")
-    @GetMapping("/api/ai/material/getMaterialList")
+    @GetMapping("/api/material/getMaterialList")
     public Result getMaterialList(Material material) {
         return Result.success().put("data", materialService.selectMaterialList(material));
     }
 
     @Operation(summary = "获取素材列表")
 //    @PreAuthorize("@sr.hasPermission('20.1.1')")
-    @GetMapping("/api/ai/material/getMaterialDetail")
+    @GetMapping("/api/material/getMaterialDetail")
     public Result getMaterialDetail(@Validated(Material.Detail.class) Material material) {
         return Result.success().put("data", materialService.selectMaterialDetail(material));
     }
 
     @Operation(summary = "创建素材")
     @PreAuthorize("@sr.hasPermission('20.1.2')")
-    @PostMapping("/api/ai/material/createMaterial")
+    @PostMapping("/api/material/createMaterial")
     public Result createMaterial(@Validated(Material.Create.class) @RequestBody Material material) {
         material.setUser_id(SecurityUtil.getUserId());
         return Result.success().put("data", materialService.insertMaterial(material));
@@ -46,7 +45,7 @@ public class MaterialController {
     @SysLog("编辑素材")
     @Operation(summary = "编辑素材")
     @PreAuthorize("@sr.hasPermission('20.1.3')")
-    @PutMapping("/api/ai/material/updateMaterial")
+    @PutMapping("/api/material/updateMaterial")
     public Result updateMaterial(@Validated(Material.Update.class) @RequestBody Material material) {
         material.setUser_id(SecurityUtil.getUserId());
         return Result.success().put("data", materialService.updateMaterial(material));
@@ -55,7 +54,7 @@ public class MaterialController {
     @SysLog("删除素材")
     @Operation(summary = "删除素材")
     @PreAuthorize("@sr.hasPermission('20.1.4')")
-    @DeleteMapping("/api/ai/material/deleteMaterial")
+    @DeleteMapping("/api/material/deleteMaterial")
     public Result deleteMaterial(@Validated(Material.Delete.class) @RequestBody Material material) {
         return Result.success().put("data", materialService.deleteMaterial(material));
     }

+ 5 - 5
src/main/java/com/backendsys/modules/ai/material/controller/MaterialTagController.java → src/main/java/com/backendsys/modules/material/controller/MaterialTagController.java

@@ -1,7 +1,7 @@
-package com.backendsys.modules.ai.material.controller;
+package com.backendsys.modules.material.controller;
 
-import com.backendsys.modules.ai.material.entity.MaterialTag;
-import com.backendsys.modules.ai.material.service.MaterialTagService;
+import com.backendsys.modules.material.entity.MaterialTag;
+import com.backendsys.modules.material.service.MaterialTagService;
 import com.backendsys.modules.common.utils.Result;
 import io.swagger.v3.oas.annotations.Operation;
 import io.swagger.v3.oas.annotations.tags.Tag;
@@ -21,14 +21,14 @@ public class MaterialTagController {
 
     @Operation(summary = "获取素材标签列表")
     @PreAuthorize("@sr.hasPermission('20.3')")
-    @GetMapping("/api/ai/material/getMaterialTagList")
+    @GetMapping("/api/material/getMaterialTagList")
     public Result getMaterialTagList(@Validated(MaterialTag.TagList.class) MaterialTag materialTag) {
         return Result.success().put("data", materialTagService.selectMaterialTagList(materialTag));
     }
 
     @Operation(summary = "获取素材标签列表(下拉)")
     @PreAuthorize("@sr.hasPermission('20.3')")
-    @GetMapping("/api/ai/material/getMaterialTagPopover")
+    @GetMapping("/api/material/getMaterialTagPopover")
     public Result getMaterialTagPopover(@Validated(MaterialTag.TagList.class) MaterialTag materialTag) {
         return Result.success().put("data", materialTagService.selectMaterialTagPopover(materialTag));
     }

+ 2 - 2
src/main/java/com/backendsys/modules/ai/material/dao/MaterialCategoryDao.java → src/main/java/com/backendsys/modules/material/dao/MaterialCategoryDao.java

@@ -1,6 +1,6 @@
-package com.backendsys.modules.ai.material.dao;
+package com.backendsys.modules.material.dao;
 
-import com.backendsys.modules.ai.material.entity.MaterialCategory;
+import com.backendsys.modules.material.entity.MaterialCategory;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 

+ 2 - 2
src/main/java/com/backendsys/modules/ai/material/dao/MaterialDao.java → src/main/java/com/backendsys/modules/material/dao/MaterialDao.java

@@ -1,6 +1,6 @@
-package com.backendsys.modules.ai.material.dao;
+package com.backendsys.modules.material.dao;
 
-import com.backendsys.modules.ai.material.entity.Material;
+import com.backendsys.modules.material.entity.Material;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 

+ 2 - 2
src/main/java/com/backendsys/modules/ai/material/dao/MaterialTagDao.java → src/main/java/com/backendsys/modules/material/dao/MaterialTagDao.java

@@ -1,6 +1,6 @@
-package com.backendsys.modules.ai.material.dao;
+package com.backendsys.modules.material.dao;
 
-import com.backendsys.modules.ai.material.entity.MaterialTag;
+import com.backendsys.modules.material.entity.MaterialTag;
 import com.baomidou.mybatisplus.core.mapper.BaseMapper;
 import org.apache.ibatis.annotations.Mapper;
 

+ 1 - 3
src/main/java/com/backendsys/modules/ai/material/entity/Material.java → src/main/java/com/backendsys/modules/material/entity/Material.java

@@ -1,4 +1,4 @@
-package com.backendsys.modules.ai.material.entity;
+package com.backendsys.modules.material.entity;
 
 import com.backendsys.config.Mybatis.handler.timezone.LocalDateTimeAdapter;
 import com.backendsys.entity.validator.RangeArray;
@@ -11,11 +11,9 @@ import jakarta.validation.constraints.NotEmpty;
 import jakarta.validation.constraints.NotNull;
 import jakarta.validation.constraints.Size;
 import lombok.Data;
-import org.hibernate.validator.constraints.Range;
 
 import java.time.LocalDateTime;
 import java.util.List;
-import java.util.Map;
 
 @Data
 @TableName("ai_material")

+ 1 - 1
src/main/java/com/backendsys/modules/ai/material/entity/MaterialCategory.java → src/main/java/com/backendsys/modules/material/entity/MaterialCategory.java

@@ -1,4 +1,4 @@
-package com.backendsys.modules.ai.material.entity;
+package com.backendsys.modules.material.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;

+ 1 - 1
src/main/java/com/backendsys/modules/ai/material/entity/MaterialTag.java → src/main/java/com/backendsys/modules/material/entity/MaterialTag.java

@@ -1,4 +1,4 @@
-package com.backendsys.modules.ai.material.entity;
+package com.backendsys.modules.material.entity;
 
 import com.baomidou.mybatisplus.annotation.IdType;
 import com.baomidou.mybatisplus.annotation.TableField;

+ 2 - 3
src/main/java/com/backendsys/modules/ai/material/service/MaterialCategoryService.java → src/main/java/com/backendsys/modules/material/service/MaterialCategoryService.java

@@ -1,8 +1,7 @@
-package com.backendsys.modules.ai.material.service;
+package com.backendsys.modules.material.service;
 
-import com.backendsys.modules.ai.material.entity.MaterialCategory;
+import com.backendsys.modules.material.entity.MaterialCategory;
 import com.backendsys.utils.response.PageEntity;
-import com.baomidou.mybatisplus.extension.service.IService;
 
 import java.util.List;
 

+ 2 - 2
src/main/java/com/backendsys/modules/ai/material/service/MaterialService.java → src/main/java/com/backendsys/modules/material/service/MaterialService.java

@@ -1,6 +1,6 @@
-package com.backendsys.modules.ai.material.service;
+package com.backendsys.modules.material.service;
 
-import com.backendsys.modules.ai.material.entity.Material;
+import com.backendsys.modules.material.entity.Material;
 import com.backendsys.utils.response.PageEntity;
 
 import java.util.Map;

+ 2 - 2
src/main/java/com/backendsys/modules/ai/material/service/MaterialTagService.java → src/main/java/com/backendsys/modules/material/service/MaterialTagService.java

@@ -1,6 +1,6 @@
-package com.backendsys.modules.ai.material.service;
+package com.backendsys.modules.material.service;
 
-import com.backendsys.modules.ai.material.entity.MaterialTag;
+import com.backendsys.modules.material.entity.MaterialTag;
 import com.backendsys.utils.response.PageEntity;
 
 import java.util.List;

+ 4 - 8
src/main/java/com/backendsys/modules/ai/material/service/impl/MaterialCategoryImpl.java → src/main/java/com/backendsys/modules/material/service/impl/MaterialCategoryImpl.java

@@ -1,15 +1,11 @@
-package com.backendsys.modules.ai.material.service.impl;
+package com.backendsys.modules.material.service.impl;
 
-import com.backendsys.modules.ai.material.dao.MaterialCategoryDao;
-import com.backendsys.modules.ai.material.entity.MaterialCategory;
-import com.backendsys.modules.ai.material.service.MaterialCategoryService;
-import com.backendsys.modules.system.dao.SysUserRolePermissionDao;
-import com.backendsys.modules.system.entity.SysUserRolePermission;
+import com.backendsys.modules.material.dao.MaterialCategoryDao;
+import com.backendsys.modules.material.entity.MaterialCategory;
+import com.backendsys.modules.material.service.MaterialCategoryService;
 import com.backendsys.utils.response.PageEntity;
 import com.backendsys.utils.response.PageInfoResult;
 import com.backendsys.utils.v2.PageUtils;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 

+ 8 - 8
src/main/java/com/backendsys/modules/ai/material/service/impl/MaterialServiceImpl.java → src/main/java/com/backendsys/modules/material/service/impl/MaterialServiceImpl.java

@@ -1,15 +1,15 @@
-package com.backendsys.modules.ai.material.service.impl;
+package com.backendsys.modules.material.service.impl;
 
 import cn.hutool.core.convert.Convert;
 import cn.hutool.core.util.StrUtil;
 import com.backendsys.exception.CustException;
-import com.backendsys.modules.ai.material.dao.MaterialCategoryDao;
-import com.backendsys.modules.ai.material.dao.MaterialDao;
-import com.backendsys.modules.ai.material.dao.MaterialTagDao;
-import com.backendsys.modules.ai.material.entity.Material;
-import com.backendsys.modules.ai.material.entity.MaterialCategory;
-import com.backendsys.modules.ai.material.entity.MaterialTag;
-import com.backendsys.modules.ai.material.service.MaterialService;
+import com.backendsys.modules.material.dao.MaterialCategoryDao;
+import com.backendsys.modules.material.dao.MaterialDao;
+import com.backendsys.modules.material.dao.MaterialTagDao;
+import com.backendsys.modules.material.entity.Material;
+import com.backendsys.modules.material.entity.MaterialCategory;
+import com.backendsys.modules.material.entity.MaterialTag;
+import com.backendsys.modules.material.service.MaterialService;
 import com.backendsys.modules.upload.service.SysFileService;
 import com.backendsys.modules.upload.utils.ObjectKey.ObjectKeyEntity;
 import com.backendsys.modules.upload.utils.ObjectKey.ObjectKeyUtil;

+ 16 - 6
src/main/java/com/backendsys/modules/ai/material/service/impl/MaterialTagImpl.java → src/main/java/com/backendsys/modules/material/service/impl/MaterialTagImpl.java

@@ -1,12 +1,11 @@
-package com.backendsys.modules.ai.material.service.impl;
+package com.backendsys.modules.material.service.impl;
 
-import com.backendsys.modules.ai.material.dao.MaterialTagDao;
-import com.backendsys.modules.ai.material.entity.MaterialTag;
-import com.backendsys.modules.ai.material.service.MaterialTagService;
+import com.backendsys.modules.material.dao.MaterialTagDao;
+import com.backendsys.modules.material.entity.MaterialTag;
+import com.backendsys.modules.material.service.MaterialTagService;
 import com.backendsys.utils.response.PageEntity;
 import com.backendsys.utils.response.PageInfoResult;
 import com.backendsys.utils.v2.PageUtils;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 
@@ -33,7 +32,18 @@ public class MaterialTagImpl implements MaterialTagService {
      */
     @Override
     public List<MaterialTag> selectMaterialTagPopover(MaterialTag materialTag) {
-        return materialTagDao.selectMaterialTagList(materialTag);
+        List<MaterialTag> list = materialTagDao.selectMaterialTagList(materialTag);
+
+        // 筛选出列表中,所有 material_count 的总和
+        Integer all_material_count = list.stream().mapToInt(MaterialTag::getMaterial_count).sum();
+
+        MaterialTag all = new MaterialTag();
+        all.setTag_name("全部");
+        all.setTag_id(null);
+        all.setMaterial_count(all_material_count);
+        list.add(0, all);
+
+        return list;
     }
 
 }

+ 2 - 2
src/main/resources/mapper/ai/material/MaterialCategoryDao.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.backendsys.modules.ai.material.dao.MaterialCategoryDao">
+<mapper namespace="com.backendsys.modules.material.dao.MaterialCategoryDao">
 
     <sql id="includeMaterialCategory">
         id,
@@ -9,7 +9,7 @@
         sort
     </sql>
     <!-- COALESCE(content_type, '') content_type, -->
-    <resultMap id="resultMapMaterialCategory" type="com.backendsys.modules.ai.material.entity.MaterialCategory">
+    <resultMap id="resultMapMaterialCategory" type="com.backendsys.modules.material.entity.MaterialCategory">
         <id property="id" column="id" jdbcType="BIGINT" />
         <result property="category_id" column="id" javaType="java.lang.Long" />
         <result property="category_name" column="category_name" />

+ 4 - 4
src/main/resources/mapper/ai/material/MaterialDao.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.backendsys.modules.ai.material.dao.MaterialDao">
+<mapper namespace="com.backendsys.modules.material.dao.MaterialDao">
 
     <sql id="includeMaterial">
         m.id,
@@ -50,7 +50,7 @@
                 typeHandler="com.backendsys.config.Mybatis.handler.timezone.LocalDateTimeHandler" />
     </resultMap>
 
-    <resultMap id="resultMapMaterialDetail" type="com.backendsys.modules.ai.material.entity.Material">
+    <resultMap id="resultMapMaterialDetail" type="com.backendsys.modules.material.entity.Material">
         <id property="id" column="id" jdbcType="BIGINT" />
         <result property="material_id" column="id" javaType="java.lang.Long" />
         <result property="user_id" column="user_id" javaType="java.lang.Long" />
@@ -103,7 +103,7 @@
     </select>
 
     <!-- 增 -->
-    <insert id="insertMaterial" parameterType="com.backendsys.modules.ai.material.entity.Material"
+    <insert id="insertMaterial" parameterType="com.backendsys.modules.material.entity.Material"
         useGeneratedKeys="true" keyProperty="material_id">
         INSERT INTO ai_material (
             user_id, category_id, material_name
@@ -126,7 +126,7 @@
     </insert>
 
     <!-- 改 -->
-    <update id="updateMaterial" parameterType="com.backendsys.modules.ai.material.entity.Material"
+    <update id="updateMaterial" parameterType="com.backendsys.modules.material.entity.Material"
         useGeneratedKeys="true" keyProperty="material_id">
         UPDATE ai_material SET
         user_id = #{user_id}

+ 2 - 2
src/main/resources/mapper/ai/material/MaterialTagDao.xml

@@ -1,6 +1,6 @@
 <?xml version="1.0" encoding="utf-8" ?>
 <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
-<mapper namespace="com.backendsys.modules.ai.material.dao.MaterialTagDao">
+<mapper namespace="com.backendsys.modules.material.dao.MaterialTagDao">
 
     <sql id="includeMaterialTag">
         mt.id,
@@ -10,7 +10,7 @@
         mt.sort
     </sql>
     <!-- COALESCE(content_type, '') content_type, -->
-    <resultMap id="resultMapMaterialTag" type="com.backendsys.modules.ai.material.entity.MaterialTag">
+    <resultMap id="resultMapMaterialTag" type="com.backendsys.modules.material.entity.MaterialTag">
         <id property="id" column="id" jdbcType="BIGINT" />
         <result property="tag_id" column="id" javaType="java.lang.Long" />
         <result property="category_id" column="category_id" javaType="java.lang.Long" />