게시판
This commit is contained in:
parent
5a1e5a1f33
commit
b64f203a93
@ -37,7 +37,19 @@ public class BoardController {
|
|||||||
//공지사항
|
//공지사항
|
||||||
@GetMapping("/notices")
|
@GetMapping("/notices")
|
||||||
public ApiResponse<List<MapDto>> getNotices() {
|
public ApiResponse<List<MapDto>> getNotices() {
|
||||||
return ApiResponse.ok(boardService.getNotices());
|
List<MapDto> posts = boardService.getNotices();
|
||||||
|
for (Map<String, Object> post : posts) {
|
||||||
|
Object content = post.get("content");
|
||||||
|
if (content instanceof Blob) {
|
||||||
|
Blob blob = (Blob) content;
|
||||||
|
try {
|
||||||
|
post.put("content", new String(blob.getBytes(1, (int) blob.length()), StandardCharsets.UTF_8));
|
||||||
|
} catch (Exception e) {
|
||||||
|
post.put("content", ""); // 변환 실패 시 기본 값 설정
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return ApiResponse.ok(posts);
|
||||||
}
|
}
|
||||||
//비밀,자유게시판
|
//비밀,자유게시판
|
||||||
@GetMapping("/general")
|
@GetMapping("/general")
|
||||||
@ -68,14 +80,14 @@ public class BoardController {
|
|||||||
// 첨부파일 추가
|
// 첨부파일 추가
|
||||||
@PostMapping("/{boardId}/attachments")
|
@PostMapping("/{boardId}/attachments")
|
||||||
public ApiResponse<String> uploadAttachment(
|
public ApiResponse<String> uploadAttachment(
|
||||||
@PathVariable("boardId") Long boardId,
|
@PathVariable("boardId") Long boardId,
|
||||||
@RequestParam(name = "file") MultipartFile file,
|
@RequestParam("file") MultipartFile file,
|
||||||
@RequestParam(name = "CMNFLEPAT") String filePath,
|
@RequestParam("CMNFLEPAT") String filePath,
|
||||||
@RequestParam(name = "CMNFLEORG") String originalFileName,
|
@RequestParam("CMNFLEORG") String originalFileName,
|
||||||
@RequestParam(name = "CMNFLEEXT") String fileExtension,
|
@RequestParam("CMNFLEEXT") String fileExtension,
|
||||||
@RequestParam(name = "CMNFLESIZ") Long fileSize,
|
@RequestParam("CMNFLESIZ") Long fileSize,
|
||||||
@RequestParam(name = "CMNFLEREG") Long registrantId,
|
@RequestParam("CMNFLEREG") Long registrantId,
|
||||||
@RequestParam(name = "CMNFLENAM") String fileName
|
@RequestParam("CMNFLENAM") String fileName
|
||||||
) {
|
) {
|
||||||
// 데이터 준비
|
// 데이터 준비
|
||||||
MapDto fileData = new MapDto();
|
MapDto fileData = new MapDto();
|
||||||
@ -95,10 +107,9 @@ public class BoardController {
|
|||||||
|
|
||||||
return ApiResponse.ok("첨부파일이 저장되었습니다.");
|
return ApiResponse.ok("첨부파일이 저장되었습니다.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 게시물 상세보기
|
// 게시물 상세보기
|
||||||
@GetMapping("/{boardId}")
|
@GetMapping("/{boardId}")
|
||||||
public ApiResponse<Map<String, Object>> getBoardDetail(@PathVariable Long boardId) {
|
public ApiResponse<Map<String, Object>> getBoardDetail(@PathVariable("boardId") Long boardId) {
|
||||||
log.info("Fetching details for board ID: {}", boardId);
|
log.info("Fetching details for board ID: {}", boardId);
|
||||||
|
|
||||||
// 게시물 상세정보 조회
|
// 게시물 상세정보 조회
|
||||||
@ -118,8 +129,6 @@ public class BoardController {
|
|||||||
|
|
||||||
return ApiResponse.ok(result);
|
return ApiResponse.ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// 게시물 삭제
|
// 게시물 삭제
|
||||||
@DeleteMapping("/{boardId}")
|
@DeleteMapping("/{boardId}")
|
||||||
public ApiResponse<String> deleteBoard(@PathVariable Long boardId, @ReqMap MapDto map) {
|
public ApiResponse<String> deleteBoard(@PathVariable Long boardId, @ReqMap MapDto map) {
|
||||||
@ -179,7 +188,7 @@ public class BoardController {
|
|||||||
map.put("LOCBRDSEQ", boardId);
|
map.put("LOCBRDSEQ", boardId);
|
||||||
return ApiResponse.ok(boardService.checkBoardPassword(map));
|
return ApiResponse.ok(boardService.checkBoardPassword(map));
|
||||||
}
|
}
|
||||||
// 비밀게시판 여부 확인
|
// 비밀게시판 여부 확인
|
||||||
@GetMapping("/{boardId}/isSecret")
|
@GetMapping("/{boardId}/isSecret")
|
||||||
public ApiResponse<Boolean> isSecretBoard(@PathVariable Long boardId) {
|
public ApiResponse<Boolean> isSecretBoard(@PathVariable Long boardId) {
|
||||||
log.info("Checking if board ID {} is secret", boardId);
|
log.info("Checking if board ID {} is secret", boardId);
|
||||||
|
|||||||
@ -3,20 +3,19 @@
|
|||||||
<mapper namespace="io.company.localhost.mapper.LocalBordMapper">
|
<mapper namespace="io.company.localhost.mapper.LocalBordMapper">
|
||||||
|
|
||||||
<!-- 공지사항 조회 -->
|
<!-- 공지사항 조회 -->
|
||||||
<select id="getNotices" resultType="java.util.Map">
|
<select id="getNotices" resultType="hashmap">
|
||||||
SELECT
|
SELECT
|
||||||
LOCBRDSEQ,
|
LOCBRDSEQ AS id,
|
||||||
LOCBRDTTL,
|
LOCBRDTTL AS title,
|
||||||
LOCBRDCON,
|
LOCBRDCON AS content,
|
||||||
LOCBRDRDT,
|
LOCBRDRDT AS date
|
||||||
LOCBRDTYP,
|
|
||||||
FROM localbord
|
FROM localbord
|
||||||
WHERE b.LOCBRDTYP = 'N'
|
WHERE b.LOCBRDTYP = 'N'
|
||||||
ORDER BY b.LOCBRDRDT DESC
|
ORDER BY b.LOCBRDRDT DESC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<!-- 자유/비밀 게시판 조회 -->
|
<!-- 자유/비밀 게시판 조회 -->
|
||||||
<select id="getGeneralPosts" resultType="map">
|
<select id="getGeneralPosts" resultType="io.company.localhost.common.dto.MapDto">
|
||||||
SELECT
|
SELECT
|
||||||
LOCBRDSEQ AS id,
|
LOCBRDSEQ AS id,
|
||||||
LOCBRDTTL AS title,
|
LOCBRDTTL AS title,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user