@RequestMapping(value = "/teacher/password", method = RequestMethod.PUT) @ResponseBody public JSONObject changePasswd(@RequestBody JSONObject teacher) throws SQLException { teacher.put("tch_passwd", MD5.string2md5(teacher.getString("tch_passwd"))); teacherService.updatePasswd(teacher); return RequestUtil.make_ret(); }
@RequestMapping(value = "/teacher/{teacher_id}", method = RequestMethod.DELETE) @ResponseBody public JSONObject delTeacher(@PathVariable("teacher_id") int teacherID) throws SQLException { teacherService.deleteByID(teacherID); return RequestUtil.make_ret(); }
@RequestMapping(value = "/teacher", method = RequestMethod.PUT) @ResponseBody public JSONObject updateTeacher(@RequestBody JSONObject teacher) throws SQLException { teacherService.update(teacher); return RequestUtil.make_ret(); }
@RequestMapping(value = "/teacher", method = RequestMethod.POST) @ResponseBody public JSONObject addTeacher(@RequestBody JSONObject teacher) throws SQLException { Log.debug("save Teacher:" + teacher); return RequestUtil.make_ret(0, "", teacherService.insertTeacher(teacher)); }
@RequestMapping(value = "/teachers", method = RequestMethod.GET) @ResponseBody public JSONObject teachers() throws SQLException { return RequestUtil.make_ret(teacherService.selectAll()); }