-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathIController.java
More file actions
58 lines (42 loc) · 1.7 KB
/
IController.java
File metadata and controls
58 lines (42 loc) · 1.7 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package com.newdeal.ledger.inquiry.controller;
import com.newdeal.ledger.inquiry.dto.InquiryDto;
import com.newdeal.ledger.inquiry.service.InquiryService;
import org.eclipse.tags.shaded.org.apache.xpath.operations.Mod;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import java.util.ArrayList;
import java.util.Map;
@Controller
public class IController{
//@Autowired private InquiryService inquiryService; ← :스프링 의존성 주입방식 : 필드주입 방식
//▼(스프링 의존성 주입 방식: 생성자 주입방식)
private final InquiryService inquiryService;
public IController(InquiryService inquiryService){
this.inquiryService=inquiryService;
} //생성자 주입 방식
/**
* 문의 게시판 페이지
*
* @return index 최창윤
*/
@GetMapping("/index")
public String index(Model model, @RequestParam (defaultValue = "1") int page) {
// ▼ service 연결
Map<String,Object> map = inquiryService.iSelectAll(page); //ArrayList에서 Map으로 변경 됨
// ▽ model저장 후 전송
model.addAttribute("map",map);
return "index"; // 수정
}//index(문의 게시판 전체리스트 보기)
@GetMapping("/iView")
public String iView(Model model, @RequestParam(defaultValue = "1") int qbno){
// ▼ service 연결
InquiryDto ibdto = inquiryService.iSelectOne(qbno);
System.out.println("확인 : " + ibdto);
// ▽ model저장 후 전송
model.addAttribute("idto",ibdto);
return "iView";
}//iView(문의 게시물 1개보기)
}//IController