@RequestMapping("returnNote") public void returnNote( HttpServletRequest request, HttpServletResponse response, HttpSession session) throws IOException { int noteId = DataHandle.returnValueInt(request, "noteId"); Note note = new Note(); note.setNoteId(noteId); note = noteMapperService.select(note); JSONObject jsonObject = new JSONObject(); jsonObject.put("result", "success"); jsonObject.put("data", note); response.getWriter().write(jsonObject.toString()); }
@RequestMapping("my-updateNote") public void updateNote( HttpServletRequest request, HttpServletResponse response, HttpSession session) throws IOException { User user = (User) session.getAttribute(Constant.USER); int noteId = DataHandle.returnValueInt(request, "noteId"); String content = DataHandle.returnValue(request, "content"); Note note = new Note(); note.setNoteId(noteId); note = noteMapperService.select(note); if (note.getUserId() == user.getUserId()) { note.setContent(content); noteMapperService.update(note); JSONObject jsonObject = new JSONObject(); jsonObject.put("result", "success"); jsonObject.put("message", "修改成功"); response.getWriter().write(jsonObject.toString()); } }