게시판 이름 변경
This commit is contained in:
parent
684b608e2f
commit
66192ca727
@ -14,8 +14,10 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.company.localhost.common.annotation.ReqMap;
|
||||
import io.company.localhost.common.dto.ApiResponse;
|
||||
import io.company.localhost.service.BoardService;
|
||||
import io.company.localhost.common.dto.MapDto;
|
||||
import io.company.localhost.service.LocalBordService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@ -24,7 +26,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
@RequiredArgsConstructor
|
||||
@Slf4j
|
||||
public class BoardController {
|
||||
private final BoardService boardService;
|
||||
private final LocalBordService boardService;
|
||||
|
||||
//공지사항
|
||||
@GetMapping("/notices")
|
||||
@ -34,41 +36,43 @@ public class BoardController {
|
||||
//비밀,자유게시판
|
||||
@GetMapping("/general")
|
||||
public ApiResponse<List<Map<String, Object>>> getGeneralPosts() {
|
||||
return ApiResponse.ok(boardService.getGeneralPosts());
|
||||
List<Map<String, Object>> posts = boardService.getGeneralPosts();
|
||||
System.out.println(posts);
|
||||
return ApiResponse.ok(posts);
|
||||
}
|
||||
//게시물 작성
|
||||
@PostMapping
|
||||
public ApiResponse<String> createBoard(@RequestBody Map<String, Object> params) {
|
||||
boardService.createBoard(params);
|
||||
public ApiResponse<String> createBoard(@ReqMap MapDto map) {
|
||||
boardService.createBoard(map);
|
||||
return ApiResponse.ok("게시물이 작성되었습니다.");
|
||||
}
|
||||
// 첨부파일 추가
|
||||
@PostMapping("/{boardId}/attachments")
|
||||
public ApiResponse<String> uploadAttachment(@PathVariable Long boardId, @RequestBody Map<String, Object> params) {
|
||||
params.put("LOCBRDSEQ", boardId);
|
||||
public ApiResponse<String> uploadAttachment(@PathVariable Long boardId, @ReqMap MapDto map) {
|
||||
map.put("LOCBRDSEQ", boardId);
|
||||
log.info("Uploading attachment for board ID: {}", boardId);
|
||||
boardService.addAttachment(params);
|
||||
boardService.addAttachment(map);
|
||||
return ApiResponse.ok("첨부파일이 저장되었습니다.");
|
||||
}
|
||||
// 게시물 삭제
|
||||
@DeleteMapping("/{boardId}")
|
||||
public ApiResponse<String> deleteBoard(@PathVariable Long boardId, @RequestBody Map<String, Object> params) {
|
||||
params.put("LOCBRDSEQ", boardId);
|
||||
public ApiResponse<String> deleteBoard(@PathVariable Long boardId, @ReqMap MapDto map) {
|
||||
map.put("LOCBRDSEQ", boardId);
|
||||
log.info("Deleting board with ID: {}", boardId);
|
||||
boardService.deleteBoard(params);
|
||||
boardService.deleteBoard(map);
|
||||
return ApiResponse.ok("게시물이 삭제되었습니다.");
|
||||
}
|
||||
//게시물 수정
|
||||
@PutMapping
|
||||
public ApiResponse<String> updateBoard(@RequestBody Map<String, Object> params) {
|
||||
boardService.updateBoard(params);
|
||||
public ApiResponse<String> updateBoard(@ReqMap MapDto map) {
|
||||
boardService.updateBoard(map);
|
||||
return ApiResponse.ok("게시물이 수정되었습니다.");
|
||||
}
|
||||
//게시물과 댓글에 좋아요/싫어요 추가
|
||||
@PostMapping("/{boardId}/reaction")
|
||||
public ApiResponse<String> reactToBoard(@PathVariable Long boardId, @RequestBody Map<String, Object> params) {
|
||||
params.put("LOCBRDSEQ", boardId);
|
||||
boardService.reactToBoard(params);
|
||||
public ApiResponse<String> reactToBoard(@PathVariable Long boardId, @ReqMap MapDto map) {
|
||||
map.put("LOCBRDSEQ", boardId);
|
||||
boardService.reactToBoard(map);
|
||||
return ApiResponse.ok("반응이 추가되었습니다.");
|
||||
}
|
||||
//댓글/대댓글 조회
|
||||
@ -78,36 +82,36 @@ public class BoardController {
|
||||
}
|
||||
//댓글/대댓글 작성
|
||||
@PostMapping("/{boardId}/comment")
|
||||
public ApiResponse<String> addCommentOrReply(@PathVariable int boardId, @RequestBody Map<String, Object> params) {
|
||||
params.put("LOCBRDSEQ", boardId);
|
||||
boardService.addCommentOrReply(params);
|
||||
public ApiResponse<String> addCommentOrReply(@PathVariable int boardId, @ReqMap MapDto map) {
|
||||
map.put("LOCBRDSEQ", boardId);
|
||||
boardService.addCommentOrReply(map);
|
||||
return ApiResponse.ok("댓글 또는 대댓글이 작성되었습니다.");
|
||||
}
|
||||
//댓글/대댓글 수정
|
||||
@PutMapping("/comment/{commentId}")
|
||||
public ApiResponse<String> updateComment(@PathVariable int commentId, @RequestBody Map<String, Object> params) {
|
||||
params.put("LOCCMTSEQ", commentId);
|
||||
boardService.updateComment(params);
|
||||
public ApiResponse<String> updateComment(@PathVariable int commentId, @ReqMap MapDto map) {
|
||||
map.put("LOCCMTSEQ", commentId);
|
||||
boardService.updateComment(map);
|
||||
return ApiResponse.ok("댓글이 수정되었습니다.");
|
||||
}
|
||||
//댓글/대댓글 삭제
|
||||
@DeleteMapping("/comment/{commentId}")
|
||||
public ApiResponse<String> deleteComment(@PathVariable int commentId, @RequestBody Map<String, Object> params) {
|
||||
params.put("LOCCMTSEQ", commentId);
|
||||
boardService.deleteComment(params);
|
||||
public ApiResponse<String> deleteComment(@PathVariable int commentId, @ReqMap MapDto map) {
|
||||
map.put("LOCCMTSEQ", commentId);
|
||||
boardService.deleteComment(map);
|
||||
return ApiResponse.ok("댓글이 삭제되었습니다.");
|
||||
}
|
||||
//비밀번호 확인 (게시물)
|
||||
@PostMapping("/comment/{commentId}/password")
|
||||
public ApiResponse<Boolean> checkCommentPassword(@PathVariable int commentId, @RequestBody Map<String, Object> params) {
|
||||
params.put("LOCCMTSEQ", commentId);
|
||||
return ApiResponse.ok(boardService.checkCommentPassword(params));
|
||||
public ApiResponse<Boolean> checkCommentPassword(@PathVariable int commentId, @ReqMap MapDto map) {
|
||||
map.put("LOCCMTSEQ", commentId);
|
||||
return ApiResponse.ok(boardService.checkCommentPassword(map));
|
||||
}
|
||||
//비밀번호 확인 (댓글)
|
||||
@PostMapping("/{boardId}/password")
|
||||
public ApiResponse<Boolean> checkBoardPassword(@PathVariable int boardId, @RequestBody Map<String, Object> params) {
|
||||
params.put("LOCBRDSEQ", boardId);
|
||||
return ApiResponse.ok(boardService.checkBoardPassword(params));
|
||||
public ApiResponse<Boolean> checkBoardPassword(@PathVariable int boardId, @ReqMap MapDto map) {
|
||||
map.put("LOCBRDSEQ", boardId);
|
||||
return ApiResponse.ok(boardService.checkBoardPassword(map));
|
||||
}
|
||||
// 비밀게시판 여부 확인
|
||||
@GetMapping("/{boardId}/isSecret")
|
||||
|
||||
@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
@Mapper
|
||||
public interface BoardMapper {
|
||||
public interface LocalBordMapper {
|
||||
// 공지사항 조회
|
||||
List<Map<String, Object>> getNotices();
|
||||
|
||||
@ -5,13 +5,13 @@ import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import io.company.localhost.mapper.BoardMapper;
|
||||
import io.company.localhost.mapper.LocalBordMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BoardService {
|
||||
private final BoardMapper boardMapper;
|
||||
public class LocalBordService {
|
||||
private final LocalBordMapper boardMapper;
|
||||
|
||||
public List<Map<String, Object>> getNotices() {
|
||||
return boardMapper.getNotices();
|
||||
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="io.company.localhost.mapper.BoardMapper">
|
||||
<mapper namespace="io.company.localhost.mapper.localBordMapper">
|
||||
|
||||
<!-- 공지사항 조회 -->
|
||||
<select id="getNotices" resultType="java.util.Map">
|
||||
Loading…
Reference in New Issue
Block a user