From 254401d8f124732b50de6dfe74a6c5b90637e832 Mon Sep 17 00:00:00 2001 From: yitaikarma Date: Mon, 13 Apr 2026 17:26:50 +0800 Subject: [PATCH 1/5] =?UTF-8?q?=E6=94=AF=E6=8C=81=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E6=A0=91=E5=8A=A0=E8=BD=BD=E4=B8=8B=E5=B1=9E?= =?UTF-8?q?=E5=B9=B3=E5=8F=B0=E5=B9=B6=E4=BC=98=E5=8C=96=E5=B1=9E=E6=80=A7?= =?UTF-8?q?=E9=9D=A2=E6=9D=BF=E6=98=BE=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/decision/designer/designer.vue | 31 ++++++++++++- .../views/decision/designer/properties.vue | 44 ++++++++++++++++++- 2 files changed, 72 insertions(+), 3 deletions(-) diff --git a/modeler/src/views/decision/designer/designer.vue b/modeler/src/views/decision/designer/designer.vue index 57e4e9e..8766aa0 100644 --- a/modeler/src/views/decision/designer/designer.vue +++ b/modeler/src/views/decision/designer/designer.vue @@ -43,6 +43,7 @@ (false); const treesCardRef = ref | null>(null); const platforms = ref([]); + const subPlatforms = ref([]); const nodeCommands = ref([]) const currentScenarioId = ref(null); const currentPlatformId = ref(null); @@ -153,6 +155,27 @@ export default defineComponent({ loadNodeCommands(); } + // 加载下属平台 + const loadSubPlatforms = (treeId: number) => { + console.log(treeId); + + if (!treeId || treeId <= 0) { + subPlatforms.value = []; + return; + } + + findSubPlatforms(treeId).then(r => { + if (r.data && Array.isArray(r.data)) { + subPlatforms.value = r.data as Platform[]; + } else { + subPlatforms.value = []; + } + }).catch(err => { + console.error('加载下属平台失败:', err); + subPlatforms.value = []; + }); + }; + // 处理拖动开始 const handleDragStart = (nm: NodeDragTemplate) => { draggedNodeData.value = nm; @@ -267,6 +290,10 @@ export default defineComponent({ graph: nodeGraph, }; currentTreeEditing.value = true; + + // 加载下属平台 + loadSubPlatforms(r.data.id); + nextTick(() => { initGraph(); }); @@ -343,6 +370,7 @@ export default defineComponent({ }; selectedModelNode.value = null; selectedNodeTaskElement.value = null; + subPlatforms.value = []; // 重置下属平台 nextTick(() => { initGraph(); @@ -487,6 +515,7 @@ export default defineComponent({ nodeCommands, currentScenarioId, platforms, + subPlatforms, treesCardRef, handleCreateTree, currentTreeEditing, diff --git a/modeler/src/views/decision/designer/properties.vue b/modeler/src/views/decision/designer/properties.vue index ed0e85a..bde1f84 100644 --- a/modeler/src/views/decision/designer/properties.vue +++ b/modeler/src/views/decision/designer/properties.vue @@ -101,7 +101,7 @@ size="small" type="editable-card" @edit="onEditParameterTab"> - + - {{pl.description}} + {{pl.description}} | null | undefined>, required: false }, graph: { type: [Object, null] as PropType, required: true }, platforms: { type: Array as PropType, required: true }, + subPlatforms: { type: Array as PropType, required: false, default: () => [] }, nodeCommands: { type: Array as PropType, required: true }, }, emits: ['update-element', 'update-tree'], setup(props, { emit }) { const platforms = ref(props.platforms ?? []); + const subPlatforms = ref(props.subPlatforms ?? []); const nodeCommands = ref(props.nodeCommands ?? []); const activeTopTabsKey = ref('1'); @@ -299,6 +301,41 @@ export default defineComponent({ multiableParameters.value = multiable === true && groupedParameters.value.length > 0; }; + // 获取平台Tab显示名称 + const getPlatformTabName = (index: number): string => { + if (!currentTree.value?.platformId) { + return `平台 ${index + 1}`; + } + + // 查找当前行为树绑定的平台 + const currentPlatform = platforms.value.find(p => p.id === currentTree.value?.platformId); + if (!currentPlatform) { + return `平台 ${index + 1}`; + } + + // 如果有多个分组,显示平台名称和索引 + if (groupedParameters.value.length > 1) { + return `${currentPlatform.name || '未知平台'}-${index + 1}`; + } + + return currentPlatform.name || '平台'; + }; + + // 获取可用的平台列表(包括当前平台和其下属平台) + const getAvailablePlatforms = (): Platform[] => { + if (!currentTree.value?.platformId) { + return platforms.value; + } + + // 如果有下属平台,返回下属平台列表 + if (subPlatforms.value && subPlatforms.value.length > 0) { + return subPlatforms.value; + } + + // 否则返回所有平台 + return platforms.value; + }; + const resolveNode = (n?: Node | null | undefined) => { groupedParametersActiveTab.value = 0; @@ -389,6 +426,7 @@ export default defineComponent({ watch(() => props.nodeCommands, (n: NodeCommand[] | null | undefined) => nodeCommands.value = n ?? [], { deep: true, immediate: true }); watch(() => props.platforms, (n: Platform[] | null | undefined) => platforms.value = n ?? [], { deep: true, immediate: true }); + watch(() => props.subPlatforms, (n: Platform[] | null | undefined) => subPlatforms.value = n ?? [], { deep: true, immediate: true }); onMounted(() => load()); @@ -400,6 +438,8 @@ export default defineComponent({ multiableParameters, onEditParameterTab, groupedParameters, + getPlatformTabName, + getAvailablePlatforms, actionSpaceColumns, activeTopTabsKey, activeBottomTabsKey, From eff0b87da812bfd68206f69fd018781b3b99be91 Mon Sep 17 00:00:00 2001 From: MHW Date: Mon, 13 Apr 2026 17:26:56 +0800 Subject: [PATCH 2/5] =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/solution/system/mapper/PlatformMapper.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 08feb0d..520e8ea 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 @@ -2,6 +2,7 @@ package com.solution.system.mapper; import com.solution.system.domain.PlatformTree; import org.apache.ibatis.annotations.Mapper; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -20,5 +21,5 @@ public interface PlatformMapper { * @param underlingEnglishName * @return */ - List selectPlatformChineseName(List underlingEnglishName); + List selectPlatformChineseName(@Param("underlingEnglishName") List underlingEnglishName); } From bb45ff557bea7da6098381f594c0ab25452d554c Mon Sep 17 00:00:00 2001 From: yitaikarma Date: Mon, 13 Apr 2026 17:33:28 +0800 Subject: [PATCH 3/5] =?UTF-8?q?=E6=96=B0=E5=A2=9E=E6=A0=B9=E6=8D=AE?= =?UTF-8?q?=E8=A1=8C=E4=B8=BA=E6=A0=91ID=E8=8E=B7=E5=8F=96=E4=B8=8B?= =?UTF-8?q?=E5=B1=9E=E5=B9=B3=E5=8F=B0=E7=9A=84=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- modeler/src/views/decision/designer/api.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/modeler/src/views/decision/designer/api.ts b/modeler/src/views/decision/designer/api.ts index e05404e..16fdd21 100644 --- a/modeler/src/views/decision/designer/api.ts +++ b/modeler/src/views/decision/designer/api.ts @@ -28,6 +28,10 @@ export const findOneTreeByPlatformId = (platformId: number): Promise => { + return req.get(`/system/behaviortree/underling/${treeId}`); +}; + export const findOneTreeById = (id: number): Promise => { return req.get(`/system/behaviortree/${id}`); }; From 5c83b561cc859dfbb18dd8bf1be7eedd53150c05 Mon Sep 17 00:00:00 2001 From: MHW Date: Mon, 13 Apr 2026 17:58:01 +0800 Subject: [PATCH 4/5] =?UTF-8?q?=E9=80=BB=E8=BE=91=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mapper/system/BehaviortreeMapper.xml | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/auto-solution-behaviour/src/main/resources/mapper/system/BehaviortreeMapper.xml b/auto-solution-behaviour/src/main/resources/mapper/system/BehaviortreeMapper.xml index ecd2411..f43522a 100644 --- a/auto-solution-behaviour/src/main/resources/mapper/system/BehaviortreeMapper.xml +++ b/auto-solution-behaviour/src/main/resources/mapper/system/BehaviortreeMapper.xml @@ -5,13 +5,15 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" - - - - - - - + + + + + + + + + From e82455a220ba4d4464229d1ee080fffd590543ee Mon Sep 17 00:00:00 2001 From: MHW Date: Tue, 14 Apr 2026 15:10:24 +0800 Subject: [PATCH 5/5] =?UTF-8?q?=E8=8E=B7=E5=8F=96=E5=9C=BA=E6=99=AF?= =?UTF-8?q?=E5=85=B3=E7=B3=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/scene/SceneController.java | 11 + .../resources/mapper/rule/FireRuleMapper.xml | 2 +- .../resources/sql/rule/001_rule_schema.sql | 67 ++++++ .../sql/rule/002_rule_seed_from_drl.sql | 213 ++++++++++++++++++ .../scene}/domain/PlatformCommunication.java | 2 +- .../solution/scene/mapper/SceneMapper.java | 8 + .../solution/scene/service/SceneService.java | 8 + .../scene/service/impl/SceneServiceImpl.java | 15 ++ .../resources/mapper/scene/SceneMapper.xml | 6 + 9 files changed, 330 insertions(+), 2 deletions(-) create mode 100644 auto-solution-rule/src/main/resources/sql/rule/001_rule_schema.sql create mode 100644 auto-solution-rule/src/main/resources/sql/rule/002_rule_seed_from_drl.sql rename {auto-solution-behaviour/src/main/java/com/solution/system => auto-solution-scene/src/main/java/com/solution/scene}/domain/PlatformCommunication.java (93%) 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 311cbed..7116aa6 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 @@ -64,4 +64,15 @@ public class SceneController extends BaseController { public AjaxResult getAllTree(@PathVariable Integer id){ return success(sceneService.getAllTree(id)); } + + /** + * 根据场景id获取场景下所有关系 + * @param id + * @return + */ + @GetMapping("/getAllRelation/{id}") + @ApiOperation("根据场景id获取场景下所有关系") + public AjaxResult getAllRelation(@PathVariable Integer id){ + return success(sceneService.getAllRelation(id)); + } } diff --git a/auto-solution-rule/src/main/resources/mapper/rule/FireRuleMapper.xml b/auto-solution-rule/src/main/resources/mapper/rule/FireRuleMapper.xml index 8b45634..865658d 100644 --- a/auto-solution-rule/src/main/resources/mapper/rule/FireRuleMapper.xml +++ b/auto-solution-rule/src/main/resources/mapper/rule/FireRuleMapper.xml @@ -112,7 +112,7 @@ FROM platform p LEFT JOIN platform_component pc ON p.id = pc.platform_id WHERE pc.type = 'comm' - AND p.scenario_id = #{scenarioId} + AND p.scenario_id = #{scenarioId} ORDER BY p.name,pc.name diff --git a/auto-solution-rule/src/main/resources/sql/rule/001_rule_schema.sql b/auto-solution-rule/src/main/resources/sql/rule/001_rule_schema.sql new file mode 100644 index 0000000..365f598 --- /dev/null +++ b/auto-solution-rule/src/main/resources/sql/rule/001_rule_schema.sql @@ -0,0 +1,67 @@ +-- 规则主数据表结构(MySQL 8+) +-- 说明:用于前端按“层级->种类->规则项”进行展示与增删改查。 + +CREATE TABLE IF NOT EXISTS `rule_dict` ( + `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `dict_type` VARCHAR(32) NOT NULL COMMENT '字典类型(level/kind/task_type/status)', + `dict_code` VARCHAR(64) NOT NULL COMMENT '字典编码', + `dict_name` VARCHAR(64) NOT NULL COMMENT '字典名称', + `sort_no` INT NOT NULL DEFAULT 0 COMMENT '排序号', + `enabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用(1是0否)', + `remark` VARCHAR(255) DEFAULT NULL COMMENT '备注', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_rule_dict_type_code` (`dict_type`, `dict_code`), + KEY `idx_rule_dict_type_enabled` (`dict_type`, `enabled`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='规则字典表'; + +CREATE TABLE IF NOT EXISTS `rule_item` ( + `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `rule_code` VARCHAR(64) NOT NULL COMMENT '规则编码', + `rule_name` VARCHAR(128) NOT NULL COMMENT '规则名称', + `level_code` VARCHAR(32) NOT NULL COMMENT '规则层级(task/action/platform)', + `kind_code` VARCHAR(32) NOT NULL COMMENT '规则种类(select/assign/deploy/config/mode/spacetime/relation/limit)', + `module_code` VARCHAR(32) NOT NULL COMMENT '规则模块(equipment/target/position/track/group)', + `priority_no` INT NOT NULL DEFAULT 100 COMMENT '优先级(数字越小越先执行)', + `condition_expr` VARCHAR(1024) DEFAULT NULL COMMENT '条件表达式(展示用)', + `action_expr` VARCHAR(1024) DEFAULT NULL COMMENT '动作表达式(展示用)', + `version_no` INT NOT NULL DEFAULT 1 COMMENT '版本号', + `enabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用(1是0否)', + `remark` VARCHAR(255) DEFAULT NULL COMMENT '备注', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_rule_item_code` (`rule_code`), + KEY `idx_rule_item_level_kind` (`level_code`, `kind_code`), + KEY `idx_rule_item_module_enabled` (`module_code`, `enabled`), + KEY `idx_rule_item_priority` (`priority_no`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='规则主表'; + +CREATE TABLE IF NOT EXISTS `rule_item_task_type` ( + `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `rule_code` VARCHAR(64) NOT NULL COMMENT '规则编码', + `task_type_code` VARCHAR(32) NOT NULL COMMENT '任务类型编码', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_rule_task_type` (`rule_code`, `task_type_code`), + KEY `idx_rule_task_type` (`task_type_code`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='规则适用任务类型关联表'; + +CREATE TABLE IF NOT EXISTS `rule_item_param` ( + `id` BIGINT NOT NULL AUTO_INCREMENT COMMENT '主键ID', + `rule_code` VARCHAR(64) NOT NULL COMMENT '规则编码', + `param_key` VARCHAR(128) NOT NULL COMMENT '参数键', + `param_val` TEXT NOT NULL COMMENT '参数值(统一文本存储)', + `val_type` VARCHAR(16) NOT NULL DEFAULT 'string' COMMENT '值类型(string/number/bool/json)', + `param_name` VARCHAR(128) DEFAULT NULL COMMENT '参数名称', + `sort_no` INT NOT NULL DEFAULT 0 COMMENT '排序号', + `enabled` TINYINT(1) NOT NULL DEFAULT 1 COMMENT '是否启用(1是0否)', + `remark` VARCHAR(255) DEFAULT NULL COMMENT '备注', + `created_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间', + `updated_at` DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间', + PRIMARY KEY (`id`), + UNIQUE KEY `uk_rule_param` (`rule_code`, `param_key`), + KEY `idx_rule_param_key` (`param_key`), + KEY `idx_rule_param_enabled` (`enabled`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci COMMENT='规则参数表'; diff --git a/auto-solution-rule/src/main/resources/sql/rule/002_rule_seed_from_drl.sql b/auto-solution-rule/src/main/resources/sql/rule/002_rule_seed_from_drl.sql new file mode 100644 index 0000000..aa15d46 --- /dev/null +++ b/auto-solution-rule/src/main/resources/sql/rule/002_rule_seed_from_drl.sql @@ -0,0 +1,213 @@ +-- 从 rules/rule.drl 提取的初始化数据 +-- 说明:本文件提供字典、规则主数据、规则参数与任务类型关联的初始记录。 + +-- 1) 字典数据 +INSERT INTO `rule_dict` (`dict_type`, `dict_code`, `dict_name`, `sort_no`, `enabled`, `remark`) VALUES +('level', 'task', '任务级', 10, 1, '任务层面的选择/分配/限制'), +('level', 'action', '行动级', 20, 1, '行动层面的航迹/编组/模式'), +('level', 'platform', '平台级', 30, 1, '平台层面的部署/时空约束'), +('kind', 'select', '选择', 10, 1, '对象选择与评分'), +('kind', 'assign', '分配', 20, 1, '目标分配'), +('kind', 'deploy', '部署', 30, 1, '阵位与部署'), +('kind', 'config', '配置', 40, 1, '通用配置参数'), +('kind', 'mode', '工作模式', 50, 1, '算法与模式选择'), +('kind', 'spacetime', '时空约束', 60, 1, '空间和时间相关约束'), +('kind', 'relation', '关联关系', 70, 1, '蓝红关键词关联'), +('kind', 'limit', '限制条件', 80, 1, '阈值和边界'), +('task_type', 'strike', '打击任务', 10, 1, '典型任务类型'), +('task_type', 'recon', '侦察任务', 20, 1, '典型任务类型'), +('task_type', 'intercept', '拦截任务', 30, 1, '典型任务类型'), +('task_type', 'support', '支援任务', 40, 1, '典型任务类型'), +('task_type', 'jamming', '干扰任务', 50, 1, '典型任务类型'), +('status', 'enabled', '启用', 10, 1, '通用状态'), +('status', 'disabled', '停用', 20, 1, '通用状态') +ON DUPLICATE KEY UPDATE +`dict_name` = VALUES(`dict_name`), +`sort_no` = VALUES(`sort_no`), +`enabled` = VALUES(`enabled`), +`remark` = VALUES(`remark`); + +-- 2) 规则主数据(层级->种类->规则项) +INSERT INTO `rule_item` +(`rule_code`, `rule_name`, `level_code`, `kind_code`, `module_code`, `priority_no`, `condition_expr`, `action_expr`, `version_no`, `enabled`, `remark`) +VALUES +('R_TASK_SELECT_BASE', '任务级-装备选择基础规则', 'task', 'select', 'equipment', 100, 'task!=null', 'equipmentRule(fact, params)', 1, 1, '来自装备匹配主流程'), +('R_TASK_SELECT_SLOT_1', '任务级-规则槽1', 'task', 'relation', 'equipment', 101, 'containsAny(blue,slot1Blue)&&containsAny(red,slot1Red)', 'score += ruleScore_1*weight', 1, 1, '蓝红关键词槽位匹配'), +('R_TASK_SELECT_SLOT_2', '任务级-规则槽2', 'task', 'relation', 'equipment', 102, 'containsAny(blue,slot2Blue)&&containsAny(red,slot2Red)', 'score += ruleScore_2*weight', 1, 1, '蓝红关键词槽位匹配'), +('R_TASK_SELECT_SLOT_3', '任务级-规则槽3', 'task', 'relation', 'equipment', 103, 'containsAny(blue,slot3Blue)&&containsAny(red,slot3Red)', 'score += ruleScore_3*weight', 1, 1, '蓝红关键词槽位匹配'), +('R_TASK_REL_AIR_PLATFORM', '任务级-关联关系-空中平台', 'task', 'relation', 'equipment', 104, 'bluePlatformKeywords_air && redPreferredWhenBlueAir', 'score += airScore*weight', 1, 1, '兼容层空中平台关联'), +('R_TASK_REL_AIR_TASK', '任务级-关联关系-空中任务', 'task', 'relation', 'equipment', 105, 'airTaskKeywords && redPreferredWhenBlueAir', 'score += airTaskScore*weight', 1, 1, '兼容层空中任务关联'), +('R_TASK_REL_GROUND_TASK', '任务级-关联关系-地面任务', 'task', 'relation', 'equipment', 106, 'groundTaskKeywords && redPreferredWhenGround', 'score += groundScore*weight', 1, 1, '兼容层地面任务关联'), +('R_TASK_REL_TANK', '任务级-关联关系-坦克装甲', 'task', 'relation', 'equipment', 107, 'tankKeywords && redMatchKeywords_tank', 'score += tankScore*weight', 1, 1, '兼容层坦克关联'), +('R_TASK_REL_MISSILE', '任务级-关联关系-导弹火箭', 'task', 'relation', 'equipment', 108, 'missileKeywords && redMatchKeywords_missile', 'score += missileScore*weight', 1, 1, '兼容层导弹关联'), +('R_TASK_ASSIGN_TARGET', '任务级-目标分配规则', 'task', 'assign', 'target', 90, 'task!=null', 'target(fact, params)', 1, 1, '目标分配与execute填充'), +('R_TASK_LIMIT_SUPPLEMENT', '任务级-低命中率补拿限制', 'task', 'limit', 'target', 89, 'hitRate selectAllTreeBySceneId(Integer id); + + /** + * 根据场景id获取场景下所有关系 + * @param id + * @return + */ + List selectAllRelationBySceneId(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 6f875d9..56644a8 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.scene.domain.PlatformCommunication; import com.solution.system.domain.Behaviortree; import java.util.List; @@ -33,4 +34,11 @@ public interface SceneService { * @return */ List getAllTree(Integer id); + + /** + * 根据场景id获取场景下所有关系 + * @param id + * @return + */ + List getAllRelation(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 d50ed19..91c8125 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 @@ -4,6 +4,7 @@ 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.domain.PlatformCommunication; import com.solution.scene.mapper.PlatFormCommunicationMapper; import com.solution.scene.mapper.SceneMapper; import com.solution.scene.service.SceneService; @@ -90,4 +91,18 @@ public class SceneServiceImpl implements SceneService { return allTree; } + /** + * 根据场景id获取场景下所有关系 + * @param id + * @return + */ + @Override + public List getAllRelation(Integer id) { + List result = sceneMapper.selectAllRelationBySceneId(id); + if(CollUtil.isEmpty( result)){ + throw new RuntimeException("该场景下不存在关系"); + } + return result; + } + } 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 7c9481b..f782c1b 100644 --- a/auto-solution-scene/src/main/resources/mapper/scene/SceneMapper.xml +++ b/auto-solution-scene/src/main/resources/mapper/scene/SceneMapper.xml @@ -31,6 +31,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" FROM behaviortree WHERE scenario_id=#{id} + update afsim_scenario