티스토리 뷰

0. 정보통신

82537 트래블 ArticleController.java

패스트코드블로그 2020. 6. 2. 21:35
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
package texas.sbq.travel.controllers;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.function.Consumer;
import java.util.function.Function;
 
 
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
 
 
import texas.sbq.travel.domains.Article;
import texas.sbq.travel.domains.Pager;
import texas.sbq.travel.enums.Messenger;
import texas.sbq.travel.services.ArticleService;
import texas.sbq.travel.utils.Box;
import texas.sbq.travel.utils.Crawler;
import texas.sbq.travel.utils.Filer;
import texas.sbq.travel.utils.Proxy;
 
 
@RestController
@RequestMapping("/articles")
public class ArticleController extends Proxy {
        @Autowired ArticleService articleService;
        @Autowired Article article;
        @Autowired Crawler crawler;
        @Autowired Pager pager;
        @Autowired Filer filemgr;
        @Autowired Article board;
        @Autowired Box<Object> trunk;
 
 
        @PostMapping("/{category}")
        public Messenger post(@RequestBody Article article) {
                articleService.save(article);
                return Messenger.SUCCESS;
        }
        
        @GetMapping("/{group}/{id}")
        public Messenger get(@PathVariable("group"String category,
                        @PathVariable("id"String articleSeq) {
                article.setCategory(category);
                article.setArticleSeq(articleSeq);
                articleService.detail(article);
                return Messenger.SUCCESS;
        }
        @GetMapping("/{group}/{pageSize}/{nowPage}/{option}/{search}")
        public List<Article> get(@PathVariable("pageSize"String pageSize, @PathVariable("nowPage"String nowPage,
                         @PathVariable("option"String option, @PathVariable("search"String search, @PathVariable("group"String category) {
                pager.setCtype(category);
                articleService.count(null);
                pager.setRowCount(0);
                pager.setPageSize(Integer.parseInt(pageSize));
                pager.setBlockSize(5);
                pager.setNowPage(integer(nowPage));
                pager.setOption(option);
                pager.setSearch(search);
                pager.paging();
                List<Article> list = null;
                        
                return list;
        }
 
 
        @PutMapping("/")
        public Messenger put(@RequestBody Article article) {
                articleService.edit(article);
                return Messenger.SUCCESS;
        }
 
 
        @DeleteMapping("/{id}")
        public Messenger delete(@PathVariable String id) {
                articleService.remove(id);
                return Messenger.SUCCESS;
        }
                
        
 
 
}
 
cs
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/12   »
1 2 3 4 5 6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31
글 보관함