예제 #1
0
 @RequestMapping(value = "/{id}", method = RequestMethod.GET)
 @JsonView(View.PrincipalWithManyToOne.class)
 public ResponseEntity<Offender> get(@PathVariable Long id) {
   return Optional.ofNullable(repository.findOneByIdAndType(id, OffenderTypeEnum.TEACHER))
       .map(offender -> new ResponseEntity<>(offender, HttpStatus.OK))
       .orElse(new ResponseEntity<>(HttpStatus.NOT_FOUND));
 }
예제 #2
0
 @RequestMapping(value = "", method = RequestMethod.GET)
 @JsonView(View.PrincipalWithManyToOne.class)
 public ResponseEntity<List<Offender>> getAll() {
   return ResponseEntity.ok().body(repository.findByType(OffenderTypeEnum.TEACHER));
 }