This commit is contained in:
indx0
2025-11-21 21:05:27 +03:00
parent be8818b71f
commit a612c92833
14 changed files with 187 additions and 22 deletions

View File

@@ -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);
}
}