根据场景id显示所有行为树
This commit is contained in:
@@ -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));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -36,6 +36,11 @@
|
||||
<artifactId>springfox-boot-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.solution</groupId>
|
||||
<artifactId>solution-behaviour</artifactId>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
@@ -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<AfsimScenario> selectSceneList();
|
||||
|
||||
AfsimScenario findOneById(Long id);
|
||||
|
||||
/**
|
||||
* 根据场景id获取场景下所有行为树
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Behaviortree> selectAllTreeBySceneId(Integer id);
|
||||
}
|
||||
|
||||
@@ -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<AfsimScenario> selectSceneList();
|
||||
|
||||
AfsimScenario findOneById(Long id);
|
||||
|
||||
/**
|
||||
* 根据场景id获取场景下所有行为树
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
List<Behaviortree> getAllTree(Integer id);
|
||||
}
|
||||
|
||||
@@ -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<Behaviortree> getAllTree(Integer id) {
|
||||
if(null == id || id <= 0){
|
||||
throw new RuntimeException(ExceptionConstants.PARAMETER_EXCEPTION);
|
||||
}
|
||||
List<Behaviortree> allTree = sceneMapper.selectAllTreeBySceneId(id);
|
||||
if(CollUtil.isEmpty(allTree)){
|
||||
throw new RuntimeException("该场景下不存在行为树");
|
||||
}
|
||||
return allTree;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<select id="selectSceneList" resultMap="SceneMap">
|
||||
SELECT id, name, description, scenario_path, communication_graph FROM afsim_scenario
|
||||
</select>
|
||||
<select id="selectAllTreeBySceneId" resultType="com.solution.system.domain.Behaviortree"
|
||||
parameterType="java.lang.Integer">
|
||||
SELECT id, name, description, created_at, updated_at, english_name, graph,xml_content,platform_id,scenario_id
|
||||
FROM behaviortree
|
||||
WHERE scenario_id=#{id}
|
||||
</select>
|
||||
|
||||
<insert id="update" parameterType="com.solution.scene.domain.AfsimScenario">
|
||||
update afsim_scenario
|
||||
|
||||
Reference in New Issue
Block a user