:(
This commit is contained in:
@@ -3,9 +3,11 @@ package com.example.nto.service.impl;
|
||||
import com.example.nto.entity.Employee;
|
||||
import com.example.nto.repository.EmployeeRepository;
|
||||
import com.example.nto.service.EmployeeService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* TODO: ДОРАБОТАТЬ в рамках задания
|
||||
@@ -13,6 +15,7 @@ import java.util.List;
|
||||
* МОЖНО: Добавлять методы, аннотации, зависимости
|
||||
* НЕЛЬЗЯ: Изменять название класса и пакета
|
||||
*/
|
||||
@Component
|
||||
@Service
|
||||
public class EmployeeServiceImpl implements EmployeeService {
|
||||
private final EmployeeRepository employeeRepository;
|
||||
@@ -23,13 +26,11 @@ public class EmployeeServiceImpl implements EmployeeService {
|
||||
|
||||
@Override
|
||||
public List<Employee> getAll() {
|
||||
|
||||
|
||||
return employeeRepository.findAll();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Employee getById(long id) {
|
||||
public Optional<Employee> getById(long id) {
|
||||
return employeeRepository.findById(id);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user