Przeglądaj źródła

refactor: omit redundant path variable names

weipengtao 3 miesięcy temu
rodzic
commit
c2267edb81

+ 5 - 5
web/src/main/java/cn/seecoder/web/controller/apitest/ApiTestController.java

@@ -39,14 +39,14 @@ public class ApiTestController {
     @GetMapping("/list/{projectId}")
     @ApiOperation(value = "获取指定项目的所有测试任务", httpMethod = "GET")
     @ApiImplicitParam(name = "projectId", dataType ="int",paramType = "query")
-    public Response<List<ApiTestInfoVO>> getApiTestInfosByProjectId(@PathVariable("projectId") Integer projectId) {
+    public Response<List<ApiTestInfoVO>> getApiTestInfosByProjectId(@PathVariable Integer projectId) {
         return Response.buildSuccess(apiTestService.getApiTestsByProjectId(projectId));
     }
 
     @GetMapping("/delete/{testId}")
     @ApiOperation(value = "删除指定测试任务", httpMethod = "DELETE")
     @ApiImplicitParam(name = "testId", dataType = "int", paramType = "query")
-    public Response deleteApiTestInfoByTestId(@PathVariable("testId") Integer testId) {
+    public Response deleteApiTestInfoByTestId(@PathVariable Integer testId) {
         apiTestService.deleteApiTest(testId);
         return Response.buildSuccess();
     }
@@ -54,7 +54,7 @@ public class ApiTestController {
     @GetMapping("/execute/{testId}")
     @ApiOperation(value = "执行制定测试任务", httpMethod = "GET")
     @ApiImplicitParam(name = "testID", dataType = "int", paramType = "query")
-    public Response executeApiTestByTestId(@PathVariable("testId") Integer testId) throws InterruptedException {
+    public Response executeApiTestByTestId(@PathVariable Integer testId) throws InterruptedException {
         apiTestService.executeApiTest(testId);
         return Response.buildSuccess();
     }
@@ -62,14 +62,14 @@ public class ApiTestController {
     @GetMapping("/result/{testId}")
     @ApiOperation(value = "获取执行测试任务的执行结果列表", httpMethod = "GET")
     @ApiImplicitParam(name = "testId", dataType = "int", paramType = "query")
-    public Response<List<ApiTestResultVO>> getApiTestResultByTestId(@PathVariable("testId") Integer testId) {
+    public Response<List<ApiTestResultVO>> getApiTestResultByTestId(@PathVariable Integer testId) {
         return Response.buildSuccess(apiTestService.getApiTestResultByTestId(testId));
     }
 
     @GetMapping("/latest/{testId}")
     @ApiOperation(value = "获取测试任务的最近一次执行信息", httpMethod = "GET")
     @ApiImplicitParam(name = "testId", dataType = "int", paramType = "query")
-    public Response<ApiTestResultVO> getLatestTestResultByTestId(@PathVariable("testId") Integer testId) {
+    public Response<ApiTestResultVO> getLatestTestResultByTestId(@PathVariable Integer testId) {
         return Response.buildSuccess(apiTestService.getLatestTestResultByTestId(testId));
     }
 }

+ 7 - 7
web/src/main/java/cn/seecoder/web/controller/codereview/CodeReviewController.java

@@ -35,7 +35,7 @@ public class CodeReviewController {
     @GetMapping("/{projectId}")
     @ApiOperation(value = "获取一个项目的所有code_review", httpMethod = "GET")
     @ApiImplicitParam(value = "projectId", dataType = "int", paramType = "query")
-    public Response<CodeReviewSortedList> list(@PathVariable("projectId") Integer projectId){
+    public Response<CodeReviewSortedList> list(@PathVariable Integer projectId){
         return Response.buildSuccess(branchReviewService.list(projectId));
     }
 
@@ -50,14 +50,14 @@ public class CodeReviewController {
     @GetMapping("/branch_review/{codeReviewId}")
     @ApiOperation(value = "获取某个code_review的详细信息", httpMethod = "GET")
     @ApiImplicitParam(value = "codeReviewId", dataType = "int", paramType = "query")
-    public Response<CodeReviewVO> getBranchReviewById(@PathVariable("codeReviewId") Integer codeReviewId){
+    public Response<CodeReviewVO> getBranchReviewById(@PathVariable Integer codeReviewId){
         return Response.buildSuccess(branchReviewService.getById(codeReviewId));
     }
 
     @PutMapping("/close/{codeReviewId}")
     @ApiOperation(value = "关闭某个code_review", httpMethod = "PUT")
     @ApiImplicitParam(value = "codeReviewId", dataType = "int", paramType = "query")
-    public Response close(@PathVariable("codeReviewId") Integer codeReviewId){
+    public Response close(@PathVariable Integer codeReviewId){
         branchReviewService.close(codeReviewId);
         return Response.buildSuccess();
     }
@@ -65,7 +65,7 @@ public class CodeReviewController {
     @PutMapping("/reopen/{codeReviewId}")
     @ApiOperation(value = "重开某个code_review", httpMethod = "PUT")
     @ApiImplicitParam(value = "codeReviewId", dataType = "int", paramType = "query")
-    public Response reopen(@PathVariable("codeReviewId") Integer codeReviewId){
+    public Response reopen(@PathVariable Integer codeReviewId){
         branchReviewService.reopen(codeReviewId);
         return Response.buildSuccess();
     }
@@ -73,7 +73,7 @@ public class CodeReviewController {
     @PutMapping("/merge/{codeReviewId}")
     @ApiOperation(value = "合并某个code_review", httpMethod = "PUT")
     @ApiImplicitParam(value = "codeReviewId", dataType = "int", paramType = "query")
-    public Response merge(@PathVariable("codeReviewId") Integer codeReviewId) throws ServiceException {
+    public Response merge(@PathVariable Integer codeReviewId) throws ServiceException {
         branchReviewService.merge(codeReviewId);
         return Response.buildSuccess();
     }
@@ -81,7 +81,7 @@ public class CodeReviewController {
     @ApiOperation(value = "获取指定项目的所有branch信息", httpMethod = "GET")
     @GetMapping("/branches/{projectId}")
     @ApiImplicitParam(name = "projectId", dataType = "int", paramType = "query")
-    public Response getProjectBranches(@PathVariable("projectId") Integer projectId) throws ServiceException {
+    public Response getProjectBranches(@PathVariable Integer projectId) throws ServiceException {
         return Response.buildSuccess(branchReviewService.getBranches(projectId));
     }
 
@@ -119,7 +119,7 @@ public class CodeReviewController {
     @GetMapping("/file_review/{fileReviewId}")
     @ApiOperation(value = "获取一个文件评审任务详细信息", httpMethod = "GET")
     @ApiImplicitParam(value = "fileReviewId", dataType = "int", paramType = "query")
-    public Response getByFileReviewId(@PathVariable("fileReviewId") int fileReviewId){
+    public Response getByFileReviewId(@PathVariable int fileReviewId){
         return Response.buildSuccess(fileReviewService.getById(fileReviewId));
     }
 

+ 2 - 2
web/src/main/java/cn/seecoder/web/controller/codereview/CommentController.java

@@ -29,14 +29,14 @@ public class CommentController {
     @GetMapping("/{codeReviewId}")
     @ApiOperation(value = "获取一个CodeReview的所有评论", httpMethod = "GET")
     @ApiImplicitParam(value = "codeReviewId", dataType = "int", paramType = "query")
-    public Response list(@PathVariable("codeReviewId") Integer codeReviewId) throws ServiceException {
+    public Response list(@PathVariable Integer codeReviewId) throws ServiceException {
         return Response.buildSuccess(commentService.list(codeReviewId, false));
     }
 
     @GetMapping("/listForFileReview/{fileReviewId}")
     @ApiOperation(value = "获取文件评审的所有评论", httpMethod = "GET")
     @ApiImplicitParam(value = "fileReview", dataType = "int", paramType = "query")
-    public Response listForFileReview(@PathVariable("fileReviewId") Integer fileReviewId) throws ServiceException {
+    public Response listForFileReview(@PathVariable Integer fileReviewId) throws ServiceException {
         return Response.buildSuccess(commentService.list(fileReviewId, true));
     }
 

+ 7 - 7
web/src/main/java/cn/seecoder/web/controller/interfacetest/InterfaceTestController.java

@@ -39,7 +39,7 @@ public class InterfaceTestController {
      */
     @GetMapping("/list/{projectId}")
     @ApiOperation(value = "获取所有方法测试", httpMethod = "GET")
-    public Response<List<InterfaceTestInfoVO>> getInterfaceTestInfosByProjectId(@PathVariable("projectId") Integer projectId) {
+    public Response<List<InterfaceTestInfoVO>> getInterfaceTestInfosByProjectId(@PathVariable Integer projectId) {
         log.info("查询项目接口测试列表, projectId={}", projectId);
         List<InterfaceTestInfoVO> list = interfaceTestService.getInterfaceTestByProjectId(projectId);
         log.debug("查询到接口测试 {} 条", list.size());
@@ -51,9 +51,9 @@ public class InterfaceTestController {
      */
     @GetMapping("/execute/{id}/{username}/{type}")
     @ApiOperation(value = "执行一条方法测试", httpMethod = "GET")
-    public Response<Object> executeInterfaceTestById(@PathVariable("id") Integer id,
-                                                     @PathVariable("username") String username,
-                                                     @PathVariable("type") String type) throws IOException {
+    public Response<Object> executeInterfaceTestById(@PathVariable Integer id,
+                                                     @PathVariable String username,
+                                                     @PathVariable String type) throws IOException {
         log.info("执行接口测试, id={}, username={}, type={}", id, username, type);
         interfaceTestService.executeInterfaceTestById(id, username, type);
         return Response.buildSuccess();
@@ -64,7 +64,7 @@ public class InterfaceTestController {
      */
     @GetMapping("/results/{id}")
     @ApiOperation(value = "获取一条方法测试的所有结果(手动触发)", httpMethod = "GET")
-    public Response<List<InterfaceTestResultVO>> getInterfaceResultsById(@PathVariable("id") Integer id) {
+    public Response<List<InterfaceTestResultVO>> getInterfaceResultsById(@PathVariable Integer id) {
         log.info("查询手动触发测试结果, testId={}", id);
         return Response.buildSuccess(interfaceTestService.getInterfaceTestResultsById(id));
     }
@@ -74,7 +74,7 @@ public class InterfaceTestController {
      */
     @GetMapping("/delete/{id}")
     @ApiOperation(value = "删除指定方法测试", httpMethod = "GET")
-    public Response<Object> deleteInterfaceInfoById(@PathVariable("id") Integer id) {
+    public Response<Object> deleteInterfaceInfoById(@PathVariable Integer id) {
         log.info("删除接口测试, id={}", id);
         interfaceTestService.deleteInterfaceTestById(id);
         return Response.buildSuccess();
@@ -85,7 +85,7 @@ public class InterfaceTestController {
      */
     @GetMapping("/results/auto/{id}")
     @ApiOperation(value = "获取一条方法测试的所有结果(自动化测试)", httpMethod = "GET")
-    public Response<List<InterfaceTestResultVO>> getAutoInterfaceResultsById(@PathVariable("id") Integer id) {
+    public Response<List<InterfaceTestResultVO>> getAutoInterfaceResultsById(@PathVariable Integer id) {
         log.info("查询自动化测试结果, testId={}", id);
         return Response.buildSuccess(interfaceTestService.getAutoInterfaceTestResultsById(id));
     }

+ 2 - 2
web/src/main/java/cn/seecoder/web/controller/message/MessageController.java

@@ -28,7 +28,7 @@ public class MessageController {
     @GetMapping("/{receiverId}")
     @ApiOperation(value = "获取一个用户的新通知", httpMethod = "GET")
     @ApiImplicitParam(value = "receiverId", dataType = "int", paramType = "query")
-    public Response<List<MessageVO>> getNewMessages(@PathVariable("receiverId") int receiverId){
+    public Response<List<MessageVO>> getNewMessages(@PathVariable int receiverId){
         return Response.buildSuccess(messageService.getNewMessages(receiverId));
     }
 
@@ -41,7 +41,7 @@ public class MessageController {
     @GetMapping("/read/{messageId}")
     @ApiOperation(value = "将某条消息置为已读")
     @ApiImplicitParam(value = "messageId", dataType = "int", paramType = "query")
-    public Response readMessage(@PathVariable("messageId") int messageId){
+    public Response readMessage(@PathVariable int messageId){
         messageService.readMessage(messageId);
         return Response.buildSuccess();
     }

+ 2 - 2
web/src/main/java/cn/seecoder/web/controller/project/ProjectController.java

@@ -44,7 +44,7 @@ public class ProjectController {
     @ApiOperation(value = "根据projectId获取Project", httpMethod = "GET")
     @GetMapping("/{projectId}")
     @ApiImplicitParam(name = "projectId",dataType ="int", paramType = "path")
-    public Response<ProjectVO> getProjectById(@PathVariable("projectId")int projectId){
+    public Response<ProjectVO> getProjectById(@PathVariable int projectId){
         return Response.buildSuccess(projectService.getProjectById(projectId));
     }
 
@@ -122,7 +122,7 @@ public class ProjectController {
     @ApiOperation(value = "查看一个项目关联的所有项目", httpMethod = "GET")
     @GetMapping("/relate/{projectId}")
     @ApiImplicitParam(name = "projectId", dataType = "int", paramType = "query")
-    public Response<List<ProjectVO>> getRelatedProject(@PathVariable("projectId") Integer projectId) {
+    public Response<List<ProjectVO>> getRelatedProject(@PathVariable Integer projectId) {
         return Response.buildSuccess(projectService.getRelatedProjects(projectId));
     }
 }

+ 4 - 4
web/src/main/java/cn/seecoder/web/controller/tree/TreeNodesController.java

@@ -35,7 +35,7 @@ public class TreeNodesController {
     @ApiOperation(value = "获取project_id对应的所有nodes",httpMethod = "GET")
     @GetMapping("/{projectId}")
     @ApiImplicitParam(value = "projectId", dataType ="int", paramType = "path")
-    public Response<List<TreeNodeVO>> listTreeNodesByProjectId(@PathVariable("projectId") int projectId){
+    public Response<List<TreeNodeVO>> listTreeNodesByProjectId(@PathVariable int projectId){
         return Response.buildSuccess(treeNodeService.listTreeNodesByProjectId(projectId));
     }
 
@@ -50,14 +50,14 @@ public class TreeNodesController {
     @ApiOperation(value = "根据nodeId删除节点", httpMethod = "DELETE")
     @DeleteMapping("/node/{nodeId}")
     @ApiImplicitParam(value = "nodeId",dataType ="int", paramType = "path")
-    public Response deleteTreeNode(@PathVariable("nodeId") int nodeId) throws ServiceException {
+    public Response deleteTreeNode(@PathVariable int nodeId) throws ServiceException {
         treeNodeService.deleteTreeNode(nodeId);
         return Response.buildSuccess();
     }
     @ApiOperation(value = "根据父节点fatherId创建一个子节点并返回", httpMethod = "POST")
     @PostMapping("/subNode/{fatherId}")
     @ApiImplicitParam(value = "fatherId",dataType ="int", paramType = "path")
-    public Response insertTreeNodeByFatherNode(@PathVariable("fatherId") int fatherId) throws ServiceException {
+    public Response insertTreeNodeByFatherNode(@PathVariable int fatherId) throws ServiceException {
         treeNodeService.insertTreeNodeByFatherNode(fatherId);
         return Response.buildSuccess();
     }
@@ -73,7 +73,7 @@ public class TreeNodesController {
     @ApiOperation(value = "根据项目id返回某个项目所有type为task的节点", httpMethod = "GET")
     @GetMapping("/node/type/task/{projectId}")
     @ApiImplicitParam(value = "projectId",dataType = "int", paramType = "path")
-    public Response getNodesWithTaskTypeByProjectId(@PathVariable("projectId") int projectId){
+    public Response getNodesWithTaskTypeByProjectId(@PathVariable int projectId){
         List<TreeNodeVO> nodesWithTaskTypeByProjectId = treeNodeService.getNodesWithTaskTypeByProjectId(projectId);
         return Response.buildSuccess(nodesWithTaskTypeByProjectId);
     }