реализация get, но пока ещё с ошибками
This commit is contained in:
@@ -1,11 +1,12 @@
|
||||
package com.example.nto.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.example.nto.entity.Employee;
|
||||
import com.example.nto.service.EmployeeService;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.net.http.HttpResponse;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO: ДОРАБОТАТЬ в рамках задания
|
||||
@@ -20,4 +21,17 @@ public class EmployeeController {
|
||||
public int isAuth(@PathVariable int id){
|
||||
return id;
|
||||
}
|
||||
|
||||
private final EmployeeService employeeService;
|
||||
|
||||
public EmployeeController(EmployeeService employeeService) {
|
||||
|
||||
this.employeeService = employeeService;
|
||||
}
|
||||
|
||||
@GetMapping
|
||||
@ResponseStatus(code = HttpStatus.OK)
|
||||
public List<Employee> getAll() {
|
||||
return employeeService.getAll();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user