Files
NTO-2025-Backend-TeamTask/src/main/java/com/example/nto/service/impl/EmployeeServiceImpl.java
2025-11-21 21:05:27 +03:00

34 lines
1.1 KiB
Java

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: ДОРАБОТАТЬ в рамках задания
* =================================
* МОЖНО: Добавлять методы, аннотации, зависимости
* НЕЛЬЗЯ: Изменять название класса и пакета
*/
@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);
}
}