From e57f0f19d5d1ad01cfcfc2a5b753cec1bf16826e Mon Sep 17 00:00:00 2001 From: MHW Date: Mon, 13 Apr 2026 17:02:08 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=9C=BA=E6=99=AFid=E6=98=BE?= =?UTF-8?q?=E7=A4=BA=E6=89=80=E6=9C=89=E8=A1=8C=E4=B8=BA=E6=A0=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/scene/SceneController.java | 9 +++++++++ .../solution/system/domain/Behaviortree.java | 11 ++++++++++ auto-solution-scene/pom.xml | 5 +++++ .../solution/scene/mapper/SceneMapper.java | 8 ++++++++ .../solution/scene/service/SceneService.java | 8 ++++++++ .../scene/service/impl/SceneServiceImpl.java | 20 +++++++++++++++++++ .../resources/mapper/scene/SceneMapper.xml | 6 ++++++ 7 files changed, 67 insertions(+) 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