|
@@ -0,0 +1,32 @@
|
|
1
|
+package com.yaozhitech.spring5.controller;
|
|
2
|
+
|
|
3
|
+import java.util.ArrayList;
|
|
4
|
+import java.util.List;
|
|
5
|
+
|
|
6
|
+import org.springframework.http.ResponseEntity;
|
|
7
|
+import org.springframework.web.bind.annotation.GetMapping;
|
|
8
|
+import org.springframework.web.bind.annotation.PathVariable;
|
|
9
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
10
|
+import org.springframework.web.bind.annotation.RestController;
|
|
11
|
+
|
|
12
|
+import com.yaozhitech.spring5.dto.ArticleDto;
|
|
13
|
+
|
|
14
|
+@RestController
|
|
15
|
+@RequestMapping("/article")
|
|
16
|
+public class ArticleController {
|
|
17
|
+
|
|
18
|
+ @GetMapping("/list")
|
|
19
|
+ public ResponseEntity<List<ArticleDto>> list(){
|
|
20
|
+ List<ArticleDto> list = new ArrayList<ArticleDto>();
|
|
21
|
+
|
|
22
|
+ list.add(ArticleDto.toArticle("title"));
|
|
23
|
+ return ResponseEntity.ok(list);
|
|
24
|
+ }
|
|
25
|
+
|
|
26
|
+ @GetMapping("/{id}")
|
|
27
|
+ public ResponseEntity<ArticleDto> read(@PathVariable Long id){
|
|
28
|
+ return null;
|
|
29
|
+ }
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+}
|