[Spring][쇼핑몰 프로젝트][48] 댓글 수정 - 1

https://kimvampa.tistory.com/297
This commit is contained in:
SeoJin Kim
2022-01-11 18:06:25 +09:00
parent c5134de056
commit 9c94c0390e
14 changed files with 161 additions and 2 deletions

View File

@@ -24,8 +24,10 @@ import com.vam.model.AttachImageVO;
import com.vam.model.BookVO;
import com.vam.model.Criteria;
import com.vam.model.PageDTO;
import com.vam.model.ReplyDTO;
import com.vam.service.AttachService;
import com.vam.service.BookService;
import com.vam.service.ReplyService;
@Controller
public class BookController {
@@ -38,6 +40,9 @@ public class BookController {
@Autowired
private BookService bookService;
@Autowired
private ReplyService replyService;
//메인 페이지 이동
@RequestMapping(value="/main", method = RequestMethod.GET)
public void mainPageGET(Model model) {
@@ -139,6 +144,17 @@ public class BookController {
return "/replyEnroll";
}
/* 리뷰 수정 팝업창 */
@GetMapping("/replyUpdate")
public String replyUpdateWindowGET(ReplyDTO dto, Model model) {
BookVO book = bookService.getBookIdName(dto.getBookId());
model.addAttribute("bookInfo", book);
model.addAttribute("replyInfo", replyService.getUpdateReply(dto.getReplyId()));
model.addAttribute("memberId", dto.getMemberId());
return "/replyUpdate";
}
}

View File

@@ -39,4 +39,10 @@ public class ReplyController {
return replyService.replyList(cri);
}
/* 댓글 수정 */
@PostMapping("/update")
public void replyModifyPOST(ReplyDTO dto) {
replyService.updateReply(dto);
}
}

View File

@@ -19,4 +19,10 @@ public interface ReplyMapper {
/* 댓글 총 갯수(페이징) */
public int getReplyTotal(int bookId);
/* 댓글 수정 */
public int updateReply(ReplyDTO dto);
/* 댓글 한개 정보(수정페이지) */
public ReplyDTO getUpdateReply(int replyId);
}

View File

@@ -15,4 +15,10 @@ public interface ReplyService {
/* 댓글 페이징 */
public ReplyPageDTO replyList(Criteria cri);
/* 댓글 수정 */
public int updateReply(ReplyDTO dto);
/* 댓글 한개 정보(수정페이지) */
public ReplyDTO getUpdateReply(int replyId);
}

View File

@@ -49,5 +49,19 @@ public class ReplyServiceImpl implements ReplyService{
return dto;
}
@Override
public int updateReply(ReplyDTO dto) {
int result = replyMapper.updateReply(dto);
return result;
}
@Override
public ReplyDTO getUpdateReply(int replyId) {
return replyMapper.getUpdateReply(replyId);
}
}

View File

@@ -40,6 +40,22 @@
where bookId = #{bookId}
</select>
<!-- 댓글수정 -->
<update id="updateReply">
update vam_reply set content = #{content}, rating = #{rating}
where replyId = #{replyId}
</update>
<!-- 댓글 수정 팝업창 -->
<select id="getUpdateReply" resultType="com.vam.model.ReplyDTO">
select * from vam_reply
where replyId = #{replyId}
</select>
</mapper>

View File

@@ -40,6 +40,22 @@
where bookId = #{bookId}
</select>
<!-- 댓글수정 -->
<update id="updateReply">
update vam_reply set content = #{content}, rating = #{rating}
where replyId = #{replyId}
</update>
<!-- 댓글 수정 팝업창 -->
<select id="getUpdateReply" resultType="com.vam.model.ReplyDTO">
select * from vam_reply
where replyId = #{replyId}
</select>
</mapper>

View File

@@ -20,13 +20,14 @@ import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import com.vam.mapper.AttachMapper;
import com.vam.model.AttachImageVO;
import com.vam.model.BookVO;
import com.vam.model.Criteria;
import com.vam.model.PageDTO;
import com.vam.model.ReplyDTO;
import com.vam.service.AttachService;
import com.vam.service.BookService;
import com.vam.service.ReplyService;
@Controller
public class BookController {
@@ -39,6 +40,9 @@ public class BookController {
@Autowired
private BookService bookService;
@Autowired
private ReplyService replyService;
//메인 페이지 이동
@RequestMapping(value="/main", method = RequestMethod.GET)
public void mainPageGET(Model model) {
@@ -139,6 +143,17 @@ public class BookController {
return "/replyEnroll";
}
/* 리뷰 수정 팝업창 */
@GetMapping("/replyUpdate")
public String replyUpdateWindowGET(ReplyDTO dto, Model model) {
BookVO book = bookService.getBookIdName(dto.getBookId());
model.addAttribute("bookInfo", book);
model.addAttribute("replyInfo", replyService.getUpdateReply(dto.getReplyId()));
model.addAttribute("memberId", dto.getMemberId());
return "/replyUpdate";
}
}

View File

@@ -39,4 +39,10 @@ public class ReplyController {
return replyService.replyList(cri);
}
/* 댓글 수정 */
@PostMapping("/update")
public void replyModifyPOST(ReplyDTO dto) {
replyService.updateReply(dto);
}
}

View File

@@ -17,6 +17,12 @@ public interface ReplyMapper {
public List<ReplyDTO> getReplyList(Criteria cri);
/* 댓글 총 갯수(페이징) */
public int getReplyTotal(int bookId);
public int getReplyTotal(int bookId);
/* 댓글 수정 */
public int updateReply(ReplyDTO dto);
/* 댓글 한개 정보(수정페이지) */
public ReplyDTO getUpdateReply(int replyId);
}

View File

@@ -14,5 +14,11 @@ public interface ReplyService {
/* 댓글 페이징 */
public ReplyPageDTO replyList(Criteria cri);
/* 댓글 수정 */
public int updateReply(ReplyDTO dto);
/* 댓글 한개 정보(수정페이지) */
public ReplyDTO getUpdateReply(int replyId);
}

View File

@@ -48,4 +48,18 @@ public class ReplyServiceImpl implements ReplyService{
return dto;
}
@Override
public int updateReply(ReplyDTO dto) {
int result = replyMapper.updateReply(dto);
return result;
}
@Override
public ReplyDTO getUpdateReply(int replyId) {
return replyMapper.getUpdateReply(replyId);
}
}

View File

@@ -36,5 +36,21 @@
where bookId = #{bookId}
</select>
<!-- 댓글수정 -->
<update id="updateReply">
update vam_reply set content = #{content}, rating = #{rating}
where replyId = #{replyId}
</update>
<!-- 댓글 수정 팝업창 -->
<select id="getUpdateReply" resultType="com.vam.model.ReplyDTO">
select * from vam_reply
where replyId = #{replyId}
</select>
</mapper>

View File

@@ -36,5 +36,21 @@
where bookId = #{bookId}
</select>
<!-- 댓글수정 -->
<update id="updateReply">
update vam_reply set content = #{content}, rating = #{rating}
where replyId = #{replyId}
</update>
<!-- 댓글 수정 팝업창 -->
<select id="getUpdateReply" resultType="com.vam.model.ReplyDTO">
select * from vam_reply
where replyId = #{replyId}
</select>
</mapper>