|
|
@@ -1,8 +1,8 @@
|
|
|
package seecoder.devcloud.web.controller.tree;
|
|
|
|
|
|
|
|
|
-import org.apache.ibatis.annotations.Delete;
|
|
|
-import org.apache.ibatis.annotations.Param;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import seecoder.devcloud.web.po.TreeNodePO;
|
|
|
@@ -12,16 +12,18 @@ import seecoder.devcloud.web.vo.TreeNodeVO;
|
|
|
|
|
|
import java.util.List;
|
|
|
|
|
|
-@RestController
|
|
|
-@RequestMapping("/tree")
|
|
|
/**
|
|
|
* @Author cyz,xzh
|
|
|
* @Description 需求树相关操作
|
|
|
*/
|
|
|
+@Api("需求相关API")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/tree")
|
|
|
public class TreeNodesController {
|
|
|
@Autowired
|
|
|
private TreeNodeService treeNodeService;
|
|
|
//注意 这里混用po和vo了
|
|
|
+ @ApiOperation("获取所有nodes")
|
|
|
@GetMapping("/all")
|
|
|
public List<TreeNodePO> getAllNodes(){
|
|
|
return treeNodeService.getAllNodes();
|
|
|
@@ -32,25 +34,33 @@ public class TreeNodesController {
|
|
|
* @param projectId
|
|
|
* @return
|
|
|
*/
|
|
|
+ @ApiOperation("获取project_id对应的所有nodes")
|
|
|
@GetMapping("/{projectId}")
|
|
|
public Response listTreeNodesByProjectId(@PathVariable("projectId") int projectId){
|
|
|
return treeNodeService.listTreeNodesByProjectId(projectId);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
+ @ApiOperation("插入节点")
|
|
|
@PostMapping("/node")
|
|
|
public Response insertTreeNode(TreeNodeVO treeNodeVO){
|
|
|
return treeNodeService.insertTreeNode(treeNodeVO);
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("根据nodeId删除节点")
|
|
|
@DeleteMapping("/node/{nodeId}")
|
|
|
public Response deleteTreeNode(@PathVariable("nodeId") int nodeId) {
|
|
|
return Response.ok(treeNodeService.deleteTreeNode(nodeId));
|
|
|
}
|
|
|
-
|
|
|
+ @ApiOperation("根据父节点fatherId创建一个子节点并返回")
|
|
|
@PostMapping("/subNode/{fatherId}")
|
|
|
public Response insertTreeNodeByFatherNode(@PathVariable("fatherId") int fatherId){
|
|
|
Response res = treeNodeService.insertTreeNodeByFatherNode(fatherId);
|
|
|
return res;
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation("修改节点属性")
|
|
|
+ @PutMapping("/node")
|
|
|
+ public Response updateTreeNode(@RequestBody TreeNodeVO treeNodeVO){
|
|
|
+ return treeNodeService.updateTreeNode(treeNodeVO);
|
|
|
+ }
|
|
|
}
|