1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| return pageInfo; }
@ApiOperation(value = "新增教师", notes = "新增教师") @ApiImplicitParam(name = "teacher", value = "教师实体teacher", required = true, dataType = "Teacher") @RequestMapping(value = "", method = RequestMethod.POST) @PreAuthorize("hasAuthority('" + Role.ROLE_ADMIN + "')") public ResponseEntity<?> postTeacher(@RequestBody Teacher teacher) {
MapperUser user = userService.getUserByName(teacher.getTeacherName()); if(user != null && teacherService.getTeacherByName(teacher.getTeacherName()) == null) { teacher.setId(user.getId()); teacherService.saveTeacher(teacher); }else { return new ResponseEntity(HttpStatus.BAD_REQUEST); } return new ResponseEntity(HttpStatus.CREATED); }
@ApiOperation(value = "根据名字获取教师信息", notes = "根据教师名字获取教师详细信息") @ApiImplicitParam(name = "name", value = "教师名字", required = true, dataType = "String", paramType = "path") @RequestMapping(value = "/{name}/name", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public List<Teacher> getTeacherByName(@PathVariable String name) { return teacherService.getTeacherFuzzy(name); }
@ApiOperation(value = "获取教师信息", notes = "根据教师id获取教师详细信息") @ApiImplicitParam(name = "id", value = "教师ID", required = true, dataType = "String", paramType = "path") @RequestMapping(value = "/{id}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public Teacher getTeacherById(@PathVariable String id) { return teacherService.getTeacherById(id); }
@ApiOperation(value = "获取教师班级信息", notes = "根据教师name获取班级详细信息") @ApiImplicitParam(name = "name", value = "教师name", required = true, dataType = "String", paramType = "path") @RequestMapping(value = "/name/grade/{name}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public List<Grade> getGradeByTeacher(@PathVariable String name) { return teacherService.findGradeByName(name); }
@ApiOperation(value = "获取教师学生信息", notes = "根据教师name获取学生详细信息") @ApiImplicitParam(name = "name", value = "教师name", required = true, dataType = "String", paramType = "path") @RequestMapping(value = "/name/student/{name}", method = RequestMethod.GET) @PreAuthorize("hasAuthority('" + Role.ROLE_TEACHER + "') or hasAuthority('" + Role.ROLE_ADMIN + "')") public List<Student> getStudentByTeacher(@PathVariable String name) {
|