|
|
@@ -1,73 +1,75 @@
|
|
|
-//package seecoder.devcloud.web.controller.tree;
|
|
|
-//
|
|
|
-//
|
|
|
-//import io.swagger.annotations.Api;
|
|
|
-//import io.swagger.annotations.ApiImplicitParam;
|
|
|
-//import io.swagger.annotations.ApiOperation;
|
|
|
-//import org.springframework.beans.factory.annotation.Autowired;
|
|
|
-//import org.springframework.web.bind.annotation.*;
|
|
|
-//import seecoder.devcloud.web.model.po.tree.TreeNodePO;
|
|
|
-//import seecoder.devcloud.web.model.vo.Response;
|
|
|
-//import seecoder.devcloud.web.model.vo.TreeNodeVO;
|
|
|
-//import seecoder.devcloud.web.service.tree.TreeNodeService;
|
|
|
-//
|
|
|
-//
|
|
|
-//
|
|
|
-//import java.util.List;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * @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();
|
|
|
-// }
|
|
|
-//
|
|
|
-// /**
|
|
|
-// * 获取某个项目所有需求情况
|
|
|
-// * @param projectId
|
|
|
-// * @return
|
|
|
-// */
|
|
|
-// @ApiOperation(value = "获取project_id对应的所有nodes",httpMethod = "GET")
|
|
|
-// @GetMapping("/{projectId}")
|
|
|
-// @ApiImplicitParam(value = "projectId", dataTypeClass = Integer.class, paramType = "path")
|
|
|
-// public Response<List<TreeNodePO>> listTreeNodesByProjectId(@PathVariable("projectId") int projectId){
|
|
|
-// return treeNodeService.listTreeNodesByProjectId(projectId);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "插入节点", httpMethod = "POST")
|
|
|
-// @PostMapping("/node")
|
|
|
-// public Response insertTreeNode(TreeNodeVO treeNodeVO){
|
|
|
-// return treeNodeService.insertTreeNode(treeNodeVO);
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "根据nodeId删除节点", httpMethod = "DELETE")
|
|
|
-// @DeleteMapping("/node/{nodeId}")
|
|
|
-// @ApiImplicitParam(value = "nodeId",dataTypeClass = Integer.class, paramType = "path")
|
|
|
-// public Response deleteTreeNode(@PathVariable("nodeId") int nodeId) {
|
|
|
-// return Response.buildSuccess(treeNodeService.deleteTreeNode(nodeId));
|
|
|
-// }
|
|
|
-// @ApiOperation(value = "根据父节点fatherId创建一个子节点并返回", httpMethod = "POST")
|
|
|
-// @PostMapping("/subNode/{fatherId}")
|
|
|
-// @ApiImplicitParam(value = "fatherId",dataTypeClass = Integer.class, paramType = "path")
|
|
|
-// public Response insertTreeNodeByFatherNode(@PathVariable("fatherId") int fatherId){
|
|
|
-// Response res = treeNodeService.insertTreeNodeByFatherNode(fatherId);
|
|
|
-// return res;
|
|
|
-// }
|
|
|
-//
|
|
|
-// @ApiOperation(value = "修改节点属性", httpMethod = "PUT")
|
|
|
-// @PutMapping("/node")
|
|
|
-// @ApiImplicitParam(value = "treeNodeVO",dataTypeClass = TreeNodeVO.class, paramType = "body")
|
|
|
-// public Response updateTreeNode(@RequestBody TreeNodeVO treeNodeVO){
|
|
|
-// return treeNodeService.updateTreeNode(treeNodeVO);
|
|
|
-// }
|
|
|
-//}
|
|
|
+package seecoder.devcloud.web.controller.tree;
|
|
|
+
|
|
|
+
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+import seecoder.devcloud.web.model.po.tree.TreeNodePO;
|
|
|
+import seecoder.devcloud.web.model.vo.Response;
|
|
|
+import seecoder.devcloud.web.model.vo.TreeNodeVO;
|
|
|
+import seecoder.devcloud.web.service.tree.TreeNodeService;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @Author cyz,xzh
|
|
|
+ * @Description 需求树相关操作
|
|
|
+ */
|
|
|
+@Api("需求相关API")
|
|
|
+@RestController
|
|
|
+@RequestMapping("/tree")
|
|
|
+public class TreeNodesController {
|
|
|
+ @Autowired
|
|
|
+ private TreeNodeService treeNodeService;
|
|
|
+ //注意 这里混用po和vo了
|
|
|
+ @ApiOperation("获取所有nodes")
|
|
|
+ @GetMapping("/all")
|
|
|
+ public Response<List<TreeNodeVO>> getAllNodes(){
|
|
|
+ return Response.buildSuccess(treeNodeService.getAllNodes());
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取某个项目所有需求情况
|
|
|
+ * @param projectId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @ApiOperation(value = "获取project_id对应的所有nodes",httpMethod = "GET")
|
|
|
+ @GetMapping("/{projectId}")
|
|
|
+ @ApiImplicitParam(value = "projectId", dataTypeClass = Integer.class, paramType = "path")
|
|
|
+ public Response<List<TreeNodeVO>> listTreeNodesByProjectId(@PathVariable("projectId") int projectId){
|
|
|
+ return Response.buildSuccess(treeNodeService.listTreeNodesByProjectId(projectId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "插入节点", httpMethod = "POST")
|
|
|
+ @PostMapping("/node")
|
|
|
+ public Response insertTreeNode(TreeNodeVO treeNodeVO){
|
|
|
+ treeNodeService.insertTreeNode(treeNodeVO);
|
|
|
+ return Response.buildSuccess();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "根据nodeId删除节点", httpMethod = "DELETE")
|
|
|
+ @DeleteMapping("/node/{nodeId}")
|
|
|
+ @ApiImplicitParam(value = "nodeId",dataTypeClass = Integer.class, paramType = "path")
|
|
|
+ public Response deleteTreeNode(@PathVariable("nodeId") int nodeId) {
|
|
|
+ treeNodeService.deleteTreeNode(nodeId);
|
|
|
+ return Response.buildSuccess();
|
|
|
+ }
|
|
|
+ @ApiOperation(value = "根据父节点fatherId创建一个子节点并返回", httpMethod = "POST")
|
|
|
+ @PostMapping("/subNode/{fatherId}")
|
|
|
+ @ApiImplicitParam(value = "fatherId",dataTypeClass = Integer.class, paramType = "path")
|
|
|
+ public Response insertTreeNodeByFatherNode(@PathVariable("fatherId") int fatherId){
|
|
|
+ return Response.buildSuccess(treeNodeService.insertTreeNodeByFatherNode(fatherId));
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "修改节点属性", httpMethod = "PUT")
|
|
|
+ @PutMapping("/node")
|
|
|
+ @ApiImplicitParam(value = "treeNodeVO",dataTypeClass = TreeNodeVO.class, paramType = "body")
|
|
|
+ public Response updateTreeNode(@RequestBody TreeNodeVO treeNodeVO){
|
|
|
+ treeNodeService.updateTreeNode(treeNodeVO);
|
|
|
+ return Response.buildSuccess();
|
|
|
+ }
|
|
|
+}
|