diff --git a/auto-solution-admin/src/main/java/com/solution/web/controller/scene/SceneController.java b/auto-solution-admin/src/main/java/com/solution/web/controller/scene/SceneController.java
index 5b92009..311cbed 100644
--- a/auto-solution-admin/src/main/java/com/solution/web/controller/scene/SceneController.java
+++ b/auto-solution-admin/src/main/java/com/solution/web/controller/scene/SceneController.java
@@ -55,4 +55,13 @@ public class SceneController extends BaseController {
{
return success(sceneService.findOneById(id));
}
+
+ /**
+ * 根据场景id获取场景下所有行为树
+ */
+ @GetMapping("/getAllTree/{id}")
+ @ApiOperation("根据场景id获取场景下所有行为树")
+ public AjaxResult getAllTree(@PathVariable Integer id){
+ return success(sceneService.getAllTree(id));
+ }
}
diff --git a/auto-solution-behaviour/src/main/java/com/solution/system/domain/Behaviortree.java b/auto-solution-behaviour/src/main/java/com/solution/system/domain/Behaviortree.java
index 857d083..7ca0fec 100644
--- a/auto-solution-behaviour/src/main/java/com/solution/system/domain/Behaviortree.java
+++ b/auto-solution-behaviour/src/main/java/com/solution/system/domain/Behaviortree.java
@@ -49,6 +49,17 @@ public class Behaviortree extends BaseEntity
@Excel(name = "平台ID")
private Integer platformId;
+ @Excel(name = "场景ID")
+ private Integer scenarioId;
+
+ public Integer getScenarioId() {
+ return scenarioId;
+ }
+
+ public void setScenarioId(Integer scenarioId) {
+ this.scenarioId = scenarioId;
+ }
+
public Integer getPlatformId() {
return platformId;
}
diff --git a/auto-solution-scene/pom.xml b/auto-solution-scene/pom.xml
index a06d4fe..5a27d52 100644
--- a/auto-solution-scene/pom.xml
+++ b/auto-solution-scene/pom.xml
@@ -36,6 +36,11 @@
springfox-boot-starter
+
+ com.solution
+ solution-behaviour
+
+
\ No newline at end of file
diff --git a/auto-solution-scene/src/main/java/com/solution/scene/mapper/SceneMapper.java b/auto-solution-scene/src/main/java/com/solution/scene/mapper/SceneMapper.java
index 1285072..2f6112f 100644
--- a/auto-solution-scene/src/main/java/com/solution/scene/mapper/SceneMapper.java
+++ b/auto-solution-scene/src/main/java/com/solution/scene/mapper/SceneMapper.java
@@ -2,6 +2,7 @@ package com.solution.scene.mapper;
import com.solution.scene.domain.AfsimScenario;
import com.solution.scene.domain.AfsimScenarioForm;
+import com.solution.system.domain.Behaviortree;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@@ -26,4 +27,11 @@ public interface SceneMapper {
List selectSceneList();
AfsimScenario findOneById(Long id);
+
+ /**
+ * 根据场景id获取场景下所有行为树
+ * @param id
+ * @return
+ */
+ List selectAllTreeBySceneId(Integer id);
}
diff --git a/auto-solution-scene/src/main/java/com/solution/scene/service/SceneService.java b/auto-solution-scene/src/main/java/com/solution/scene/service/SceneService.java
index cc5ac5f..6f875d9 100644
--- a/auto-solution-scene/src/main/java/com/solution/scene/service/SceneService.java
+++ b/auto-solution-scene/src/main/java/com/solution/scene/service/SceneService.java
@@ -2,6 +2,7 @@ package com.solution.scene.service;
import com.solution.scene.domain.AfsimScenario;
import com.solution.scene.domain.AfsimScenarioForm;
+import com.solution.system.domain.Behaviortree;
import java.util.List;
@@ -25,4 +26,11 @@ public interface SceneService {
List selectSceneList();
AfsimScenario findOneById(Long id);
+
+ /**
+ * 根据场景id获取场景下所有行为树
+ * @param id
+ * @return
+ */
+ List getAllTree(Integer id);
}
diff --git a/auto-solution-scene/src/main/java/com/solution/scene/service/impl/SceneServiceImpl.java b/auto-solution-scene/src/main/java/com/solution/scene/service/impl/SceneServiceImpl.java
index 3de6b73..d50ed19 100644
--- a/auto-solution-scene/src/main/java/com/solution/scene/service/impl/SceneServiceImpl.java
+++ b/auto-solution-scene/src/main/java/com/solution/scene/service/impl/SceneServiceImpl.java
@@ -1,10 +1,13 @@
package com.solution.scene.service.impl;
+import cn.hutool.core.collection.CollUtil;
+import com.solution.common.constant.ExceptionConstants;
import com.solution.scene.domain.AfsimScenario;
import com.solution.scene.domain.AfsimScenarioForm;
import com.solution.scene.mapper.PlatFormCommunicationMapper;
import com.solution.scene.mapper.SceneMapper;
import com.solution.scene.service.SceneService;
+import com.solution.system.domain.Behaviortree;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -70,4 +73,21 @@ public class SceneServiceImpl implements SceneService {
return sceneMapper.findOneById(id);
}
+ /**
+ * 根据场景id获取场景下所有行为树
+ * @param id
+ * @return
+ */
+ @Override
+ public List getAllTree(Integer id) {
+ if(null == id || id <= 0){
+ throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
+ }
+ List allTree = sceneMapper.selectAllTreeBySceneId(id);
+ if(CollUtil.isEmpty(allTree)){
+ throw new RuntimeException("该场景下不存在行为树");
+ }
+ return allTree;
+ }
+
}
diff --git a/auto-solution-scene/src/main/resources/mapper/scene/SceneMapper.xml b/auto-solution-scene/src/main/resources/mapper/scene/SceneMapper.xml
index 1428fcb..7c9481b 100644
--- a/auto-solution-scene/src/main/resources/mapper/scene/SceneMapper.xml
+++ b/auto-solution-scene/src/main/resources/mapper/scene/SceneMapper.xml
@@ -25,6 +25,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
+
update afsim_scenario