diff --git a/src/main/java/com/bupt/note/Controller/NoteController.java b/src/main/java/com/bupt/note/Controller/NoteController.java index a74cc18..d68610d 100644 --- a/src/main/java/com/bupt/note/Controller/NoteController.java +++ b/src/main/java/com/bupt/note/Controller/NoteController.java @@ -163,4 +163,17 @@ public class NoteController { } return ResponseDataUtil.buildError(); } + + @PutMapping("update") + public ResponseData put(@RequestBody NoteForm noteForm){ + if(StringUtils.isNoneEmpty(noteForm.getNoteId(),noteForm.getNoteContent())){ + Note note=noteRepository.getOne(noteForm.getNoteId()); + note.setNoteContent(noteForm.getNoteContent()); + noteRepository.save(note); + return ResponseDataUtil.buildSuccess(); + }else{ + logger.error("笔记更新失败"); + return ResponseDataUtil.buildError(); + } + } }