-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
253 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,220 @@ | ||
[ | ||
{ | ||
"NodeName": "BlogController", | ||
"Module": "root", | ||
"Type": "CLASS", | ||
"Functions": [ | ||
{ | ||
"Name": "getAllBlogs", | ||
"ReturnType": "ResponseEntity<String>", | ||
"FunctionCalls": [ | ||
{ | ||
"Package": "org.springframework.http", | ||
"Type": "CHAIN", | ||
"NodeName": "ResponseEntity", | ||
"FunctionName": "ok", | ||
"Parameters": [ | ||
{ | ||
"TypeValue": "\"List of all blogs\"", | ||
"TypeType": "" | ||
} | ||
], | ||
"Position": { | ||
"StartLine": 15, | ||
"StartLinePosition": 30, | ||
"StopLine": 15, | ||
"StopLinePosition": 52 | ||
} | ||
} | ||
], | ||
"Annotations": [ | ||
{ | ||
"Name": "GetMapping" | ||
}, | ||
{ | ||
"Name": "ApiOperation", | ||
"KeyValues": [ | ||
{ | ||
"Key": "\"获取所有博客\"", | ||
"Value": "\"获取所有博客\"" | ||
} | ||
] | ||
} | ||
], | ||
"Position": { | ||
"StartLine": 13, | ||
"StartLinePosition": 11, | ||
"StopLine": 16, | ||
"StopLinePosition": 4 | ||
}, | ||
"BodyHash": 40602143 | ||
}, | ||
{ | ||
"Name": "createBlog", | ||
"ReturnType": "ResponseEntity<String>", | ||
"Parameters": [ | ||
{ | ||
"TypeValue": "blogContent", | ||
"TypeType": "String" | ||
} | ||
], | ||
"FunctionCalls": [ | ||
{ | ||
"Package": "org.springframework.http", | ||
"Type": "CHAIN", | ||
"NodeName": "ResponseEntity", | ||
"FunctionName": "ok", | ||
"Parameters": [ | ||
{ | ||
"TypeValue": "\"Blog created successfully\"", | ||
"TypeType": "" | ||
} | ||
], | ||
"Position": { | ||
"StartLine": 22, | ||
"StartLinePosition": 30, | ||
"StopLine": 22, | ||
"StopLinePosition": 60 | ||
} | ||
} | ||
], | ||
"Annotations": [ | ||
{ | ||
"Name": "PostMapping" | ||
}, | ||
{ | ||
"Name": "ApiOperation", | ||
"KeyValues": [ | ||
{ | ||
"Key": "\"创建新博客\"", | ||
"Value": "\"创建新博客\"" | ||
} | ||
] | ||
} | ||
], | ||
"Position": { | ||
"StartLine": 20, | ||
"StartLinePosition": 11, | ||
"StopLine": 23, | ||
"StopLinePosition": 4 | ||
}, | ||
"LocalVariables": [ | ||
{ | ||
"TypeValue": "blogContent", | ||
"TypeType": "String" | ||
} | ||
], | ||
"BodyHash": -129622863 | ||
}, | ||
{ | ||
"Name": "getBlogById", | ||
"ReturnType": "ResponseEntity<String>", | ||
"Parameters": [ | ||
{ | ||
"TypeValue": "id", | ||
"TypeType": "Long" | ||
} | ||
], | ||
"FunctionCalls": [ | ||
{ | ||
"Package": "org.springframework.http", | ||
"Type": "CHAIN", | ||
"NodeName": "ResponseEntity", | ||
"FunctionName": "ok", | ||
"Parameters": [ | ||
{ | ||
"TypeValue": "\"Blog with ID \"+id", | ||
"TypeType": "" | ||
} | ||
], | ||
"Position": { | ||
"StartLine": 29, | ||
"StartLinePosition": 30, | ||
"StopLine": 29, | ||
"StopLinePosition": 53 | ||
} | ||
} | ||
], | ||
"Annotations": [ | ||
{ | ||
"Name": "GetMapping", | ||
"KeyValues": [ | ||
{ | ||
"Key": "\"/{id}\"", | ||
"Value": "\"/{id}\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"Name": "ApiOperation", | ||
"KeyValues": [ | ||
{ | ||
"Key": "\"获取指定ID的博客\"", | ||
"Value": "\"获取指定ID的博客\"" | ||
} | ||
] | ||
} | ||
], | ||
"Position": { | ||
"StartLine": 27, | ||
"StartLinePosition": 11, | ||
"StopLine": 30, | ||
"StopLinePosition": 4 | ||
}, | ||
"LocalVariables": [ | ||
{ | ||
"TypeValue": "blogContent", | ||
"TypeType": "String" | ||
}, | ||
{ | ||
"TypeValue": "id", | ||
"TypeType": "Long" | ||
} | ||
], | ||
"BodyHash": -1220519629 | ||
} | ||
], | ||
"Annotations": [ | ||
{ | ||
"Name": "RestController" | ||
}, | ||
{ | ||
"Name": "RequestMapping", | ||
"KeyValues": [ | ||
{ | ||
"Key": "\"/api/blogs\"", | ||
"Value": "\"/api/blogs\"" | ||
} | ||
] | ||
}, | ||
{ | ||
"Name": "Api", | ||
"KeyValues": [ | ||
{ | ||
"Key": "tags", | ||
"Value": "\"博客管理\"" | ||
} | ||
] | ||
} | ||
], | ||
"Imports": [ | ||
{ | ||
"Source": "io.swagger.annotations.Api" | ||
}, | ||
{ | ||
"Source": "io.swagger.annotations.ApiOperation" | ||
}, | ||
{ | ||
"Source": "org.springframework.http.ResponseEntity" | ||
}, | ||
{ | ||
"Source": "org.springframework.web.bind.annotation" | ||
} | ||
], | ||
"Position": { | ||
"StartLine": 9, | ||
"StartLinePosition": 7, | ||
"StopLine": 33 | ||
} | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import io.swagger.annotations.Api; | ||
import io.swagger.annotations.ApiOperation; | ||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.*; | ||
|
||
@RestController | ||
@RequestMapping("/api/blogs") | ||
@Api(tags = "博客管理") | ||
public class BlogController { | ||
|
||
@GetMapping | ||
@ApiOperation("获取所有博客") | ||
public ResponseEntity<String> getAllBlogs() { | ||
// 从数据库或其他数据源获取博客列表的逻辑 | ||
return ResponseEntity.ok("List of all blogs"); | ||
} | ||
|
||
@PostMapping | ||
@ApiOperation("创建新博客") | ||
public ResponseEntity<String> createBlog(@RequestBody String blogContent) { | ||
// 解析请求中的博客内容,并将其保存到数据库的逻辑 | ||
return ResponseEntity.ok("Blog created successfully"); | ||
} | ||
|
||
@GetMapping("/{id}") | ||
@ApiOperation("获取指定ID的博客") | ||
public ResponseEntity<String> getBlogById(@PathVariable Long id) { | ||
// 根据ID从数据库中获取博客的逻辑 | ||
return ResponseEntity.ok("Blog with ID " + id); | ||
} | ||
|
||
// 可以添加其他操作,比如更新博客、删除博客等 | ||
} |