[Spring][쇼핑몰 프로젝트][46] 댓글 체크 - 1

https://kimvampa.tistory.com/291
This commit is contained in:
SeoJin Kim
2022-01-07 17:50:27 +09:00
parent 7dcf54fc65
commit 26d1af539b
14 changed files with 89 additions and 3 deletions

View File

@@ -21,4 +21,12 @@ public class ReplyController {
replyService.enrollReply(dto);
}
/* 댓글 체크 */
/* memberId, bookId 파라미터 */
/* 존재 : 1 / 존재x : 0 */
@PostMapping("/check")
public String replyCheckPOST(ReplyDTO dto) {
return replyService.checkReply(dto);
}
}

View File

@@ -7,4 +7,7 @@ public interface ReplyMapper {
/* 댓글 등록 */
public int enrollReply(ReplyDTO dto);
/* 댓글 존재 체크 */
public Integer checkReply(ReplyDTO dto);
}

View File

@@ -5,6 +5,9 @@ import com.vam.model.ReplyDTO;
public interface ReplyService {
/* 댓글 등록 */
public int enrollReply(ReplyDTO dto);
public int enrollReply(ReplyDTO dto);
/* 댓글 존재 체크 */
public String checkReply(ReplyDTO dto);
}

View File

@@ -21,4 +21,20 @@ public class ReplyServiceImpl implements ReplyService{
return result;
}
/* 댓글 존재 체크 */
@Override
public String checkReply(ReplyDTO dto) {
Integer result = replyMapper.checkReply(dto);
if(result == null) {
return "0";
} else {
return "1";
}
}
}

View File

@@ -10,5 +10,12 @@
insert into vam_reply(bookId, memberId, content, rating) values(#{bookId}, #{memberId}, #{content}, #{rating})
</insert>
<select id="checkReply" resultType="integer">
select replyId from vam_reply
where memberId = #{memberId} and bookId = #{bookId}
</select>
</mapper>

View File

@@ -10,5 +10,12 @@
insert into vam_reply(bookId, memberId, content, rating) values(#{bookId}, #{memberId}, #{content}, #{rating})
</insert>
<select id="checkReply" resultType="integer">
select replyId from vam_reply
where memberId = #{memberId} and bookId = #{bookId}
</select>
</mapper>

View File

@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
#Mon Jan 03 13:38:26 KST 2022
#Fri Jan 07 17:32:29 KST 2022
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa
m2e.projectName=VamPa
groupId=com.vam

View File

@@ -21,4 +21,12 @@ public class ReplyController {
replyService.enrollReply(dto);
}
/* 댓글 체크 */
/* memberId, bookId 파라미터 */
/* 존재 : 1 / 존재x : 0 */
@PostMapping("/check")
public String replyCheckPOST(ReplyDTO dto) {
return replyService.checkReply(dto);
}
}

View File

@@ -6,5 +6,8 @@ public interface ReplyMapper {
/* 댓글 등록 */
public int enrollReply(ReplyDTO dto);
/* 댓글 존재 체크 */
public Integer checkReply(ReplyDTO dto);
}

View File

@@ -6,5 +6,8 @@ public interface ReplyService {
/* 댓글 등록 */
public int enrollReply(ReplyDTO dto);
/* 댓글 존재 체크 */
public String checkReply(ReplyDTO dto);
}

View File

@@ -21,4 +21,18 @@ public class ReplyServiceImpl implements ReplyService{
return result;
}
/* 댓글 존재 체크 */
@Override
public String checkReply(ReplyDTO dto) {
Integer result = replyMapper.checkReply(dto);
if(result == null) {
return "0";
} else {
return "1";
}
}
}

View File

@@ -10,5 +10,12 @@
insert into vam_reply(bookId, memberId, content, rating) values(#{bookId}, #{memberId}, #{content}, #{rating})
</insert>
<select id="checkReply" resultType="integer">
select replyId from vam_reply
where memberId = #{memberId} and bookId = #{bookId}
</select>
</mapper>

View File

@@ -10,5 +10,12 @@
insert into vam_reply(bookId, memberId, content, rating) values(#{bookId}, #{memberId}, #{content}, #{rating})
</insert>
<select id="checkReply" resultType="integer">
select replyId from vam_reply
where memberId = #{memberId} and bookId = #{bookId}
</select>
</mapper>

View File

@@ -1,5 +1,5 @@
#Generated by Maven Integration for Eclipse
#Mon Jan 03 13:38:26 KST 2022
#Fri Jan 07 17:32:30 KST 2022
m2e.projectLocation=C\:\\Users\\sjinj\\git\\Blog_Project2\\VamPa_MySQL
m2e.projectName=VamPa_MySQL
groupId=com.vam