From 2d60a8b90fc550b2ce3cc9190193fa1454b98911 Mon Sep 17 00:00:00 2001 From: MHW Date: Wed, 15 Apr 2026 16:26:49 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A0=B9=E6=8D=AE=E5=B9=B3=E5=8F=B0id=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E8=AF=A5=E8=A1=8C=E4=B8=BA=E6=A0=91=E7=9A=84=E4=B8=8B?= =?UTF-8?q?=E5=B1=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../behaviour/BehaviortreeController.java | 12 +++---- .../solution/system/domain/PlatformVO.java | 34 +++++++++++++++++++ .../system/mapper/PlatformMapper.java | 22 ++++++++---- .../system/service/IBehaviortreeService.java | 7 ++-- .../service/impl/BehaviortreeServiceImpl.java | 28 +++++++-------- .../mapper/system/PlatformMapper.xml | 26 ++++++++++---- modeler/types/components.d.ts | 4 +++ 7 files changed, 98 insertions(+), 35 deletions(-) create mode 100644 auto-solution-behaviour/src/main/java/com/solution/system/domain/PlatformVO.java diff --git a/auto-solution-admin/src/main/java/com/solution/web/controller/behaviour/BehaviortreeController.java b/auto-solution-admin/src/main/java/com/solution/web/controller/behaviour/BehaviortreeController.java index 6b0c84b..f711569 100644 --- a/auto-solution-admin/src/main/java/com/solution/web/controller/behaviour/BehaviortreeController.java +++ b/auto-solution-admin/src/main/java/com/solution/web/controller/behaviour/BehaviortreeController.java @@ -136,16 +136,16 @@ public class BehaviortreeController extends BaseController } /** - * 根据行为树id获取该行为树的下属 - * @param treeId + * 根据平台id获取该行为树的下属 + * @param platformId * @return */ - @ApiOperation("根据行为树id获取该行为树的下属") + @ApiOperation("根据平台id获取该行为树的下属") @PreAuthorize("@ss.hasPermi('system:behaviortree:query')") - @GetMapping("/underling/{treeId}") - public AjaxResult getUnderling(@PathVariable Integer treeId) + @GetMapping("/underling/{platformId}") + public AjaxResult getUnderling(@PathVariable Integer platformId) { - return success(behaviortreeService.getUnderling(treeId)); + return success(behaviortreeService.getUnderling(platformId)); } /** diff --git a/auto-solution-behaviour/src/main/java/com/solution/system/domain/PlatformVO.java b/auto-solution-behaviour/src/main/java/com/solution/system/domain/PlatformVO.java new file mode 100644 index 0000000..68c7aaa --- /dev/null +++ b/auto-solution-behaviour/src/main/java/com/solution/system/domain/PlatformVO.java @@ -0,0 +1,34 @@ +package com.solution.system.domain; + +import lombok.Data; + +/** + * 平台视图对象 platform + */ +@Data +public class PlatformVO +{ + /** 主键 */ + private Integer id; + + /** 名称 */ + private String name; + + /** 描述 */ + private String description; + + /** 平台出现在想定上的想定id */ + private Integer scenarioId; + + /** 经度 */ + private String longitude; + + /** 纬度 */ + private String latitude; + + /** 平台类型 */ + private String platformType; + + /** 海拔 */ + private Float altitude; +} \ No newline at end of file diff --git a/auto-solution-behaviour/src/main/java/com/solution/system/mapper/PlatformMapper.java b/auto-solution-behaviour/src/main/java/com/solution/system/mapper/PlatformMapper.java index 520e8ea..aff86bc 100644 --- a/auto-solution-behaviour/src/main/java/com/solution/system/mapper/PlatformMapper.java +++ b/auto-solution-behaviour/src/main/java/com/solution/system/mapper/PlatformMapper.java @@ -1,6 +1,7 @@ package com.solution.system.mapper; import com.solution.system.domain.PlatformTree; +import com.solution.system.domain.PlatformVO; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -9,12 +10,7 @@ import java.util.List; @Mapper public interface PlatformMapper { - /** - * 根据行为树id获取行为树所属平台 - * @param id - * @return - */ - PlatformTree getPlatformByTreeId(Integer id); + /** * 根据下属平台英文名获取中文名返回 @@ -22,4 +18,18 @@ public interface PlatformMapper { * @return */ List selectPlatformChineseName(@Param("underlingEnglishName") List underlingEnglishName); + + /** + * 根据平台id获取平台实体 + * @param platformId + * @return + */ + PlatformTree getPlatformById(Integer platformId); + + /** + * 根据平台英文名查询该平台实体 + * @param underlingEnglishName + * @return + */ + List getPlatformByEnglishName(@Param("underlingEnglishName") List underlingEnglishName); } diff --git a/auto-solution-behaviour/src/main/java/com/solution/system/service/IBehaviortreeService.java b/auto-solution-behaviour/src/main/java/com/solution/system/service/IBehaviortreeService.java index ecfd78a..bad4da3 100644 --- a/auto-solution-behaviour/src/main/java/com/solution/system/service/IBehaviortreeService.java +++ b/auto-solution-behaviour/src/main/java/com/solution/system/service/IBehaviortreeService.java @@ -4,6 +4,7 @@ import java.util.List; import com.solution.system.domain.Behaviortree; import com.solution.system.domain.PlatformChiefCommander; +import com.solution.system.domain.PlatformVO; /** * 行为树主Service接口 @@ -65,11 +66,11 @@ public interface IBehaviortreeService public int deleteBehaviortreeById(Long id); /** - * 根据行为树id获取该行为树的下属 - * @param treeId + * 根据平台id获取该行为树的下属 + * @param platformId * @return */ - List getUnderling(Integer treeId); + List getUnderling(Integer platformId); /** * 根据场景id获取总指挥的行为树的原数据 diff --git a/auto-solution-behaviour/src/main/java/com/solution/system/service/impl/BehaviortreeServiceImpl.java b/auto-solution-behaviour/src/main/java/com/solution/system/service/impl/BehaviortreeServiceImpl.java index bb25079..8262e07 100644 --- a/auto-solution-behaviour/src/main/java/com/solution/system/service/impl/BehaviortreeServiceImpl.java +++ b/auto-solution-behaviour/src/main/java/com/solution/system/service/impl/BehaviortreeServiceImpl.java @@ -7,6 +7,7 @@ import cn.hutool.core.util.ObjectUtil; import com.solution.common.constant.ExceptionConstants; import com.solution.system.domain.PlatformChiefCommander; import com.solution.system.domain.PlatformTree; +import com.solution.system.domain.PlatformVO; import com.solution.system.mapper.PlatformCommunicationMapper; import com.solution.system.mapper.PlatformMapper; import org.springframework.beans.factory.annotation.Autowired; @@ -112,29 +113,28 @@ public class BehaviortreeServiceImpl implements IBehaviortreeService } /** - * 根据行为树id获取该行为树的下属 - * @param treeId + * 根据平台id获取该行为树的下属 + * @param platformId * @return */ @Override - public List getUnderling(Integer treeId) { - if(null == treeId){ + public List getUnderling(Integer platformId) { + if(null == platformId){ throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION); } - Behaviortree behaviortree = behaviortreeMapper.selectBehaviortreeById(Long.valueOf(treeId)); - if(ObjectUtil.isEmpty(behaviortree) || null == behaviortree.getId()){ - throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION); - } - //根据行为树id获取行为树所属平台 - PlatformTree platform = platformMapper.getPlatformByTreeId(behaviortree.getPlatformId()); + //根据平台id获取平台实体 + PlatformTree platform = platformMapper.getPlatformById(platformId); //根据平台name获取平台下属英文名 List underlingEnglishName = platformCommunicationMapper.getUnderlingBytreeId(platform.getName()); - //根据下属平台英文名获取中文名返回 - List underlingChineseName = platformMapper.selectPlatformChineseName(underlingEnglishName); - if(CollUtil.isEmpty(underlingChineseName)){ + if(CollUtil.isEmpty(underlingEnglishName)){ throw new RuntimeException("该平台暂无下属"); } - return underlingChineseName; + //根据平台英文名查询该平台实体 + List resultList = platformMapper.getPlatformByEnglishName(underlingEnglishName); + if(CollUtil.isEmpty(resultList)){ + throw new RuntimeException("无法根据平台英文名获取平台实体"); + } + return resultList; } /** diff --git a/auto-solution-behaviour/src/main/resources/mapper/system/PlatformMapper.xml b/auto-solution-behaviour/src/main/resources/mapper/system/PlatformMapper.xml index e6fc609..060db5c 100644 --- a/auto-solution-behaviour/src/main/resources/mapper/system/PlatformMapper.xml +++ b/auto-solution-behaviour/src/main/resources/mapper/system/PlatformMapper.xml @@ -5,12 +5,7 @@ - + + + \ No newline at end of file diff --git a/modeler/types/components.d.ts b/modeler/types/components.d.ts index 30cf0a1..f181ba2 100644 --- a/modeler/types/components.d.ts +++ b/modeler/types/components.d.ts @@ -38,6 +38,7 @@ declare module 'vue' { AListItem: typeof import('ant-design-vue/es')['ListItem'] AListItemMeta: typeof import('ant-design-vue/es')['ListItemMeta'] AMenu: typeof import('ant-design-vue/es')['Menu'] + AMenuDivider: typeof import('ant-design-vue/es')['MenuDivider'] AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] APagination: typeof import('ant-design-vue/es')['Pagination'] APopconfirm: typeof import('ant-design-vue/es')['Popconfirm'] @@ -47,6 +48,7 @@ declare module 'vue' { ASelect: typeof import('ant-design-vue/es')['Select'] ASelectOption: typeof import('ant-design-vue/es')['SelectOption'] ASpace: typeof import('ant-design-vue/es')['Space'] + ASubMenu: typeof import('ant-design-vue/es')['SubMenu'] ASwitch: typeof import('ant-design-vue/es')['Switch'] ATabPane: typeof import('ant-design-vue/es')['TabPane'] ATabs: typeof import('ant-design-vue/es')['Tabs'] @@ -86,6 +88,7 @@ declare global { const AListItem: typeof import('ant-design-vue/es')['ListItem'] const AListItemMeta: typeof import('ant-design-vue/es')['ListItemMeta'] const AMenu: typeof import('ant-design-vue/es')['Menu'] + const AMenuDivider: typeof import('ant-design-vue/es')['MenuDivider'] const AMenuItem: typeof import('ant-design-vue/es')['MenuItem'] const APagination: typeof import('ant-design-vue/es')['Pagination'] const APopconfirm: typeof import('ant-design-vue/es')['Popconfirm'] @@ -95,6 +98,7 @@ declare global { const ASelect: typeof import('ant-design-vue/es')['Select'] const ASelectOption: typeof import('ant-design-vue/es')['SelectOption'] const ASpace: typeof import('ant-design-vue/es')['Space'] + const ASubMenu: typeof import('ant-design-vue/es')['SubMenu'] const ASwitch: typeof import('ant-design-vue/es')['Switch'] const ATabPane: typeof import('ant-design-vue/es')['TabPane'] const ATabs: typeof import('ant-design-vue/es')['Tabs']