728x90
let index = {
init: function () {
$("#btn-saveTheWriting").on("click", () => {
this.saveTheWriting();
});
$("#btn-delete").on("click", () => {
this.deleteById();
});
deleteById: function () {
let no = "";
$("input[name=no]:checked").each(function () {
var no = $(this).attr("value");
console.log(no);
$.ajax({
type: "DELETE",
url: "/board/detail/" + no,
data: JSON.stringify(no),
})
.done(function (resp) {
alert("글삭제가 완료되었습니다.");
location.href = "/";
})
.fail(function (error) {
alert(JSON.stringify(error));
});
});
},
@DeleteMapping("/board/detail/{no}")
public ResponseDto<Integer> deleteWriting(@PathVariable int no) {
System.out.println("numbers"+no);
boardService.deleteWritingList(no);
return new ResponseDto<Integer>(HttpStatus.OK.value(), 1);
}
여기서 @PathVariable int no?
@PathVariable String no?
문제 없이 다 글 삭제가 가능했다.
<delete id="deleteWritingList">
DELETE FROM board WHERE no =${no}
</delete>
728x90
'고민, 나중에..' 카테고리의 다른 글
마이바티스 SQL 고찰..(개인 학습)<where><if></if></where> (0) | 2022.02.12 |
---|---|
Controller 설계에 대한 고민 (0) | 2022.02.10 |
RESTful API 공부할 것 (0) | 2022.02.06 |
댓글