forked from Olympic/NTO-2025-Backend-TeamTask
третья попытка((((
This commit is contained in:
@@ -21,7 +21,10 @@ public class EmployeeController {
|
||||
@GetMapping("/{code}")
|
||||
public ResponseEntity<Employee> getEmployeeByCode(@PathVariable String code) {
|
||||
Optional<Employee> employeeOpt = employeeService.findByCode(code);
|
||||
return employeeOpt.map(ResponseEntity::ok)
|
||||
.orElseGet(() -> ResponseEntity.status(HttpStatus.NOT_FOUND).build());
|
||||
if (employeeOpt.isPresent()) {
|
||||
return ResponseEntity.ok(employeeOpt.get());
|
||||
} else {
|
||||
return ResponseEntity.status(HttpStatus.NOT_FOUND).build();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user