Commit #1
This commit is contained in:
@@ -1,6 +1,12 @@
|
||||
package com.example.nto.service.impl;
|
||||
|
||||
import com.example.nto.dto.EmployeeDTO;
|
||||
import com.example.nto.entity.Employee;
|
||||
import com.example.nto.repository.EmployeeRepository;
|
||||
import com.example.nto.service.EmployeeService;
|
||||
import com.example.nto.util.EmployeeMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
/**
|
||||
* TODO: ДОРАБОТАТЬ в рамках задания
|
||||
@@ -8,5 +14,20 @@ import com.example.nto.service.EmployeeService;
|
||||
* МОЖНО: Добавлять методы, аннотации, зависимости
|
||||
* НЕЛЬЗЯ: Изменять название класса и пакета
|
||||
*/
|
||||
@Service
|
||||
public class EmployeeServiceImpl implements EmployeeService {
|
||||
@Autowired
|
||||
EmployeeRepository employeeRepository;
|
||||
|
||||
@Override
|
||||
public boolean codeExists(String code) {
|
||||
boolean codeExists = employeeRepository.existsByCode(code);
|
||||
return codeExists;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EmployeeDTO getInfo(String code) {
|
||||
Employee employee = employeeRepository.findByCode(code);
|
||||
return EmployeeMapper.convertToDTO(employee);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user