GetEntersByLogin usecase
This commit is contained in:
parent
43d9689a68
commit
e7f3130b0e
@ -3,7 +3,9 @@ package com.example.nto.repository;
|
||||
import com.example.nto.entity.Enter;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
|
||||
public interface EnterRepository extends JpaRepository<Enter, Long> {
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
|
||||
Enter getByEmployee();
|
||||
public interface EnterRepository extends JpaRepository<Enter, Long> {
|
||||
List<Enter> findByEmployeeLogin(String login);
|
||||
}
|
||||
|
@ -1,8 +1,11 @@
|
||||
package com.example.nto.service;
|
||||
|
||||
import com.example.nto.dto.EnterDto;
|
||||
import com.example.nto.entity.Enter;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface EnterService {
|
||||
Enter getEnterByLogin(String Login);
|
||||
List<EnterDto> getByLogin(String Login);
|
||||
}
|
||||
|
@ -1,11 +1,17 @@
|
||||
package com.example.nto.service.impl;
|
||||
|
||||
import com.example.nto.dto.EnterDto;
|
||||
import com.example.nto.entity.Enter;
|
||||
import com.example.nto.utils.EnterMapper;
|
||||
import com.example.nto.repository.EnterRepository;
|
||||
import com.example.nto.service.EnterService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EnterServiceImpl implements EnterService {
|
||||
@ -13,7 +19,9 @@ public class EnterServiceImpl implements EnterService {
|
||||
private final EnterRepository enterRepository;
|
||||
|
||||
@Override
|
||||
public Enter getEnterByLogin(String Login) {
|
||||
return null;
|
||||
public List<EnterDto> getByLogin(String login) {
|
||||
List<Enter> enters = enterRepository.findByEmployeeLogin(login);
|
||||
return enters.stream().map(EnterMapper::convertToDto).collect(Collectors.toList());
|
||||
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user