查询行为树所属平台的下属

This commit is contained in:
MHW
2026-04-13 16:16:24 +08:00
parent 50c1cc5bf2
commit 0e6b6d9f45
10 changed files with 318 additions and 0 deletions

View File

@@ -62,4 +62,11 @@ public interface IBehaviortreeService
* @return 结果
*/
public int deleteBehaviortreeById(Long id);
/**
* 根据行为树id获取该行为树的下属
* @param treeId
* @return
*/
List<String> getUnderling(Integer treeId);
}

View File

@@ -2,8 +2,12 @@ package com.solution.system.service.impl;
import java.util.List;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.solution.common.constant.ExceptionConstants;
import com.solution.system.domain.Platform;
import com.solution.system.mapper.PlatformCommunicationMapper;
import com.solution.system.mapper.PlatformMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.solution.system.mapper.BehaviortreeMapper;
@@ -22,6 +26,12 @@ public class BehaviortreeServiceImpl implements IBehaviortreeService
@Autowired
private BehaviortreeMapper behaviortreeMapper;
@Autowired
private PlatformCommunicationMapper platformCommunicationMapper;
@Autowired
private PlatformMapper platformMapper;
@Override
public Behaviortree findOneByPlatformId(Integer platformId)
{
@@ -99,4 +109,30 @@ public class BehaviortreeServiceImpl implements IBehaviortreeService
{
return behaviortreeMapper.deleteBehaviortreeById(id);
}
/**
* 根据行为树id获取该行为树的下属
* @param treeId
* @return
*/
@Override
public List<String> getUnderling(Integer treeId) {
if(null == treeId){
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获取行为树所属平台
Platform platform = platformMapper.getPlatformByTreeId(behaviortree.getId());
//根据平台name获取平台下属英文名
List<String> underlingEnglishName = platformCommunicationMapper.getUnderlingBytreeId(platform.getName());
//根据下属平台英文名获取中文名返回
List<String> underlingChineseName = platformMapper.selectPlatformChineseName(underlingEnglishName);
if(CollUtil.isEmpty(underlingChineseName)){
throw new RuntimeException("该平台暂无下属");
}
return underlingChineseName;
}
}