Commit 6f22ff1b3b6b85d3f0db4f59115637d3a13a9ba9

Authored by sangkiham
1 parent d434ebaa

.

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