Commit 6f22ff1b3b6b85d3f0db4f59115637d3a13a9ba9
1 parent
d434ebaa
.
Showing
8 changed files
with
113 additions
and
41 deletions
Show diff stats
src/main/java/com/daeucna/board/common/PagingUtil.java
... | ... | @@ -46,17 +46,17 @@ public class PagingUtil { |
46 | 46 | |
47 | 47 | // 페이지 네이게이션 설정 |
48 | 48 | pagination += "<div class='pagination'>"; |
49 | - pagination += "<a href='javascript:" + functionName + "(\"" + totalFirstPage + "\");' class=\"direction_left01\">[<<]</a>"; | |
50 | - pagination += "<a href='javascript:" + functionName + "(" + prePerPage + ");' class=\"direction_left01\">[<]</a>"; | |
49 | + pagination += "<a href='javascript:" + functionName + "(\"" + totalFirstPage + "\");' class=\"direction_left01\">|◁</a>"; | |
50 | + pagination += "<a href='javascript:" + functionName + "(" + prePerPage + ");' class=\"direction_left01\">◁</a>"; | |
51 | 51 | for (int a = viewFirstPage; a <= ViewLastPage; a++) { |
52 | 52 | if (a == currentPage) { |
53 | - pagination += "<a href='javascript:" + functionName + "(\"" + a + "\");' class='onpage'>[" + a + "]</a>"; | |
53 | + pagination += "<a href='javascript:" + functionName + "(\"" + a + "\");' class='onpage'>" + a + "</a>"; | |
54 | 54 | } else { |
55 | - pagination += "<a href='javascript:" + functionName + "(\"" + a + "\");'>[" + a + "]</a>"; | |
55 | + pagination += "<a href='javascript:" + functionName + "(\"" + a + "\");'>" + a + "</a>"; | |
56 | 56 | } |
57 | 57 | } |
58 | - pagination += "<a href='javascript:" + functionName + "(" + nextPerPage + ");' class=\"direction_right01\">[>]</a>"; | |
59 | - pagination += "<a href='javascript:" + functionName + "(" + totalLastPage + ");' class=\"direction_right01\">[>>]</a>"; | |
58 | + pagination += "<a href='javascript:" + functionName + "(" + nextPerPage + ");' class=\"direction_right01\">▷</a>"; | |
59 | + pagination += "<a href='javascript:" + functionName + "(" + totalLastPage + ");' class=\"direction_right01\">▷|</a>"; | |
60 | 60 | pagination += "</div>"; |
61 | 61 | |
62 | 62 | int offset = ((currentPage - 1) * countPerList); // 한 화면의 표출되는 게시물의 시작 번호 (쿼리 조건절) | ... | ... |
src/main/java/com/daeucna/board/common/ResultUtil.java
src/main/java/com/daeucna/board/controller/BoardController.java
... | ... | @@ -55,9 +55,10 @@ public class BoardController { |
55 | 55 | public ResultUtil getBoardList(HttpServletRequest request, HttpServletResponse response, BoardForm boardForm, Authentication authentication) throws Exception { |
56 | 56 | UserDto userDto = (UserDto) authentication.getPrincipal(); |
57 | 57 | boardForm.setBoard_kind(userDto.getBoardName()); |
58 | - | |
58 | + | |
59 | 59 | ResultUtil resultUtils = boardService.getBoardList(boardForm); |
60 | - | |
60 | + resultUtils.setCurrent_user(userDto.getUsername()); | |
61 | + | |
61 | 62 | return resultUtils; |
62 | 63 | } |
63 | 64 | |
... | ... | @@ -71,11 +72,13 @@ public class BoardController { |
71 | 72 | /** 게시판 - 상세 조회 */ |
72 | 73 | @RequestMapping(value = "/getBoardDetail") |
73 | 74 | @ResponseBody |
74 | - public BoardDto getBoardDetail(HttpServletRequest request, HttpServletResponse response, BoardForm boardForm) throws Exception { | |
75 | - | |
75 | + public BoardDto getBoardDetail(HttpServletRequest request, HttpServletResponse response, BoardForm boardForm, Authentication authentication) throws Exception { | |
76 | + UserDto userDto = (UserDto) authentication.getPrincipal(); | |
77 | + | |
76 | 78 | MDC.put("ID", String.valueOf(boardForm.getBoard_seq())); |
77 | 79 | |
78 | 80 | BoardDto boardDto = boardService.getBoardDetail(boardForm); |
81 | + boardDto.setCurrent_user(userDto.getUsername()); | |
79 | 82 | |
80 | 83 | MDC.remove("ID"); |
81 | 84 | |
... | ... | @@ -97,7 +100,9 @@ public class BoardController { |
97 | 100 | public BoardDto insertBoard(HttpServletRequest request, HttpServletResponse response, BoardForm boardForm, Authentication authentication) throws Exception { |
98 | 101 | UserDto userDto = (UserDto) authentication.getPrincipal(); |
99 | 102 | boardForm.setBoard_kind(userDto.getBoardName()); |
100 | - | |
103 | + boardForm.setIns_user_id(userDto.getUsername()); | |
104 | + boardForm.setUpd_user_id(userDto.getUsername()); | |
105 | + | |
101 | 106 | BoardDto boardDto = boardService.insertBoard(boardForm); |
102 | 107 | |
103 | 108 | return boardDto; |
... | ... | @@ -123,10 +128,14 @@ public class BoardController { |
123 | 128 | /** 게시판 - 수정 */ |
124 | 129 | @RequestMapping(value = "/updateBoard") |
125 | 130 | @ResponseBody |
126 | - public BoardDto updateBoard(HttpServletRequest request, HttpServletResponse response, BoardForm boardForm) throws Exception { | |
127 | - | |
131 | + public BoardDto updateBoard(HttpServletRequest request, HttpServletResponse response, BoardForm boardForm, Authentication authentication) throws Exception { | |
132 | + UserDto userDto = (UserDto) authentication.getPrincipal(); | |
133 | + boardForm.setIns_user_id(userDto.getUsername()); | |
134 | + boardForm.setUpd_user_id(userDto.getUsername()); | |
135 | + | |
128 | 136 | BoardDto boardDto = boardService.updateBoard(boardForm); |
129 | - | |
137 | + boardDto.setCurrent_user(userDto.getUsername()); | |
138 | + | |
130 | 139 | return boardDto; |
131 | 140 | } |
132 | 141 | |
... | ... | @@ -140,8 +149,12 @@ public class BoardController { |
140 | 149 | /** 게시판 - 답글 등록 */ |
141 | 150 | @RequestMapping(value = "/insertBoardReply") |
142 | 151 | @ResponseBody |
143 | - public BoardDto insertBoardReply(HttpServletRequest request, HttpServletResponse response, BoardForm boardForm) throws Exception { | |
144 | - | |
152 | + public BoardDto insertBoardReply(HttpServletRequest request, HttpServletResponse response, BoardForm boardForm, Authentication authentication) throws Exception { | |
153 | + UserDto userDto = (UserDto) authentication.getPrincipal(); | |
154 | + boardForm.setBoard_kind(userDto.getBoardName()); | |
155 | + boardForm.setIns_user_id(userDto.getUsername()); | |
156 | + boardForm.setUpd_user_id(userDto.getUsername()); | |
157 | + | |
145 | 158 | BoardDto boardDto = boardService.insertBoardReply(boardForm); |
146 | 159 | |
147 | 160 | return boardDto; | ... | ... |
src/main/java/com/daeucna/board/domain/BoardDto.java
src/main/java/com/daeucna/board/service/BoardService.java
... | ... | @@ -45,7 +45,7 @@ public class BoardService { |
45 | 45 | commonForm.setFunction_name(boardForm.getFunction_name()); |
46 | 46 | commonForm.setCurrent_page_no(boardForm.getCurrent_page_no()); |
47 | 47 | commonForm.setCount_per_page(10); |
48 | - commonForm.setCount_per_list(15); | |
48 | + commonForm.setCount_per_list(12); | |
49 | 49 | commonForm.setTatal_list_count(totalCount); |
50 | 50 | commonDto = PagingUtil.setPageUtil(commonForm); |
51 | 51 | } | ... | ... |
src/main/resources/mapper/board/BoardMapper.xml
... | ... | @@ -126,6 +126,7 @@ |
126 | 126 | , INS_DATE |
127 | 127 | , UPD_USER_ID |
128 | 128 | , UPD_DATE |
129 | + , PROC_STATUS | |
129 | 130 | ) |
130 | 131 | VALUES |
131 | 132 | ( |
... | ... | @@ -136,10 +137,11 @@ |
136 | 137 | , #{board_writer} |
137 | 138 | , #{board_subject} |
138 | 139 | , #{board_content} |
139 | - , 'NONMEMBER' | |
140 | + , #{ins_user_id} | |
140 | 141 | , NOW() |
141 | - , 'NONMEMBER' | |
142 | + , #{upd_user_id} | |
142 | 143 | , NOW() |
144 | + , '미처리' | |
143 | 145 | ) |
144 | 146 | |
145 | 147 | </insert> |
... | ... | @@ -178,9 +180,9 @@ |
178 | 180 | , #{file_path} |
179 | 181 | , #{file_size} |
180 | 182 | , 'N' |
181 | - , 'NONMEMBER' | |
183 | + , #{ins_user_id} | |
182 | 184 | , NOW() |
183 | - , 'NONMEMBER' | |
185 | + , #{upd_user_id} | |
184 | 186 | , NOW() |
185 | 187 | ) |
186 | 188 | |
... | ... | @@ -210,9 +212,9 @@ |
210 | 212 | , #{board_writer1} |
211 | 213 | , #{board_subject} |
212 | 214 | , #{board_content} |
213 | - , 'NONMEMBER' | |
215 | + , #{ins_user_id} | |
214 | 216 | , NOW() |
215 | - , 'NONMEMBER' | |
217 | + , #{upd_user_id} | |
216 | 218 | , NOW() |
217 | 219 | ) |
218 | 220 | |
... | ... | @@ -231,7 +233,9 @@ |
231 | 233 | UPDATE BOARD.TB_BOARD |
232 | 234 | SET BOARD_SUBJECT = #{board_subject} |
233 | 235 | , BOARD_CONTENT = #{board_content} |
234 | - , UPD_USER_ID = 'NONMEMBER' | |
236 | + , PROC_STATUS = #{proc_status} | |
237 | + , PROC_DESC = #{proc_desc} | |
238 | + , UPD_USER_ID = #{upd_user_id} | |
235 | 239 | , UPD_DATE = NOW() |
236 | 240 | WHERE BOARD_SEQ = #{board_seq} |
237 | 241 | |
... | ... | @@ -252,7 +256,7 @@ |
252 | 256 | |
253 | 257 | UPDATE TB_BOARD |
254 | 258 | SET BOARD_RE_SEQ = BOARD_RE_SEQ + 1 |
255 | - , UPD_USER_ID = 'NONMEMBER' | |
259 | + , UPD_USER_ID = #{upd_user_id} | |
256 | 260 | , UPD_DATE = NOW() |
257 | 261 | WHERE BOARD_RE_REF = #{board_re_ref} |
258 | 262 | AND BOARD_RE_SEQ > #{board_re_seq} |
... | ... | @@ -275,6 +279,7 @@ |
275 | 279 | , INS_DATE |
276 | 280 | , UPD_USER_ID |
277 | 281 | , UPD_DATE |
282 | + , PROC_STATUS | |
278 | 283 | ) |
279 | 284 | VALUES |
280 | 285 | ( |
... | ... | @@ -285,10 +290,11 @@ |
285 | 290 | , #{board_writer} |
286 | 291 | , #{board_subject} |
287 | 292 | , #{board_content} |
288 | - , 'NONMEMBER' | |
293 | + , #{ins_user_id} | |
289 | 294 | , NOW() |
290 | - , 'NONMEMBER' | |
295 | + , #{upd_user_id} | |
291 | 296 | , NOW() |
297 | + , null | |
292 | 298 | ) |
293 | 299 | |
294 | 300 | </insert> |
... | ... | @@ -297,7 +303,7 @@ |
297 | 303 | |
298 | 304 | UPDATE BOARD.TB_BOARD_FILE |
299 | 305 | SET DEL_YN = 'Y' |
300 | - , UPD_USER_ID = 'NONMEMBER' | |
306 | + , UPD_USER_ID = #{upd_user_id} | |
301 | 307 | , UPD_DATE = NOW() |
302 | 308 | WHERE BOARD_SEQ = #{board_seq} |
303 | 309 | AND FILE_NO = #{file_no} | ... | ... |
src/main/resources/templates/page/boardDetail.html
... | ... | @@ -90,7 +90,8 @@ |
90 | 90 | var updDate = obj.upd_date; |
91 | 91 | var files = obj.files; |
92 | 92 | var filesLen = files.length; |
93 | - | |
93 | + var current_user = obj.current_user; | |
94 | + | |
94 | 95 | str += "<tr>"; |
95 | 96 | str += "<th>제목</th>"; |
96 | 97 | str += "<td style='text-align: left;'>"+ boardSubject +"</td>"; |
... | ... | @@ -135,15 +136,30 @@ |
135 | 136 | str += "<th>처리상태</th>"; |
136 | 137 | str += "<td colspan='3' style='text-align: left;'>"+ boardProcStatus +"</td>"; |
137 | 138 | str += "</tr>"; |
138 | - str += "<tr>"; | |
139 | - str += "<th>처리자</th>"; | |
140 | - str += "<td style='text-align: left;'>"+ boardProcUser +"</td>"; | |
141 | - str += "<th>처리일시</th>"; | |
142 | - str += "<td style='text-align: left;'>"+ boardProcDate +"</td>"; | |
143 | - str += "</tr>"; | |
144 | - | |
139 | + if (boardProcStatus == "처리중" || boardProcStatus == "처리완료") { | |
140 | + str += "<tr>"; | |
141 | + str += "<th>처리내용</th>"; | |
142 | + str += "<td colspan='3' style='text-align: left;'>"+ boardProcDesc +"</td>"; | |
143 | + str += "</tr>"; | |
144 | + str += "<tr>"; | |
145 | + str += "<th>처리자</th>"; | |
146 | + str += "<td style='text-align: left;'>"+ boardProcUser +"</td>"; | |
147 | + str += "<th>처리일시</th>"; | |
148 | + str += "<td style='text-align: left;'>"+ boardProcDate +"</td>"; | |
149 | + str += "</tr>"; | |
150 | + } | |
151 | + | |
152 | + if (current_user != boardWriter) { | |
153 | + $("#btn_update").html("진행처리"); | |
154 | + } else { | |
155 | + $("#btn_reply").hide(); | |
156 | + } | |
145 | 157 | } else { |
146 | 158 | |
159 | + $("#btn_update").hide(); | |
160 | + $("#btn_delete").hide(); | |
161 | + $("#btn_reply").hide(); | |
162 | + | |
147 | 163 | alert("등록된 글이 존재하지 않습니다."); |
148 | 164 | return; |
149 | 165 | } |
... | ... | @@ -218,10 +234,10 @@ |
218 | 234 | <input type="hidden" id="search_type" name="search_type" value="S"/> <!-- 조회 타입 - 상세(S)/수정(U) --> |
219 | 235 | </form> |
220 | 236 | <div class="btn_right mt15"> |
221 | - <button type="button" class="btn black mr5" onclick="javascript:goBoardList();">목록으로</button> | |
222 | - <button type="button" class="btn black mr5" onclick="javascript:goBoardUpdate();">수정하기</button> | |
223 | - <button type="button" class="btn black" onclick="javascript:deleteBoard();">삭제하기</button> | |
224 | - <button type="button" class="btn black mr5" onclick="javascript:goBoardReply();">답글쓰기</button> | |
237 | + <button type="button" id="btn_list" class="btn black mr5" onclick="javascript:goBoardList();">목록으로</button> | |
238 | + <button type="button" id="btn_update" class="btn black mr5" onclick="javascript:goBoardUpdate();">수정하기</button> | |
239 | + <button type="button" id="btn_delete" class="btn black" onclick="javascript:deleteBoard();">삭제하기</button> | |
240 | + <button type="button" id="btn_reply" class="btn black mr5" onclick="javascript:goBoardReply();">답글쓰기</button> | |
225 | 241 | </div> |
226 | 242 | </div> |
227 | 243 | </div> | ... | ... |
src/main/resources/templates/page/boardUpdate.html
... | ... | @@ -62,6 +62,10 @@ |
62 | 62 | var boardSubject = obj.board_subject; |
63 | 63 | var boardContent = obj.board_content; |
64 | 64 | var boardHits = obj.board_hits; |
65 | + var boardProcStatus = obj.proc_status; | |
66 | + var boardProcDesc = obj.proc_desc; | |
67 | + var boardProcDate = obj.proc_date; | |
68 | + var boardProcUser = obj.proc_user; | |
65 | 69 | var delYn = obj.del_yn; |
66 | 70 | var insUserId = obj.ins_user_id; |
67 | 71 | var insDate = obj.ins_date; |
... | ... | @@ -69,10 +73,26 @@ |
69 | 73 | var updDate = obj.upd_date; |
70 | 74 | var files = obj.files; |
71 | 75 | var filesLen = files.length; |
76 | + var current_user = obj.current_user; | |
72 | 77 | |
73 | 78 | $("#board_subject").val(boardSubject); |
74 | 79 | $("#board_content").val(boardContent); |
75 | 80 | $("#board_writer").text(boardWriter); |
81 | + $("#proc_desc").val(boardProcDesc); | |
82 | + $("#proc_status").val(boardProcStatus); | |
83 | + | |
84 | + if (current_user != boardWriter) { | |
85 | + $("#board_subject").attr("readonly",true); | |
86 | + $("#board_content").attr("readonly",true); | |
87 | + $("#btn_update").html("진행처리"); | |
88 | + } else { | |
89 | + if (boardProcStatus == "처리중" || boardProcStatus == "처리완료" ) { | |
90 | + $("#btn_update").hide(); | |
91 | + } else { | |
92 | + $("#tr_proc_desc").hide(); | |
93 | + $("#tr_proc_status").hide(); | |
94 | + } | |
95 | + } | |
76 | 96 | |
77 | 97 | var fileStr = ""; |
78 | 98 | |
... | ... | @@ -212,6 +232,21 @@ |
212 | 232 | <th>첨부파일</th> |
213 | 233 | <td colspan="3" id="file_td"><input type="file" id="files[0]" name="files[0]" value=""></td> |
214 | 234 | </tr> |
235 | + <tr id="tr_proc_desc"> | |
236 | + <th>처리내용<span class="t_red">*</span></th> | |
237 | + <td colspan="3"><textarea id="proc_desc" name="proc_desc" cols="50" rows="5" class="textarea01"></textarea></td> | |
238 | + </tr> | |
239 | + <tr id="tr_proc_status"> | |
240 | + <th>처리상태<span class="t_red">*</span></th> | |
241 | + <td colspan="3"> | |
242 | + <select id="proc_status" name="proc_status"class="selbox"> | |
243 | + <option value=""></option> | |
244 | + <option value="미처리">미처리</option> | |
245 | + <option value="처리중">처리중</option> | |
246 | + <option value="처리완료">처리완료</option> | |
247 | + </select> | |
248 | + </td> | |
249 | + </tr> | |
215 | 250 | </tbody> |
216 | 251 | </table> |
217 | 252 | <input type="hidden" id="board_seq" name="board_seq" th:value="${#request.getParameter('boardSeq')}"/> <!-- 게시글 번호 --> |
... | ... | @@ -220,7 +255,7 @@ |
220 | 255 | </form> |
221 | 256 | <div class="btn_right mt15"> |
222 | 257 | <button type="button" class="btn black mr5" onclick="javascript:goBoardList();">목록으로</button> |
223 | - <button type="button" class="btn black" onclick="javascript:updateBoard();">수정하기</button> | |
258 | + <button type="button" id="btn_update" class="btn black" onclick="javascript:updateBoard();">수정하기</button> | |
224 | 259 | </div> |
225 | 260 | </div> |
226 | 261 | </div> | ... | ... |