feat(behaviour): 添加行为树模块功能实现
- 添加节点参数的保存、更新和删除操作支持
This commit is contained in:
@@ -2,6 +2,9 @@ package com.solution.web.controller.behaviour;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -27,6 +30,7 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("行为树管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/behaviortree")
|
||||
public class BehaviortreeController extends BaseController
|
||||
@@ -37,6 +41,7 @@ public class BehaviortreeController extends BaseController
|
||||
/**
|
||||
* 查询行为树主列表
|
||||
*/
|
||||
@ApiOperation("获取行为树列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Behaviortree behaviortree)
|
||||
@@ -62,6 +67,7 @@ public class BehaviortreeController extends BaseController
|
||||
/**
|
||||
* 获取行为树主详细信息
|
||||
*/
|
||||
@ApiOperation("获取行为树详情")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
@@ -72,6 +78,7 @@ public class BehaviortreeController extends BaseController
|
||||
/**
|
||||
* 新增行为树主
|
||||
*/
|
||||
@ApiOperation("新增行为树主")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:add')")
|
||||
@Log(title = "行为树主", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@@ -83,6 +90,7 @@ public class BehaviortreeController extends BaseController
|
||||
/**
|
||||
* 修改行为树主
|
||||
*/
|
||||
@ApiOperation("修改行为树主")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:edit')")
|
||||
@Log(title = "行为树主", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@@ -94,6 +102,7 @@ public class BehaviortreeController extends BaseController
|
||||
/**
|
||||
* 删除行为树主
|
||||
*/
|
||||
@ApiOperation("删除行为树主")
|
||||
@PreAuthorize("@ss.hasPermi('system:behaviortree:remove')")
|
||||
@Log(title = "行为树主", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
|
||||
@@ -5,6 +5,8 @@ import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.solution.system.domain.Nodeconnection;
|
||||
import com.solution.system.service.INodeconnectionService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -28,6 +30,7 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("节点连接管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/nodeconnection")
|
||||
public class NodeconnectionController extends BaseController
|
||||
@@ -63,6 +66,7 @@ public class NodeconnectionController extends BaseController
|
||||
/**
|
||||
* 获取节点连接详细信息
|
||||
*/
|
||||
@ApiOperation("获取节点连接详细信息")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeconnection:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
@@ -73,6 +77,7 @@ public class NodeconnectionController extends BaseController
|
||||
/**
|
||||
* 新增节点连接
|
||||
*/
|
||||
@ApiOperation("新增节点连接")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeconnection:add')")
|
||||
@Log(title = "节点连接", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@@ -95,6 +100,7 @@ public class NodeconnectionController extends BaseController
|
||||
/**
|
||||
* 删除节点连接
|
||||
*/
|
||||
@ApiOperation("删除节点连接")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeconnection:remove')")
|
||||
@Log(title = "节点连接", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.solution.web.controller.behaviour;
|
||||
|
||||
import java.util.List;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
@@ -27,6 +30,7 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("节点参数管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/nodeparameter")
|
||||
public class NodeparameterController extends BaseController
|
||||
@@ -72,6 +76,7 @@ public class NodeparameterController extends BaseController
|
||||
/**
|
||||
* 新增节点参数
|
||||
*/
|
||||
@ApiOperation("新增节点参数")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeparameter:add')")
|
||||
@Log(title = "节点参数", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
@@ -83,6 +88,7 @@ public class NodeparameterController extends BaseController
|
||||
/**
|
||||
* 修改节点参数
|
||||
*/
|
||||
@ApiOperation("修改节点参数")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeparameter:edit')")
|
||||
@Log(title = "节点参数", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
@@ -94,6 +100,7 @@ public class NodeparameterController extends BaseController
|
||||
/**
|
||||
* 删除节点参数
|
||||
*/
|
||||
@ApiOperation("删除节点参数")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodeparameter:remove')")
|
||||
@Log(title = "节点参数", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
|
||||
@@ -1,9 +1,19 @@
|
||||
package com.solution.web.controller.behaviour;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.solution.common.core.domain.R;
|
||||
import com.solution.web.controller.behaviour.vo.NodetemplateDTO;
|
||||
import com.solution.web.controller.behaviour.vo.NodetemplateVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@@ -23,14 +33,14 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 节点模板Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("节点模板管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/nodetemplate")
|
||||
public class NodetemplateController extends BaseController
|
||||
{
|
||||
public class NodetemplateController extends BaseController {
|
||||
@Autowired
|
||||
private INodetemplateService nodetemplateService;
|
||||
|
||||
@@ -39,21 +49,50 @@ public class NodetemplateController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Nodetemplate nodetemplate)
|
||||
{
|
||||
public TableDataInfo list(Nodetemplate nodetemplate) {
|
||||
startPage();
|
||||
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ApiOperation("节点模板列表")
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:list')")
|
||||
@GetMapping("/listAll")
|
||||
public R<List<NodetemplateVO>> listAll() {
|
||||
Nodetemplate nodetemplate = new Nodetemplate();
|
||||
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
|
||||
if (CollectionUtils.isEmpty(list)) {
|
||||
return R.ok(null);
|
||||
}
|
||||
Map<String, List<NodetemplateDTO>> groupedByTemplateType = list.stream()
|
||||
.map(template -> {
|
||||
NodetemplateDTO dto = new NodetemplateDTO();
|
||||
dto.setId(template.getId());
|
||||
dto.setName(template.getName());
|
||||
dto.setDescription(template.getDescription());
|
||||
dto.setEnglishName(template.getEnglishName());
|
||||
dto.setLogicHandler(template.getLogicHandler());
|
||||
return dto;
|
||||
})
|
||||
.collect(Collectors.groupingBy(NodetemplateDTO::getTempleteType));
|
||||
List<NodetemplateVO> vos = new ArrayList<>();
|
||||
groupedByTemplateType.forEach((key, value) -> {
|
||||
// 处理逻辑
|
||||
NodetemplateVO vo = new NodetemplateVO();
|
||||
vo.setTempleteType(key);
|
||||
vo.setDtoList(value);
|
||||
vos.add(vo);
|
||||
});
|
||||
return R.ok(vos);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出节点模板列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:export')")
|
||||
@Log(title = "节点模板", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Nodetemplate nodetemplate)
|
||||
{
|
||||
public void export(HttpServletResponse response, Nodetemplate nodetemplate) {
|
||||
List<Nodetemplate> list = nodetemplateService.selectNodetemplateList(nodetemplate);
|
||||
ExcelUtil<Nodetemplate> util = new ExcelUtil<Nodetemplate>(Nodetemplate.class);
|
||||
util.exportExcel(response, list, "节点模板数据");
|
||||
@@ -64,8 +103,7 @@ public class NodetemplateController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(nodetemplateService.selectNodetemplateById(id));
|
||||
}
|
||||
|
||||
@@ -75,8 +113,7 @@ public class NodetemplateController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:add')")
|
||||
@Log(title = "节点模板", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Nodetemplate nodetemplate)
|
||||
{
|
||||
public AjaxResult add(@RequestBody Nodetemplate nodetemplate) {
|
||||
return toAjax(nodetemplateService.insertNodetemplate(nodetemplate));
|
||||
}
|
||||
|
||||
@@ -86,8 +123,7 @@ public class NodetemplateController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:edit')")
|
||||
@Log(title = "节点模板", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Nodetemplate nodetemplate)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody Nodetemplate nodetemplate) {
|
||||
return toAjax(nodetemplateService.updateNodetemplate(nodetemplate));
|
||||
}
|
||||
|
||||
@@ -96,9 +132,8 @@ public class NodetemplateController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:nodetemplate:remove')")
|
||||
@Log(title = "节点模板", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids) {
|
||||
return toAjax(nodetemplateService.deleteNodetemplateByIds(ids));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,28 @@
|
||||
package com.solution.web.controller.behaviour;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import com.solution.common.core.domain.R;
|
||||
import com.solution.system.domain.Nodeparameter;
|
||||
import com.solution.system.domain.Templateparameterdef;
|
||||
import com.solution.system.service.INodeparameterService;
|
||||
import com.solution.system.service.ITemplateparameterdefService;
|
||||
import com.solution.web.controller.behaviour.vo.NodeparameterVO;
|
||||
import com.solution.web.controller.behaviour.vo.NodetemplateVO;
|
||||
import com.solution.web.controller.behaviour.vo.TreenodeinstanceVO;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
@@ -23,24 +42,28 @@ import com.solution.common.core.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 行为树实例节点Controller
|
||||
*
|
||||
*
|
||||
* @author ruoyi
|
||||
* @date 2026-02-05
|
||||
*/
|
||||
@Api("行为树实例节点管理")
|
||||
@RestController
|
||||
@RequestMapping("/system/treenodeinstance")
|
||||
public class TreenodeinstanceController extends BaseController
|
||||
{
|
||||
public class TreenodeinstanceController extends BaseController {
|
||||
@Autowired
|
||||
private ITreenodeinstanceService treenodeinstanceService;
|
||||
@Autowired
|
||||
private INodeparameterService nodeparameterService;
|
||||
|
||||
@Autowired
|
||||
private ITemplateparameterdefService templateparameterdefService;
|
||||
|
||||
/**
|
||||
* 查询行为树实例节点列表
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:list')")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Treenodeinstance treenodeinstance)
|
||||
{
|
||||
public TableDataInfo list(Treenodeinstance treenodeinstance) {
|
||||
startPage();
|
||||
List<Treenodeinstance> list = treenodeinstanceService.selectTreenodeinstanceList(treenodeinstance);
|
||||
return getDataTable(list);
|
||||
@@ -52,8 +75,7 @@ public class TreenodeinstanceController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:export')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
public void export(HttpServletResponse response, Treenodeinstance treenodeinstance)
|
||||
{
|
||||
public void export(HttpServletResponse response, Treenodeinstance treenodeinstance) {
|
||||
List<Treenodeinstance> list = treenodeinstanceService.selectTreenodeinstanceList(treenodeinstance);
|
||||
ExcelUtil<Treenodeinstance> util = new ExcelUtil<Treenodeinstance>(Treenodeinstance.class);
|
||||
util.exportExcel(response, list, "行为树实例节点数据");
|
||||
@@ -64,19 +86,89 @@ public class TreenodeinstanceController extends BaseController
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:query')")
|
||||
@GetMapping(value = "/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
||||
return success(treenodeinstanceService.selectTreenodeinstanceById(id));
|
||||
}
|
||||
|
||||
@ApiOperation("行为树实例节点详情展示")
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:query')")
|
||||
@GetMapping(value = "/getInfo")
|
||||
public R<TreenodeinstanceVO> getInfoParams(@PathVariable("id") Long id) {
|
||||
TreenodeinstanceVO treenodeinstanceVO = new TreenodeinstanceVO();
|
||||
Treenodeinstance treenodeinstance = treenodeinstanceService.selectTreenodeinstanceById(id);
|
||||
BeanUtils.copyProperties(treenodeinstance, treenodeinstanceVO);
|
||||
|
||||
|
||||
Templateparameterdef templateparameterdef = new Templateparameterdef();
|
||||
templateparameterdef.setTemplateId(treenodeinstance.getTemplateId());
|
||||
List<Templateparameterdef> templateparameterdefs = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
|
||||
if (CollectionUtils.isEmpty(templateparameterdefs)) {
|
||||
return R.ok(treenodeinstanceVO);
|
||||
}
|
||||
List<NodeparameterVO> nodeparameterVOList = new ArrayList<>();
|
||||
treenodeinstanceVO.setNodeparameterVOList(nodeparameterVOList);
|
||||
Nodeparameter nodeparameter = new Nodeparameter();
|
||||
nodeparameter.setNodeInstanceId(id);
|
||||
List<Nodeparameter> nodeparameters = nodeparameterService.selectNodeparameterList(nodeparameter);
|
||||
Map<Long, Nodeparameter> nodeParameterMap = new HashMap<>();
|
||||
if (!CollectionUtils.isEmpty(nodeparameters)) {
|
||||
nodeParameterMap.putAll(nodeparameters.stream()
|
||||
.collect(Collectors.toMap(
|
||||
Nodeparameter::getParamDefId,
|
||||
Function.identity(), (existing, replacement) -> existing
|
||||
)));
|
||||
|
||||
}
|
||||
templateparameterdefs.forEach(t -> {
|
||||
NodeparameterVO vo = new NodeparameterVO();
|
||||
vo.setDescription(t.getDescription());
|
||||
vo.setParamKey(t.getParamKey());
|
||||
vo.setDataType(t.getDataType());
|
||||
vo.setDefaultValue(t.getDefaultValue());
|
||||
vo.setParamDefId(t.getId());
|
||||
vo.setNodeInstanceId(id);
|
||||
if (nodeParameterMap.containsKey(t.getId())) {
|
||||
Nodeparameter nodeparameter1 = nodeParameterMap.get(t.getId());
|
||||
vo.setId(nodeparameter1.getId());
|
||||
vo.setValue(nodeparameter1.getValue());
|
||||
}
|
||||
nodeparameterVOList.add(vo);
|
||||
});
|
||||
return R.ok(treenodeinstanceVO);
|
||||
}
|
||||
|
||||
@ApiOperation("行为树实例节点保存或者跟新")
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:add')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/saveOrUpdate")
|
||||
public R<Integer> saveOrUpdate(@RequestBody Treenodeinstance treenodeinstance) {
|
||||
if (null == treenodeinstance.getId()) {
|
||||
//新增
|
||||
Templateparameterdef templateparameterdef = new Templateparameterdef();
|
||||
templateparameterdef.setTemplateId(treenodeinstance.getTemplateId());
|
||||
List<Templateparameterdef> templateparameterdefs = templateparameterdefService.selectTemplateparameterdefList(templateparameterdef);
|
||||
if (CollectionUtils.isEmpty(templateparameterdefs)) {
|
||||
return R.ok(treenodeinstanceService.insertTreenodeinstance(treenodeinstance));
|
||||
}
|
||||
templateparameterdefs.forEach(t -> {
|
||||
Nodeparameter nodeparameter = new Nodeparameter();
|
||||
nodeparameter.setNodeInstanceId(treenodeinstance.getId());
|
||||
nodeparameter.setParamDefId(t.getId());
|
||||
nodeparameter.setValue(t.getDefaultValue());
|
||||
nodeparameterService.insertNodeparameter(nodeparameter);
|
||||
});
|
||||
}
|
||||
return R.ok(treenodeinstanceService.updateTreenodeinstance(treenodeinstance));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增行为树实例节点
|
||||
*/
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:add')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.INSERT)
|
||||
@PostMapping
|
||||
public AjaxResult add(@RequestBody Treenodeinstance treenodeinstance)
|
||||
{
|
||||
public AjaxResult add(@RequestBody Treenodeinstance treenodeinstance) {
|
||||
|
||||
return toAjax(treenodeinstanceService.insertTreenodeinstance(treenodeinstance));
|
||||
}
|
||||
|
||||
@@ -86,19 +178,28 @@ public class TreenodeinstanceController extends BaseController
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:edit')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.UPDATE)
|
||||
@PutMapping
|
||||
public AjaxResult edit(@RequestBody Treenodeinstance treenodeinstance)
|
||||
{
|
||||
public AjaxResult edit(@RequestBody Treenodeinstance treenodeinstance) {
|
||||
return toAjax(treenodeinstanceService.updateTreenodeinstance(treenodeinstance));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除行为树实例节点
|
||||
*/
|
||||
@ApiOperation("删除行为树实例节点")
|
||||
@PreAuthorize("@ss.hasPermi('system:treenodeinstance:remove')")
|
||||
@Log(title = "行为树实例节点", businessType = BusinessType.DELETE)
|
||||
@DeleteMapping("/{ids}")
|
||||
public AjaxResult remove(@PathVariable Long[] ids)
|
||||
{
|
||||
return toAjax(treenodeinstanceService.deleteTreenodeinstanceByIds(ids));
|
||||
@DeleteMapping("/{id}")
|
||||
public R<Integer> remove(@PathVariable Long id) {
|
||||
Nodeparameter nodeparameter = new Nodeparameter();
|
||||
nodeparameter.setNodeInstanceId(id);
|
||||
List<Nodeparameter> nodeparameters = nodeparameterService.selectNodeparameterList(nodeparameter);
|
||||
if (!CollectionUtils.isEmpty(nodeparameters)) {
|
||||
List<Long> ids = nodeparameters.stream()
|
||||
.map(Nodeparameter::getId)
|
||||
.collect(Collectors.toList());
|
||||
Long[] idsArray = ids.toArray(new Long[0]);
|
||||
nodeparameterService.deleteNodeparameterByIds(idsArray);
|
||||
}
|
||||
return R.ok(treenodeinstanceService.deleteTreenodeinstanceById(id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,52 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
|
||||
public class BehaviortreeVO {
|
||||
|
||||
private Long id;
|
||||
/** 行为树名称 */
|
||||
@ApiModelProperty(name = "行为树名称")
|
||||
private String name;
|
||||
|
||||
/** 行为树描述 */
|
||||
@ApiModelProperty(name = "行为树描述")
|
||||
private String description;
|
||||
|
||||
|
||||
@ApiModelProperty(name = "英文名称")
|
||||
private String englishName;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getEnglishName() {
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public void setEnglishName(String englishName) {
|
||||
this.englishName = englishName;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "NodeparameterVO", description = "节点参数vo")
|
||||
public class NodeparameterVO {
|
||||
|
||||
private Long id;
|
||||
|
||||
/** 关联到哪个节点实例 (外键: TreeInstanceNode.id) */
|
||||
@ApiModelProperty("节点实例id")
|
||||
private Long nodeInstanceId;
|
||||
|
||||
/** 关联到哪个参数定义 (外键: TemplateParameterDef.id) */
|
||||
@ApiModelProperty("模板参数定义表id")
|
||||
private Long paramDefId;
|
||||
|
||||
/** 节点实例设置的具体参数值 (覆盖模板默认值) */
|
||||
@ApiModelProperty("节点实例设置的具体参数值 (覆盖模板默认值)")
|
||||
private String value;
|
||||
|
||||
@ApiModelProperty("参数键名, 例如: target_name, speed")
|
||||
private String paramKey;
|
||||
|
||||
/** 参数数据类型, 例如: "float", "int", "string", "bool" */
|
||||
@ApiModelProperty("参数数据类型, 例如: float, int, string, bool")
|
||||
private String dataType;
|
||||
|
||||
/** 默认值 */
|
||||
@ApiModelProperty("默认值")
|
||||
private String defaultValue;
|
||||
|
||||
@ApiModelProperty("参数名称描述")
|
||||
private String description;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getNodeInstanceId() {
|
||||
return nodeInstanceId;
|
||||
}
|
||||
|
||||
public void setNodeInstanceId(Long nodeInstanceId) {
|
||||
this.nodeInstanceId = nodeInstanceId;
|
||||
}
|
||||
|
||||
public Long getParamDefId() {
|
||||
return paramDefId;
|
||||
}
|
||||
|
||||
public void setParamDefId(Long paramDefId) {
|
||||
this.paramDefId = paramDefId;
|
||||
}
|
||||
|
||||
public String getValue() {
|
||||
return value;
|
||||
}
|
||||
|
||||
public void setValue(String value) {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public String getParamKey() {
|
||||
return paramKey;
|
||||
}
|
||||
|
||||
public void setParamKey(String paramKey) {
|
||||
this.paramKey = paramKey;
|
||||
}
|
||||
|
||||
public String getDataType() {
|
||||
return dataType;
|
||||
}
|
||||
|
||||
public void setDataType(String dataType) {
|
||||
this.dataType = dataType;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public void setDefaultValue(String defaultValue) {
|
||||
this.defaultValue = defaultValue;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
@ApiModel(value = "NodetemplateDTO", description = "节点模板dto")
|
||||
public class NodetemplateDTO {
|
||||
private Long id;
|
||||
|
||||
/** 模板名称, 例如: "MoveToTarget", "IsTargetVisible" */
|
||||
@ApiModelProperty("模板名称, 例如: MoveToTarget, IsTargetVisible")
|
||||
private String name;
|
||||
|
||||
/** 对应的逻辑执行代码/脚本/函数名 */
|
||||
@ApiModelProperty("对应的逻辑执行代码/脚本/函数名")
|
||||
private String logicHandler;
|
||||
|
||||
/** 模板描述 */
|
||||
@ApiModelProperty("模板描述")
|
||||
private String description;
|
||||
|
||||
/** afsim 中转换的节点名 */
|
||||
@ApiModelProperty("afsim 中转换的节点名")
|
||||
private String englishName;
|
||||
|
||||
private String templeteType;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getLogicHandler() {
|
||||
return logicHandler;
|
||||
}
|
||||
|
||||
public void setLogicHandler(String logicHandler) {
|
||||
this.logicHandler = logicHandler;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getEnglishName() {
|
||||
return englishName;
|
||||
}
|
||||
|
||||
public void setEnglishName(String englishName) {
|
||||
this.englishName = englishName;
|
||||
}
|
||||
|
||||
public String getTempleteType() {
|
||||
return templeteType;
|
||||
}
|
||||
|
||||
public void setTempleteType(String templeteType) {
|
||||
this.templeteType = templeteType;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "NodetemplateVO", description = "节点模板vo")
|
||||
public class NodetemplateVO {
|
||||
/** 模版类型,节点模版或者条件判断,例如“node”,precondition“ */
|
||||
@ApiModelProperty("模版类型,节点模版或者条件判断,例如“node”,precondition“")
|
||||
private String templeteType;
|
||||
|
||||
@ApiModelProperty("节点模板数据")
|
||||
private List<NodetemplateDTO> dtoList;
|
||||
|
||||
public String getTempleteType() {
|
||||
return templeteType;
|
||||
}
|
||||
|
||||
public void setTempleteType(String templeteType) {
|
||||
this.templeteType = templeteType;
|
||||
}
|
||||
|
||||
public List<NodetemplateDTO> getDtoList() {
|
||||
return dtoList;
|
||||
}
|
||||
|
||||
public void setDtoList(List<NodetemplateDTO> dtoList) {
|
||||
this.dtoList = dtoList;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
package com.solution.web.controller.behaviour.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ApiModel(value = "TreenodeinstanceVO", description = "节点vo")
|
||||
public class TreenodeinstanceVO {
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty("行为树id")
|
||||
private Long treeId;
|
||||
|
||||
/** 引用哪个节点模板 (外键: NodeTemplate.id) */
|
||||
@ApiModelProperty("节点模板id")
|
||||
private Long templateId;
|
||||
|
||||
/** 节点的显示名称 (可能与模板名称不同, 用于区分实例) */
|
||||
@ApiModelProperty("节点的显示名称")
|
||||
private String instanceName;
|
||||
|
||||
/** 判断当前节点是否为根节点,默认情况下是非根节点 */
|
||||
@ApiModelProperty("判断当前节点是否为根节点,默认情况下是非根节点")
|
||||
private Long isRoot;
|
||||
@ApiModelProperty("节点介绍")
|
||||
private String desciption;
|
||||
|
||||
@ApiModelProperty("节点变量结合")
|
||||
private List<NodeparameterVO> nodeparameterVOList;
|
||||
|
||||
public Long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Long id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Long getTreeId() {
|
||||
return treeId;
|
||||
}
|
||||
|
||||
public void setTreeId(Long treeId) {
|
||||
this.treeId = treeId;
|
||||
}
|
||||
|
||||
public Long getTemplateId() {
|
||||
return templateId;
|
||||
}
|
||||
|
||||
public void setTemplateId(Long templateId) {
|
||||
this.templateId = templateId;
|
||||
}
|
||||
|
||||
public String getInstanceName() {
|
||||
return instanceName;
|
||||
}
|
||||
|
||||
public void setInstanceName(String instanceName) {
|
||||
this.instanceName = instanceName;
|
||||
}
|
||||
|
||||
public Long getIsRoot() {
|
||||
return isRoot;
|
||||
}
|
||||
|
||||
public void setIsRoot(Long isRoot) {
|
||||
this.isRoot = isRoot;
|
||||
}
|
||||
|
||||
public String getDesciption() {
|
||||
return desciption;
|
||||
}
|
||||
|
||||
public void setDesciption(String desciption) {
|
||||
this.desciption = desciption;
|
||||
}
|
||||
|
||||
public List<NodeparameterVO> getNodeparameterVOList() {
|
||||
return nodeparameterVOList;
|
||||
}
|
||||
|
||||
public void setNodeparameterVOList(List<NodeparameterVO> nodeparameterVOList) {
|
||||
this.nodeparameterVOList = nodeparameterVOList;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user