.../api/{id}/auth - работает =)
This commit is contained in:
@@ -3,6 +3,7 @@ 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.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -20,6 +21,7 @@ import java.util.Optional;
|
||||
public class EmployeeServiceImpl implements EmployeeService {
|
||||
private final EmployeeRepository employeeRepository;
|
||||
|
||||
@Autowired
|
||||
public EmployeeServiceImpl(EmployeeRepository employeeRepository) {
|
||||
this.employeeRepository = employeeRepository;
|
||||
}
|
||||
@@ -33,4 +35,8 @@ public class EmployeeServiceImpl implements EmployeeService {
|
||||
public Optional<Employee> getById(long id) {
|
||||
return employeeRepository.findById(id);
|
||||
}
|
||||
|
||||
public boolean isIdValid(long id){
|
||||
return employeeRepository.findById(id).isPresent();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user