Interface UserRepository

  • All Superinterfaces:
    org.springframework.data.repository.CrudRepository<UserEntity,​String>, org.springframework.data.repository.PagingAndSortingRepository<UserEntity,​String>, org.springframework.data.repository.Repository<UserEntity,​String>

    public interface UserRepository
    extends org.springframework.data.repository.PagingAndSortingRepository<UserEntity,​String>
    • Method Detail

      • findFirstByLogin

        Optional<UserEntity> findFirstByLogin​(String login)
        Finds user by its login if exists
        Parameters:
        login - user login
        Returns:
        user if exists
      • findByEmailOrLogin

        Optional<UserEntity> findByEmailOrLogin​(String email,
                                                String login)
        Finds user by its email or login if exists
        Parameters:
        email - user email
        Returns:
        user if exists
      • updateSystemBlockedStatus

        @Modifying
        @Query("update UserEntity u set u.systemBlocked=?2 where u.branch=?1")
        void updateSystemBlockedStatus​(String branchId,
                                       boolean status)
      • updateBlockedStatus

        @Modifying
        @Query("update UserEntity u set u.blocked=?2 where u.branch=?1")
        void updateBlockedStatus​(String branchId,
                                 boolean status)
      • updateUserSystemBlockedStatus

        @Modifying
        @Query("update UserEntity u set u.systemBlocked=?2 where u.id=?1")
        void updateUserSystemBlockedStatus​(String userId,
                                           boolean status)
      • updateUserBlockedStatus

        @Modifying
        @Query("update UserEntity u set u.blocked=?2 where u.id=?1")
        void updateUserBlockedStatus​(String userId,
                                     boolean status)
      • findBranchIdsByMultipleParameters

        @Query("select distinct u from UserEntity u where u.branch like ?1% and u.branch like  %?2% and u.login like %?3% and ?4 member of u.userRoles and u.systemBlocked=false ")
        List<UserEntity> findBranchIdsByMultipleParameters​(String countryCode,
                                                           String branchId,
                                                           String branchLogin,
                                                           UserRole role)
      • findByBranchInAndLoginContainingAndUserRolesInAndBlockedInAndSystemBlockedFalse

        org.springframework.data.domain.Page<UserEntity> findByBranchInAndLoginContainingAndUserRolesInAndBlockedInAndSystemBlockedFalse​(Collection<String> branch,
                                                                                                                                         String login,
                                                                                                                                         Collection<UserRole> userRoles,
                                                                                                                                         Collection<Boolean> blocked,
                                                                                                                                         org.springframework.data.domain.Pageable pageable)
      • findByUserRolesIn

        org.springframework.data.domain.Page<UserEntity> findByUserRolesIn​(Collection<UserRole> userRoles,
                                                                           org.springframework.data.domain.Pageable pageable)
      • countByBranch

        int countByBranch​(String branch)
        Counts amount of users for a branch
        Parameters:
        branch - branch
        Returns:
        amount of users
      • findUsersByIban

        @Query("select distinct u from UserEntity u join u.accountAccesses a where a.iban = ?1")
        List<UserEntity> findUsersByIban​(String iban)
      • findOwnersByIban

        @Query("select distinct u from UserEntity u join u.accountAccesses a where a.iban = ?1 and a.accessType = ?2")
        List<UserEntity> findOwnersByIban​(String iban,
                                          AccessType accessType)
      • findOwnersByAccountId

        @Query("select distinct u from UserEntity u join u.accountAccesses a where a.accountId = ?1 and a.accessType = ?2")
        List<UserEntity> findOwnersByAccountId​(String accountId,
                                               AccessType accessType)
      • findByLoginOrEmail

        @Query("select u from UserEntity u where u.login=?1 or u.email=?1")
        Optional<UserEntity> findByLoginOrEmail​(String loginOrEmail)