-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMngNotController.java
More file actions
136 lines (92 loc) · 4.46 KB
/
Copy pathMngNotController.java
File metadata and controls
136 lines (92 loc) · 4.46 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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
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";
}
@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";
}
@RequestMapping("noticeselectone.do")
@ResponseBody
public Map<String, Object> noticeselectone(Model model, @RequestParam Map<String, Object> paramMap, HttpServletRequest request,
HttpServletResponse response, HttpSession session) throws Exception {
logger.info("+ Start " + className + ".noticeselectone");
logger.info(" - paramMap : " + paramMap);
// Controller Service Dao SQL
NoticeModel noticesearch = mngNotService.noticeselectone(paramMap);
Map<String, Object> returnmap = new HashMap<String, Object>();
returnmap.put("noticesearch", noticesearch);
logger.info("+ End " + className + ".noticeselectone");
return returnmap;
}
@RequestMapping("noticesave.do")
@ResponseBody
public Map<String, Object> noticesave(Model model, @RequestParam Map<String, Object> paramMap, HttpServletRequest request,
HttpServletResponse response, HttpSession session) throws Exception {
logger.info("+ Start " + className + ".noticesave");
logger.info(" - paramMap : " + paramMap);
String action = (String) paramMap.get("action");
paramMap.put("loginid", (String) session.getAttribute("loginId"));
int returncval = 0;
if("I".equals(action)) {
returncval = mngNotService.noticeinsert(paramMap);
} else if("U".equals(action)) {
returncval = mngNotService.noticeupdate(paramMap);
} else if("D".equals(action)) {
returncval = mngNotService.noticedelete(paramMap);
}
Map<String, Object> returnmap = new HashMap<String, Object>();
returnmap.put("returncval", returncval);
logger.info("+ End " + className + ".noticesave");
return returnmap;
}
}