-
Notifications
You must be signed in to change notification settings - Fork 69
Expand file tree
/
Copy pathBoardController.java
More file actions
39 lines (32 loc) · 1.23 KB
/
BoardController.java
File metadata and controls
39 lines (32 loc) · 1.23 KB
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
package com.web.controller;
import com.web.annotation.SocialUser;
import com.web.domain.User;
import com.web.service.BoardService;
import org.springframework.data.domain.Pageable;
import org.springframework.data.web.PageableDefault;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
/**
* Created by KimYJ on 2017-07-12.
*/
@Controller
@RequestMapping("/board")
public class BoardController {
private final BoardService boardService;
public BoardController(BoardService boardService) {
this.boardService = boardService;
}
@GetMapping({"", "/"})
public String board(@RequestParam(value = "idx", defaultValue = "0") Long idx, Model model) {
model.addAttribute("board", boardService.findBoardByIdx(idx).orElse(null));
return "/board/form";
}
@GetMapping("/list")
public String list(@PageableDefault Pageable pageable, @SocialUser User user, Model model) {
model.addAttribute("boardList", boardService.findBoardList(pageable));
return "/board/list";
}
}