瀏覽代碼

更新!

TRX 1 年之前
父節點
當前提交
9ee4805685

+ 1 - 1
FullCardClient/src/main/java/com/zhongshu/card/client/model/scene/SceneInfoAboutComModel.java

@@ -21,6 +21,6 @@ import java.util.List;
 public class SceneInfoAboutComModel extends SceneInfoModel {
 
     @Schema(description = "包含的组件列表")
-    private List<SceneComponentModel> components = new ArrayList<>();
+    private List<SceneComponentModel> children = new ArrayList<>();
 
 }

+ 0 - 1
FullCardClient/src/main/java/com/zhongshu/card/client/model/scene/SceneInfoParam.java

@@ -36,7 +36,6 @@ public class SceneInfoParam extends SuperParam {
     @Schema(description = "类型")
     private SceneType sceneType;
 
-    @NotEmpty
     @Schema(description = "布局尺寸")
     private String layout;
 

+ 8 - 4
FullCardServer/src/main/java/com/zhongshu/card/server/core/controller/scene/SceneInfoController.java

@@ -4,10 +4,7 @@ import com.github.microservice.auth.security.annotations.ResourceAuth;
 import com.github.microservice.auth.security.type.AuthType;
 import com.github.microservice.net.ResultContent;
 import com.zhongshu.card.client.model.base.IDParam;
-import com.zhongshu.card.client.model.scene.SceneInfoAboutComModel;
-import com.zhongshu.card.client.model.scene.SceneInfoModel;
-import com.zhongshu.card.client.model.scene.SceneInfoParam;
-import com.zhongshu.card.client.model.scene.SceneInfoSearch;
+import com.zhongshu.card.client.model.scene.*;
 import com.zhongshu.card.client.type.DataState;
 import com.zhongshu.card.server.core.service.scene.SceneInfoService;
 import io.swagger.v3.oas.annotations.Operation;
@@ -23,6 +20,7 @@ import org.springframework.web.bind.annotation.RequestMethod;
 import org.springframework.web.bind.annotation.RestController;
 
 import javax.validation.Valid;
+import java.util.List;
 
 /**
  * @author TRX
@@ -80,5 +78,11 @@ public class SceneInfoController {
 
     //--------------------场景的组件 start---------------------
 
+    @ResourceAuth(value = "user", type = AuthType.User)
+    @Operation(summary = "查询查询下的 组件列表", description = "查询查询下的 组件列表")
+    @RequestMapping(value = {"getSceneAllComponents"}, method = {RequestMethod.POST})
+    public ResultContent<List<SceneComponentModel>> getSceneAllComponents(@RequestBody IDParam param) {
+        return ResultContent.buildSuccess(sceneInfoService.getSceneAllComponents(param.getId()));
+    }
 
 }

+ 20 - 2
FullCardServer/src/main/java/com/zhongshu/card/server/core/service/scene/SceneInfoService.java

@@ -46,8 +46,8 @@ public class SceneInfoService extends SuperService {
 
     public ResultContent saveInfo(SceneInfoParam param) {
         boolean isAdd = true;
-        SceneInfo entity = null;
 
+        SceneInfo entity = null;
         SceneInfo temp = sceneInfoDao.findTopByName(param.getName());
 //        SceneInfo codeTemp = sceneInfoDao.findTopByCode(param.getCode());
         if (StringUtils.isNotEmpty(param.getId())) {
@@ -179,6 +179,12 @@ public class SceneInfoService extends SuperService {
 
     //--------------------------场景组件信息 end-----------------------
 
+    /**
+     * 转换应用基本信息模型
+     *
+     * @param entity
+     * @return
+     */
     public SceneInfoModel toModel(SceneInfo entity) {
         SceneInfoModel model = new SceneInfoModel();
         if (ObjectUtils.isNotEmpty(entity)) {
@@ -187,16 +193,28 @@ public class SceneInfoService extends SuperService {
         return model;
     }
 
+    /**
+     * 转换应用模型 (包含组件)
+     *
+     * @param entity
+     * @return
+     */
     public SceneInfoAboutComModel toAboutComModel(SceneInfo entity) {
         SceneInfoAboutComModel model = new SceneInfoAboutComModel();
         if (ObjectUtils.isNotEmpty(entity)) {
             BeanUtils.copyProperties(entity, model);
             // 场景包含的组件
-            model.setComponents(getSceneAllComponents(entity.getId()));
+            model.setChildren(getSceneAllComponents(entity.getId()));
         }
         return model;
     }
 
+    /**
+     * 转换组件模型
+     *
+     * @param entity
+     * @return
+     */
     public SceneComponentModel toComponentModel(SceneComponent entity) {
         SceneComponentModel model = new SceneComponentModel();
         if (ObjectUtils.isNotEmpty(entity)) {