Explorar o código

调整贴图和材质

liaoyitao hai 2 meses
pai
achega
47c0a8bf2c

+ 10 - 0
src/main/java/com/lqkj/link/module/zone/controller/MaterialInfoController.java

@@ -77,4 +77,14 @@ public class MaterialInfoController {
77 77
         return MessageBean.ok(null, "批量添加材质成功");
78 78
     }
79 79
 
80
+
81
+    /**
82
+     * 获取所有材质
83
+     * @return
84
+     */
85
+    @GetMapping("/getAll")
86
+    public List<MaterialInfo> getAll(){
87
+        return materialInfoService.getAll();
88
+    }
89
+
80 90
 }

+ 2 - 3
src/main/java/com/lqkj/link/module/zone/controller/TextureInfoController.java

@@ -48,9 +48,8 @@ public class TextureInfoController {
48 48
      * @return
49 49
      */
50 50
     @PostMapping("/getAll")
51
-    public MessageBean<List<TextureInfo>> getAll(@RequestParam(required = false, defaultValue = "") String name,
52
-                                                 @RequestParam(required = false) Integer userId) {
53
-        return MessageBean.ok(textureInfoService.getAll(name, userId), "贴图分页接口");
51
+    public List<TextureInfo> getAll(@RequestParam(required = false, defaultValue = "") String name, @RequestParam Integer userId) {
52
+        return textureInfoService.getAll(name, userId);
54 53
 
55 54
     }
56 55
 

+ 7 - 0
src/main/java/com/lqkj/link/module/zone/domain/MaterialInfo.java

@@ -57,4 +57,11 @@ public class MaterialInfo {
57 57
     @Schema(description = "用户id")
58 58
     private Integer userId;
59 59
 
60
+    @Transient
61
+    private String name;
62
+
63
+    public String getName() {
64
+        return materialId.toString();
65
+    }
66
+
60 67
 }

+ 7 - 0
src/main/java/com/lqkj/link/module/zone/domain/TextureInfo.java

@@ -35,4 +35,11 @@ public class TextureInfo {
35 35
     @Schema(description = "用户id")
36 36
     private Integer userId;
37 37
 
38
+    @Transient
39
+    private String name;
40
+
41
+    public String getName() {
42
+        return textureId.toString();
43
+    }
44
+
38 45
 }

+ 1 - 1
src/main/java/com/lqkj/link/module/zone/repository/TextureInfoRepository.java

@@ -52,7 +52,7 @@ public interface TextureInfoRepository extends JpaRepository<TextureInfo, Intege
52 52
     @Query(nativeQuery = true,
53 53
             value = "select * from texture_info where " +
54 54
                     "(:name = '' or texture_name like concat('%', :name, '%')) " +
55
-                    "and (:userId is null or user_id = :userId) "
55
+                    "and user_id = :userId "
56 56
     )
57 57
     List<TextureInfo> getAll(String name, Integer userId);
58 58
 }

+ 3 - 0
src/main/java/com/lqkj/link/module/zone/service/MaterialInfoService.java

@@ -38,4 +38,7 @@ public interface MaterialInfoService {
38 38
      * @param compressFilePath
39 39
      */
40 40
     void batchAdd(String compressFilePath);
41
+
42
+    List<MaterialInfo> getAll();
43
+
41 44
 }

+ 7 - 1
src/main/java/com/lqkj/link/module/zone/service/impl/MaterialInfoServiceImpl.java

@@ -92,7 +92,7 @@ public class MaterialInfoServiceImpl implements MaterialInfoService {
92 92
                         }
93 93
                         if (!materialMap.containsKey(modelFileName.substring(0, modelFileName.lastIndexOf(".")))) {
94 94
                             materialInfoList.add(new MaterialInfo(null, modelFileName.substring(0, modelFileName.lastIndexOf(".")), modelPath.substring(1),
95
-                                    modelPath.replace("model", "icon").replace("json", "png").substring(1), modelFileName, 1, new Date(), null));
95
+                                    modelPath.replace("model", "icon").replace("json", "png").substring(1), modelFileName, 1, new Date(), null, null));
96 96
                         } else {
97 97
                             MaterialInfo materialInfo = materialMap.get(modelFileName.substring(0, modelFileName.lastIndexOf(".")));
98 98
                             materialInfo.setMaterialIcon(modelPath.replace("model", "icon").replace("json", "png").substring(1));
@@ -111,5 +111,11 @@ public class MaterialInfoServiceImpl implements MaterialInfoService {
111 111
         }
112 112
     }
113 113
 
114
+    @Override
115
+    public List<MaterialInfo> getAll() {
116
+
117
+        return materialInfoRepository.findAll();
118
+    }
119
+
114 120
 
115 121
 }