package ru.example.nto.controller; import org.springframework.http.HttpStatus; import org.springframework.web.bind.annotation.*; import ru.example.nto.entity.Department; import ru.example.nto.service.DepartmentService; import java.util.List; @RestController @RequestMapping("api/v1/department") public class DepartmentController { private final DepartmentService departmentService; public DepartmentController(DepartmentService departmentService) { this.departmentService = departmentService; } @GetMapping @ResponseStatus(code = HttpStatus.OK) public List getAll() { return departmentService.getAll(); } @GetMapping("/{name}") @ResponseStatus(HttpStatus.OK) public Department getByName(@PathVariable String name) { return departmentService.getByName(name); } }