@
narusas, @jee yong kim
답변 감사합니다.
그럼 '추가' 하는 경우에는 아래와 같이
@PostMapping(value = "add")
public ResponseEntity<DocLayout> add(@RequestBody DocLayout docLayout) {
return new ResponseEntity<DocLayout>(layoutService.add(docLayout), HttpStatus.OK);
}
@Transactional
public DocLayout add(DocLayout layout) {
layoutRepo.save(layout);
return layout;
}
'수정' 하는 경우에는 아래와 같은 형태가 되겠네요?
@PostMapping(value = "update")
public ResponseEntity<DocLayout> update(@RequestBody DocLayout docLayout) {
return new ResponseEntity<DocLayout>(layoutService.update(docLayout), HttpStatus.OK);
}
@Transactional
public DocLayout add(DocLayout layout) {
DocLayout docLayout = layoutRepo.findById(layout.getNo());
docLayout.setA(layout.getA());
docLayout.setB(layout.getB());
return layout;
}
고맙습니다.