-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMngNotController.java
More file actions
86 lines (61 loc) · 2.72 KB
/
MngNotController.java
File metadata and controls
86 lines (61 loc) · 2.72 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
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
package kr.happyjob.study.mngNot.controller;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.PostConstruct;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.log4j.LogManager;
import org.apache.log4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import kr.happyjob.study.common.comnUtils.ComnCodUtil;
import kr.happyjob.study.mngNot.model.NoticeModel;
import kr.happyjob.study.mngNot.service.MngNotService;
@Controller
@RequestMapping("/mngNot/")
public class MngNotController {
@Autowired
MngNotService mngNotService;
// Set logger
private final Logger logger = LogManager.getLogger(this.getClass());
// Get class name for logger
private final String className = this.getClass().toString();
/**
* 공지사항 초기화면
*/
@RequestMapping("notice.do")
public String notice(Model model, @RequestParam Map<String, Object> paramMap, HttpServletRequest request,
HttpServletResponse response, HttpSession session) throws Exception {
logger.info("+ Start " + className + ".notice");
logger.info(" - paramMap : " + paramMap);
logger.info("+ End " + className + ".notice");
return "mngNot/noticelist";
}
/**
* 공지사항 목록 조회 (READ)
*/
@RequestMapping("noticelist.do")
public String noticelist(Model model, @RequestParam Map<String, Object> paramMap, HttpServletRequest request,
HttpServletResponse response, HttpSession session) throws Exception {
logger.info("+ Start " + className + ".noticelist");
logger.info(" - paramMap : " + paramMap);
int pagenum = Integer.parseInt((String) paramMap.get("pagenum"));
int pageSize = Integer.parseInt((String) paramMap.get("pageSize"));
int pageindex = (pagenum - 1) * pageSize;
paramMap.put("pageSize", pageSize);
paramMap.put("pageindex", pageindex);
// Controller Service Dao SQL
List<NoticeModel> noticesearchlist = mngNotService.noticelist(paramMap);
int totalcnt = mngNotService.countnoticelist(paramMap);
model.addAttribute("noticesearchlist", noticesearchlist);
model.addAttribute("totalcnt", totalcnt);
logger.info("+ End " + className + ".noticelist");
return "mngNot/noticelistgrd";
}
}