根据场景id获取总指挥的行为树的原数据

This commit is contained in:
MHW
2026-04-15 09:38:15 +08:00
parent 3ae6a693e1
commit f9eb10c783
6 changed files with 93 additions and 0 deletions

View File

@@ -6,6 +6,7 @@ import javax.servlet.http.HttpServletResponse;
import com.solution.web.core.BehaviortreeProcessor;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.checkerframework.checker.units.qual.A;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@@ -147,5 +148,14 @@ public class BehaviortreeController extends BaseController
return success(behaviortreeService.getUnderling(treeId));
}
/**
* 根据场景id获取总指挥的行为树的原数据
* @return
*/
@ApiOperation("根据场景id获取总指挥的行为树的原数据")
@GetMapping("/commander/{scenarioId}")
public AjaxResult getCommander(@PathVariable Integer scenarioId){
return success(behaviortreeService.getCommander(scenarioId));
}
}

View File

@@ -0,0 +1,46 @@
package com.solution.system.domain;
import lombok.Data;
import java.time.LocalDateTime;
/**
* 收集数据用来生成总指挥官
*/
@Data
public class PlatformChiefCommander {
/**
* Primary Key 主键ID自增
*/
private Integer id;
/**
* Create Time 创建时间
*/
private LocalDateTime createTime;
/**
* 名称
*/
private String name;
/**
* 时间
*/
private Integer time;
/**
* 指令
*/
private String command;
/**
* 下属指挥官
*/
private String subordinateCommander;
/**
* 场景ID
*/
private Integer scenarioId;
}

View File

@@ -3,6 +3,7 @@ package com.solution.system.mapper;
import java.util.List;
import com.solution.system.domain.Behaviortree;
import com.solution.system.domain.PlatformChiefCommander;
/**
* 行为树主Mapper接口
@@ -62,4 +63,11 @@ public interface BehaviortreeMapper
* @return 结果
*/
public int deleteBehaviortreeByIds(Long[] ids);
/**
* 根据场景id获取总指挥的行为树的原数据
* @param scenarioId
* @return
*/
List<PlatformChiefCommander> getCommander(Integer scenarioId);
}

View File

@@ -3,6 +3,7 @@ package com.solution.system.service;
import java.util.List;
import com.solution.system.domain.Behaviortree;
import com.solution.system.domain.PlatformChiefCommander;
/**
* 行为树主Service接口
@@ -69,4 +70,11 @@ public interface IBehaviortreeService
* @return
*/
List<String> getUnderling(Integer treeId);
/**
* 根据场景id获取总指挥的行为树的原数据
* @param scenarioId
* @return
*/
List<PlatformChiefCommander> getCommander(Integer scenarioId);
}

View File

@@ -5,6 +5,7 @@ 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.PlatformChiefCommander;
import com.solution.system.domain.PlatformTree;
import com.solution.system.mapper.PlatformCommunicationMapper;
import com.solution.system.mapper.PlatformMapper;
@@ -135,4 +136,14 @@ public class BehaviortreeServiceImpl implements IBehaviortreeService
}
return underlingChineseName;
}
/**
* 根据场景id获取总指挥的行为树的原数据
* @param scenarioId
* @return
*/
@Override
public List<PlatformChiefCommander> getCommander(Integer scenarioId) {
return behaviortreeMapper.getCommander(scenarioId);
}
}

View File

@@ -42,6 +42,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, name, description, created_at, updated_at, english_name,graph, xml_content ,platform_id, scenario_id from behaviortree
where id = #{id}
</select>
<select id="getCommander" resultType="com.solution.system.domain.PlatformChiefCommander"
parameterType="java.lang.Integer">
SELECT id,
create_time AS createTime,
name,time,command,
subordinate_commander AS subordinateCommander,
scenario_id AS scenarioId
FROM platform_chief_commander
WHERE scenario_id = #{scenarioId}
</select>
<insert id="insertBehaviortree" parameterType="Behaviortree" useGeneratedKeys="true" keyProperty="id">
insert into behaviortree