Merge branch 'main' into yoon
This commit is contained in:
commit
b8bee16816
@ -34,6 +34,7 @@ public class MapBasedUrlRoleMapper implements UrlRoleMapper{
|
||||
urlRoleMappings.put("/api/board/**", PERMIT_ALL);
|
||||
urlRoleMappings.put("/api/vote/**", PERMIT_ALL);
|
||||
urlRoleMappings.put("/api/worddict/**", PERMIT_ALL);
|
||||
urlRoleMappings.put("/api/quilleditor/**", PERMIT_ALL);
|
||||
return new HashMap<>(urlRoleMappings);
|
||||
}
|
||||
}
|
||||
@ -55,7 +55,7 @@ public class BoardController {
|
||||
@ParameterCheck
|
||||
@GetMapping("/notices")
|
||||
public ApiResponse<List<MapDto>> getNotices(@ReqMap MapDto map) {
|
||||
return ApiResponse.ok(boardService.getNotices(map));
|
||||
return ApiResponse.ok(boardService.selectNotices(map));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -67,7 +67,7 @@ public class BoardController {
|
||||
@ParameterCheck
|
||||
@GetMapping("/general")
|
||||
public ApiResponse<PageInfo<MapDto>> getGeneralPosts(@ReqMap MapDto map) {
|
||||
return ApiResponse.ok(boardService.getGeneralPosts(map));
|
||||
return ApiResponse.ok(boardService.selectGeneralPosts(map));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -89,7 +89,7 @@ public class BoardController {
|
||||
map.put("LOCBRDPWD", hashedPassword);
|
||||
}
|
||||
|
||||
return ApiResponse.ok(boardService.createBoard(map));
|
||||
return ApiResponse.ok(boardService.insertBoard(map));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -101,7 +101,7 @@ public class BoardController {
|
||||
@ParameterCheck
|
||||
@GetMapping("/{boardId}")
|
||||
public ApiResponse<MapDto> getBoardDetail(@PathVariable("boardId") Long boardId) {
|
||||
MapDto board = boardService.getBoardDetail(boardId);
|
||||
MapDto board = boardService.selectBoardDetail(boardId);
|
||||
if (board == null) {
|
||||
throw new NotFoundHandler("게시물 ID " + boardId + "을(를) 찾을 수 없습니다.");
|
||||
}
|
||||
@ -145,7 +145,7 @@ public class BoardController {
|
||||
public ApiResponse<String> uploadAttachment(@ReqMap MapDto map) {
|
||||
Long userId = AuthUtil.getUser().getId();
|
||||
map.put("CMNFLEREG", userId);
|
||||
boardService.addAttachment(map);
|
||||
boardService.insertAttachment(map);
|
||||
return ApiResponse.ok("첨부파일이 저장되었습니다.");
|
||||
}
|
||||
|
||||
@ -160,7 +160,7 @@ public class BoardController {
|
||||
public ApiResponse<String> reactToBoard(@ReqMap MapDto map) {
|
||||
Long userId = AuthUtil.getUser().getId();
|
||||
map.put("MEMBERSEQ", userId);
|
||||
boardService.reactToBoard(map);
|
||||
boardService.procReactToBoard(map);
|
||||
return ApiResponse.ok("반응이 성공적으로 처리되었습니다.");
|
||||
}
|
||||
|
||||
@ -173,7 +173,7 @@ public class BoardController {
|
||||
@ParameterCheck
|
||||
@GetMapping("/{boardId}/comments")
|
||||
public ApiResponse<PageInfo<MapDto>> getComments(@ReqMap MapDto map) {
|
||||
return ApiResponse.ok(boardService.getComments(map));
|
||||
return ApiResponse.ok(boardService.selectComments(map));
|
||||
}
|
||||
|
||||
/**
|
||||
@ -194,7 +194,7 @@ public class BoardController {
|
||||
String hashedPassword = passwordEncoder.encode(rawPassword);
|
||||
map.put("LOCCMTPWD", hashedPassword);
|
||||
}
|
||||
boardService.addCommentOrReply(map);
|
||||
boardService.insertCommentOrReply(map);
|
||||
return ApiResponse.ok("댓글 또는 대댓글이 작성되었습니다.");
|
||||
}
|
||||
|
||||
@ -246,7 +246,7 @@ public class BoardController {
|
||||
|
||||
String rawPassword = map.getString("LOCBRDPWD");
|
||||
|
||||
String storedHashedPassword = boardService.getBoardPassword(boardId);
|
||||
String storedHashedPassword = boardService.selectBoardPassword(boardId);
|
||||
if (storedHashedPassword == null) {
|
||||
throw new NotFoundHandler("해당 게시물이 존재하지 않습니다.");
|
||||
}
|
||||
@ -279,7 +279,7 @@ public class BoardController {
|
||||
}
|
||||
String rawPassword = map.getString("LOCCMTPWD");
|
||||
|
||||
String storedHashedPassword = boardService.getCommentPassword(commentId);
|
||||
String storedHashedPassword = boardService.selectCommentPassword(commentId);
|
||||
if (storedHashedPassword == null) {
|
||||
throw new NotFoundHandler("해당 댓글이 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
@ -49,7 +50,7 @@ public class ImageUploadController {
|
||||
*/
|
||||
@ParameterCheck
|
||||
@PostMapping("/upload")
|
||||
public ApiResponse<String> uploadImage(@ReqMap MultipartFile file) throws IOException {
|
||||
public ApiResponse<String> uploadImage(@RequestParam("file") MultipartFile file) throws IOException {
|
||||
|
||||
if (file.isEmpty()) {
|
||||
return ApiResponse.error(HttpStatus.BAD_REQUEST, "File is empty");
|
||||
|
||||
@ -11,19 +11,19 @@ import io.company.localhost.common.dto.MapDto;
|
||||
@Mapper
|
||||
public interface localbordMapper {
|
||||
// 공지사항 조회
|
||||
List<MapDto> getNotices(MapDto map);
|
||||
List<MapDto> selectNotices(MapDto map);
|
||||
|
||||
// 자유/비밀 게시판 조회
|
||||
List<MapDto> getGeneralPosts(MapDto map);
|
||||
List<MapDto> selectGeneralPosts(MapDto map);
|
||||
|
||||
// 조회수 증가
|
||||
void incrementViewCount(Long boardId);
|
||||
void updateIncrementViewCount(Long boardId);
|
||||
|
||||
// 게시물 작성
|
||||
void createBoard(MapDto map);
|
||||
void insertBoard(MapDto map);
|
||||
|
||||
// 첨부파일 저장
|
||||
void addAttachment(MapDto map);
|
||||
void insertAttachment(MapDto map);
|
||||
|
||||
// 게시물 삭제
|
||||
void deleteBoard(MapDto map);
|
||||
@ -35,7 +35,7 @@ public interface localbordMapper {
|
||||
void updateBoard(MapDto map);
|
||||
|
||||
// 기존 반응 조회
|
||||
MapDto findReaction(MapDto map);
|
||||
MapDto selectReaction(MapDto map);
|
||||
|
||||
// 새 반응 삽입
|
||||
void insertReaction(MapDto map);
|
||||
@ -43,23 +43,23 @@ public interface localbordMapper {
|
||||
// 기존 반응 업데이트
|
||||
void updateReaction(MapDto map);
|
||||
|
||||
// 댓글 조회
|
||||
List<MapDto> getComments(MapDto map);
|
||||
// 댓글/대댓글 조회
|
||||
List<MapDto> selectComments(MapDto map);
|
||||
|
||||
// 댓글/대댓글 작성
|
||||
void addCommentOrReply(MapDto map);
|
||||
void insertCommentOrReply(MapDto map);
|
||||
|
||||
// 댓글/대댓글 수정
|
||||
void updateComment(MapDto map);
|
||||
|
||||
// 대댓글인지 확인
|
||||
boolean isReply(MapDto map);
|
||||
boolean selectIsReply(MapDto map);
|
||||
|
||||
// 댓글에 대댓글이 있는지 확인
|
||||
boolean hasReplies(MapDto map);
|
||||
boolean selectHasReplies(MapDto map);
|
||||
|
||||
// 댓글 내용만 삭제 처리 (대댓글 유지)
|
||||
void softDeleteComment(MapDto map);
|
||||
void updateSoftDeleteComment(MapDto map);
|
||||
|
||||
// 댓글 삭제 (대댓글 없음)
|
||||
void deleteComment(MapDto map);
|
||||
@ -67,32 +67,32 @@ public interface localbordMapper {
|
||||
// 대댓글 삭제
|
||||
void deleteReply(MapDto map);
|
||||
|
||||
// 게시물 비밀번호 조회
|
||||
// 댓글 비밀번호 조회
|
||||
String selectCommentPassword(int commentId);
|
||||
|
||||
// 댓글 비밀번호 조회
|
||||
// 게시물 비밀번호 조회
|
||||
String selectBoardPassword(int boardId);
|
||||
|
||||
// 게시물 상세보기
|
||||
MapDto selectBoardDetail(Long boardId);
|
||||
|
||||
// 댓글 갯수
|
||||
int countComments(Long boardId);
|
||||
int selectCountComments(Long boardId);
|
||||
|
||||
// 첨부파일 유무
|
||||
int countAttachments(Long boardId);
|
||||
int selectIsAttachments(Long boardId);
|
||||
|
||||
// 게시물 좋아요/싫어요 개수
|
||||
MapDto getBoardReactions(Long boardId);
|
||||
MapDto selectCountBoardReactions(Long boardId);
|
||||
|
||||
// 댓글 좋아요/싫어요 개수
|
||||
List<MapDto> getCommentReactions(Long boardId);
|
||||
List<MapDto> selectCountCommentReactions(Long boardId);
|
||||
|
||||
// 첨부파일 가져오기
|
||||
List<MapDto> selectAttachments(Long boardId);
|
||||
|
||||
//댓글id 확인
|
||||
MapDto getCommentById(int commentId);
|
||||
MapDto selectCommentById(int commentId);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -25,13 +25,13 @@ public class localbordService {
|
||||
private final localbordMapper boardMapper;
|
||||
private static final long MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
|
||||
|
||||
public List<MapDto> getNotices(MapDto map) {
|
||||
List<MapDto> posts = boardMapper.getNotices(map);
|
||||
public List<MapDto> selectNotices(MapDto map) {
|
||||
List<MapDto> posts = boardMapper.selectNotices(map);
|
||||
enrichPostsWithAdditionalData(posts);
|
||||
return posts;
|
||||
}
|
||||
|
||||
public PageInfo<MapDto> getGeneralPosts(MapDto map) {
|
||||
public PageInfo<MapDto> selectGeneralPosts(MapDto map) {
|
||||
System.out.println(map);
|
||||
int page = map.getString("page") != null ? Integer.parseInt(map.getString("page")) : 1;
|
||||
int size = map.getString("size") != null ? Integer.parseInt(map.getString("size")) : 10;
|
||||
@ -43,22 +43,22 @@ public class localbordService {
|
||||
|
||||
PageHelper.startPage(page, size);
|
||||
|
||||
List<MapDto> result = boardMapper.getGeneralPosts(map);
|
||||
List<MapDto> result = boardMapper.selectGeneralPosts(map);
|
||||
enrichPostsWithAdditionalData(result);
|
||||
|
||||
return PageUtil.redefineNavigation(new PageInfo<>(result, size));
|
||||
}
|
||||
|
||||
public void incrementViewCount(Long boardId) {
|
||||
boardMapper.incrementViewCount(boardId);
|
||||
public void updateIncrementViewCount(Long boardId) {
|
||||
boardMapper.updateIncrementViewCount(boardId);
|
||||
}
|
||||
|
||||
public BigInteger createBoard(MapDto map) {
|
||||
boardMapper.createBoard(map);
|
||||
public BigInteger insertBoard(MapDto map) {
|
||||
boardMapper.insertBoard(map);
|
||||
return (BigInteger) map.get("LOCBRDSEQ");
|
||||
}
|
||||
|
||||
public void addAttachment(MapDto map) {
|
||||
public void insertAttachment(MapDto map) {
|
||||
String boardSeqStr = (String) map.get("CMNBRDSEQ");
|
||||
Long boardSeq = Long.parseLong(boardSeqStr);
|
||||
map.put("CMNBRDSEQ", boardSeq);
|
||||
@ -66,7 +66,7 @@ public class localbordService {
|
||||
String newFilename = UUID.randomUUID().toString();
|
||||
map.put("CMNFLENAM", newFilename);
|
||||
|
||||
boardMapper.addAttachment(map);
|
||||
boardMapper.insertAttachment(map);
|
||||
}
|
||||
|
||||
public void validateAttachmentsSize(List<MapDto> attachments) {
|
||||
@ -79,15 +79,15 @@ public class localbordService {
|
||||
}
|
||||
}
|
||||
|
||||
public MapDto getBoardDetail(Long boardId) {
|
||||
incrementViewCount(boardId);
|
||||
public MapDto selectBoardDetail(Long boardId) {
|
||||
updateIncrementViewCount(boardId);
|
||||
MapDto boardDetail = boardMapper.selectBoardDetail(boardId);
|
||||
enrichBoardDetail(boardDetail);
|
||||
|
||||
return boardDetail;
|
||||
}
|
||||
|
||||
public List<MapDto> getAttachments(Long boardId) {
|
||||
public List<MapDto> selectAttachments(Long boardId) {
|
||||
return boardMapper.selectAttachments(boardId);
|
||||
}
|
||||
|
||||
@ -100,8 +100,8 @@ public class localbordService {
|
||||
boardMapper.updateBoard(map);
|
||||
}
|
||||
|
||||
public void reactToBoard(MapDto map) {
|
||||
MapDto existingReaction = boardMapper.findReaction(map);
|
||||
public void procReactToBoard(MapDto map) {
|
||||
MapDto existingReaction = boardMapper.selectReaction(map);
|
||||
|
||||
if (existingReaction != null) {
|
||||
boardMapper.updateReaction(map);
|
||||
@ -110,21 +110,21 @@ public class localbordService {
|
||||
}
|
||||
}
|
||||
|
||||
public PageInfo<MapDto> getComments(MapDto map) {
|
||||
public PageInfo<MapDto> selectComments(MapDto map) {
|
||||
int page = map.getString("page") != null ? Integer.parseInt(map.getString("page")) : 1;
|
||||
int size = map.getString("size") != null ? Integer.parseInt(map.getString("size")) : 10;
|
||||
PageHelper.startPage(page, size);
|
||||
|
||||
List<MapDto> result = boardMapper.getComments(map);
|
||||
List<MapDto> result = boardMapper.selectComments(map);
|
||||
|
||||
return PageUtil.redefineNavigation(new PageInfo<>(result, size));
|
||||
}
|
||||
|
||||
public void addCommentOrReply(MapDto map) {
|
||||
public void insertCommentOrReply(MapDto map) {
|
||||
if (map.get("LOCCMTPNT") == null) {
|
||||
map.put("LOCCMTPNT", null);
|
||||
}
|
||||
boardMapper.addCommentOrReply(map);
|
||||
boardMapper.insertCommentOrReply(map);
|
||||
}
|
||||
|
||||
public void updateComment(MapDto map) {
|
||||
@ -132,51 +132,51 @@ public class localbordService {
|
||||
}
|
||||
|
||||
public void deleteComment(MapDto map) {
|
||||
boolean isReply = boardMapper.isReply(map);
|
||||
boolean isReply = boardMapper.selectIsReply(map);
|
||||
|
||||
if (isReply) {
|
||||
boardMapper.deleteReply(map);
|
||||
} else {
|
||||
boolean hasReplies = boardMapper.hasReplies(map);
|
||||
boolean hasReplies = boardMapper.selectHasReplies(map);
|
||||
|
||||
if (hasReplies) {
|
||||
boardMapper.softDeleteComment(map);
|
||||
boardMapper.updateSoftDeleteComment(map);
|
||||
} else {
|
||||
boardMapper.deleteComment(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public String getCommentPassword(int commentId) {
|
||||
public String selectCommentPassword(int commentId) {
|
||||
return boardMapper.selectCommentPassword(commentId);
|
||||
}
|
||||
|
||||
public String getBoardPassword(int boardId) {
|
||||
public String selectBoardPassword(int boardId) {
|
||||
return boardMapper.selectBoardPassword(boardId);
|
||||
}
|
||||
|
||||
public MapDto getCommentById(int commentId) {
|
||||
return boardMapper.getCommentById(commentId);
|
||||
public MapDto selectCommentById(int commentId) {
|
||||
return boardMapper.selectCommentById(commentId);
|
||||
}
|
||||
|
||||
public int getCommentCount(Long boardId) {
|
||||
return boardMapper.countComments(boardId);
|
||||
public int selectCountComments(Long boardId) {
|
||||
return boardMapper.selectCountComments(boardId);
|
||||
}
|
||||
|
||||
public boolean hasAttachments(Long boardId) {
|
||||
int count = boardMapper.countAttachments(boardId);
|
||||
public boolean selectIsAttachments(Long boardId) {
|
||||
int count = boardMapper.selectIsAttachments(boardId);
|
||||
return count > 0;
|
||||
}
|
||||
|
||||
public MapDto getBoardReactions(Long boardId) {
|
||||
return boardMapper.getBoardReactions(boardId);
|
||||
public MapDto selectCountBoardReactions(Long boardId) {
|
||||
return boardMapper.selectCountBoardReactions(boardId);
|
||||
}
|
||||
|
||||
public List<MapDto> getCommentReactions(Long boardId) {
|
||||
return boardMapper.getCommentReactions(boardId);
|
||||
public List<MapDto> selectCountCommentReactions(Long boardId) {
|
||||
return boardMapper.selectCountCommentReactions(boardId);
|
||||
}
|
||||
|
||||
private String convertBlobToString(Object blob) {
|
||||
private String procBlobToString(Object blob) {
|
||||
try {
|
||||
if (blob instanceof String) {
|
||||
return (String) blob; // 이미 문자열이면 그대로 반환
|
||||
@ -194,10 +194,10 @@ public class localbordService {
|
||||
}
|
||||
|
||||
|
||||
private String extractFirstImageUrl(String jsonContent) {
|
||||
private String procFirstImageUrl(String jsonContent) {
|
||||
try {
|
||||
// JSON 유효성 검사
|
||||
if (!isValidJson(jsonContent)) {
|
||||
if (!procIsValidJson(jsonContent)) {
|
||||
throw new IllegalArgumentException("Invalid JSON content: " + jsonContent);
|
||||
}
|
||||
|
||||
@ -218,7 +218,7 @@ public class localbordService {
|
||||
return null; // 이미지가 없는 경우
|
||||
}
|
||||
|
||||
private boolean isValidJson(String json) {
|
||||
private boolean procIsValidJson(String json) {
|
||||
try {
|
||||
final ObjectMapper objectMapper = new ObjectMapper();
|
||||
objectMapper.readTree(json); // JSON 파싱 시도
|
||||
@ -228,7 +228,7 @@ public class localbordService {
|
||||
}
|
||||
}
|
||||
|
||||
private String extractPlainTextFromJson(String jsonContent) {
|
||||
private String procPlainTextFromJson(String jsonContent) {
|
||||
StringBuilder plainTextBuilder = new StringBuilder();
|
||||
try {
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
@ -263,16 +263,16 @@ public class localbordService {
|
||||
|
||||
private void enrichBoardDetail(MapDto boardDetail) {
|
||||
long boardId = ((Number) boardDetail.get("id")).longValue();
|
||||
boardDetail.put("hasAttachment", hasAttachments(boardId));
|
||||
boardDetail.put("commentCount", getCommentCount(boardId));
|
||||
MapDto reactions = getBoardReactions(boardId);
|
||||
boardDetail.put("hasAttachment", selectIsAttachments(boardId));
|
||||
boardDetail.put("commentCount", selectCountComments(boardId));
|
||||
MapDto reactions = selectCountBoardReactions(boardId);
|
||||
boardDetail.put("likeCount", reactions.getOrDefault("likeCount", 0));
|
||||
boardDetail.put("dislikeCount", reactions.getOrDefault("dislikeCount", 0));
|
||||
|
||||
// Blob 데이터를 문자열로 변환
|
||||
Object content = boardDetail.get("content");
|
||||
if (content != null) {
|
||||
String contentString = convertBlobToString(content); // Blob을 문자열로 변환
|
||||
String contentString = procBlobToString(content); // Blob을 문자열로 변환
|
||||
boardDetail.put("content", contentString); // JSON 변환 가능
|
||||
}
|
||||
}
|
||||
@ -282,20 +282,20 @@ public class localbordService {
|
||||
Object idObject = post.get("id");
|
||||
if (idObject instanceof Number) {
|
||||
long postId = ((Number) idObject).longValue();
|
||||
post.put("commentCount", getCommentCount(postId));
|
||||
post.put("hasAttachment", hasAttachments(postId));
|
||||
MapDto reactions = getBoardReactions(postId);
|
||||
post.put("commentCount", selectCountComments(postId));
|
||||
post.put("hasAttachment", selectAttachments(postId));
|
||||
MapDto reactions = selectCountBoardReactions(postId);
|
||||
post.put("likeCount", reactions.getOrDefault("likeCount", 0));
|
||||
post.put("dislikeCount", reactions.getOrDefault("dislikeCount", 0));
|
||||
|
||||
Object content = post.get("content");
|
||||
String contentString = convertBlobToString(content);
|
||||
String contentString = procBlobToString(content);
|
||||
post.put("content", contentString);
|
||||
|
||||
String firstImageUrl = extractFirstImageUrl(contentString);
|
||||
String firstImageUrl = procFirstImageUrl(contentString);
|
||||
post.put("firstImageUrl", firstImageUrl);
|
||||
|
||||
String plainContent = extractPlainTextFromJson(contentString);
|
||||
String plainContent = procPlainTextFromJson(contentString);
|
||||
post.put("plainContent", plainContent);
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@
|
||||
<mapper namespace="io.company.localhost.mapper.localbordMapper">
|
||||
|
||||
<!-- 공지사항 조회 -->
|
||||
<select id="getNotices" resultType="io.company.localhost.common.dto.MapDto">
|
||||
<select id="selectNotices" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT
|
||||
b.LOCBRDSEQ AS id,
|
||||
b.LOCBRDTTL AS title,
|
||||
@ -21,7 +21,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 자유/익명 게시판 조회 (작성자 이름 포함) -->
|
||||
<select id="getGeneralPosts" resultType="io.company.localhost.common.dto.MapDto">
|
||||
<select id="selectGeneralPosts" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT
|
||||
b.LOCBRDSEQ AS id,
|
||||
b.LOCBRDTTL AS title,
|
||||
@ -44,18 +44,18 @@
|
||||
|
||||
|
||||
<!-- 조회수 증가 -->
|
||||
<update id="incrementViewCount">
|
||||
<update id="updateIncrementViewCount">
|
||||
UPDATE localbord SET LOCBRDCNT = LOCBRDCNT + 1 WHERE LOCBRDSEQ = #{LOCBRDSEQ}
|
||||
</update>
|
||||
|
||||
<!-- 게시물 작성 -->
|
||||
<insert id="createBoard" parameterType="map" useGeneratedKeys="true" keyProperty="LOCBRDSEQ">
|
||||
<insert id="insertBoard" parameterType="map" useGeneratedKeys="true" keyProperty="LOCBRDSEQ">
|
||||
INSERT INTO localbord (LOCBRDTTL, LOCBRDCON, LOCBRDCAT, MEMBERSEQ, LOCBRDCNT, LOCBRDRDT, LOCBRDUDT, LOCBRDPWD, LOCBRDTYP)
|
||||
VALUES (#{LOCBRDTTL}, #{LOCBRDCON}, #{LOCBRDCAT}, #{MEMBERSEQ}, 0, NOW(), NOW(), #{LOCBRDPWD}, #{LOCBRDTYP})
|
||||
</insert>
|
||||
|
||||
<!-- 첨부파일 저장 -->
|
||||
<insert id="addAttachment" parameterType="map">
|
||||
<insert id="insertAttachment" parameterType="map">
|
||||
INSERT INTO commonfil (
|
||||
CMNBRDSEQ,CMNFLENAM,CMNFLEORG,CMNFLEPAT,
|
||||
CMNFLEEXT,CMNFLESIZ,CMNFLEREG,CMNFLERDT
|
||||
@ -109,7 +109,7 @@
|
||||
</update>
|
||||
|
||||
<!-- 기존 반응 조회 -->
|
||||
<select id="findReaction" resultType="io.company.localhost.common.dto.MapDto">
|
||||
<select id="selectReaction" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT LOCBRDSEQ, LOCCMTSEQ, MEMBERSEQ, LOCGOBGOD, LOCGOBBAD
|
||||
FROM localgorb
|
||||
WHERE (LOCBRDSEQ = #{LOCBRDSEQ} OR (#{LOCBRDSEQ} IS NULL AND LOCBRDSEQ IS NULL))
|
||||
@ -133,7 +133,7 @@
|
||||
</insert>
|
||||
|
||||
<!-- 댓글/대댓글 조회 -->
|
||||
<select id="getComments" resultType="io.company.localhost.common.dto.MapDto">
|
||||
<select id="selectComments" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT
|
||||
c.LOCCMTSEQ,c.LOCBRDSEQ,c.LOCCMTPNT,c.LOCCMTRPY,
|
||||
c.LOCCMTUDT,c.LOCCMTPWD,c.LOCCMTRDT,c.LOCCMTPNT,
|
||||
@ -145,7 +145,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 댓글/대댓글 작성 -->
|
||||
<insert id="addCommentOrReply">
|
||||
<insert id="insertCommentOrReply">
|
||||
INSERT INTO localcomt (LOCBRDSEQ, LOCCMTRPY, LOCCMTPWD, LOCCMTRDT, LOCCMTUDT, LOCCMTPNT, MEMBERSEQ)
|
||||
VALUES (#{LOCBRDSEQ}, #{LOCCMTRPY}, #{LOCCMTPWD}, NOW(), NOW() , #{LOCCMTPNT}, #{MEMBERSEQ})
|
||||
</insert>
|
||||
@ -158,7 +158,7 @@
|
||||
</update>
|
||||
|
||||
<!-- 댓글 삭제 -->
|
||||
<update id="softDeleteComment">
|
||||
<update id="updateSoftDeleteComment">
|
||||
UPDATE localcomt
|
||||
SET LOCCMTRPY = '삭제된 댓글입니다'
|
||||
WHERE LOCCMTSEQ = #{LOCCMTSEQ}
|
||||
@ -184,13 +184,13 @@
|
||||
</delete>
|
||||
|
||||
<!-- 대댓글인지 확인 -->
|
||||
<select id="isReply" resultType="boolean">
|
||||
<select id="selectIsReply" resultType="boolean">
|
||||
SELECT COUNT(1) > 0 FROM localcomt
|
||||
WHERE LOCCMTSEQ = #{LOCCMTSEQ} AND LOCCMTPNT IS NOT NULL
|
||||
</select>
|
||||
|
||||
<!-- 댓글에 대댓글이 있는지 확인 -->
|
||||
<select id="hasReplies" resultType="boolean">
|
||||
<select id="selectHasReplies" resultType="boolean">
|
||||
SELECT COUNT(1) > 0 FROM localcomt WHERE LOCCMTPNT = #{LOCCMTSEQ}
|
||||
</select>
|
||||
|
||||
@ -208,36 +208,29 @@
|
||||
WHERE LOCBRDSEQ = #{LOCBRDSEQ}
|
||||
</select>
|
||||
|
||||
<!-- 비밀 게시판 여부 확인 -->
|
||||
<select id="isSecretBoard" resultType="boolean">
|
||||
SELECT CASE WHEN LOCBRDTYP = 'S' THEN TRUE ELSE FALSE END
|
||||
FROM localbord
|
||||
WHERE LOCBRDSEQ = #{boardId}
|
||||
</select>
|
||||
|
||||
<!-- 댓글 id확인 -->
|
||||
<select id="getCommentById" resultType="io.company.localhost.common.dto.MapDto">
|
||||
<select id="selectCommentById" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT LOCCMTSEQ AS id, LOCCMTPNT AS point
|
||||
FROM localcomt
|
||||
WHERE LOCCMTSEQ = #{commentId}
|
||||
</select>
|
||||
|
||||
<!-- 댓글 개수 조회 -->
|
||||
<select id="countComments" parameterType="long" resultType="int">
|
||||
<select id="selectCountComments" parameterType="long" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
FROM localcomt
|
||||
WHERE LOCBRDSEQ = #{boardId}
|
||||
</select>
|
||||
|
||||
<!-- 첨부파일 유무 -->
|
||||
<select id="countAttachments" resultType="int">
|
||||
<select id="selectIsAttachments" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
FROM commonfil
|
||||
WHERE CMNBRDSEQ = #{boardId}
|
||||
</select>
|
||||
|
||||
<!-- 게시물 좋아요/싫어요 개수 조회 -->
|
||||
<select id="getBoardReactions" resultType="io.company.localhost.common.dto.MapDto">
|
||||
<select id="selectCountBoardReactions" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT
|
||||
COALESCE(SUM(CASE WHEN LOCGOBGOD = 'T' THEN 1 ELSE 0 END), 0) AS likeCount,
|
||||
COALESCE(SUM(CASE WHEN LOCGOBBAD = 'T' THEN 1 ELSE 0 END), 0) AS dislikeCount
|
||||
@ -247,7 +240,7 @@
|
||||
</select>
|
||||
|
||||
<!-- 댓글별 좋아요/싫어요 개수 조회 -->
|
||||
<select id="getCommentReactions" resultType="io.company.localhost.common.dto.MapDto">
|
||||
<select id="selectCountCommentReactions" resultType="io.company.localhost.common.dto.MapDto">
|
||||
SELECT
|
||||
LOCCMTSEQ,
|
||||
COALESCE(SUM(CASE WHEN LOCGOBGOD = 'T' THEN 1 ELSE 0 END), 0) AS likeCount,
|
||||
|
||||
Loading…
Reference in New Issue
Block a user