Created
March 30, 2020 23:08
-
-
Save thinkmicroservices/6660ef4b487d24c6d32e3c7a8299157d to your computer and use it in GitHub Desktop.
AccountProfileService: ProfileRepository.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.thinkmicroservices.ri.spring.account.profile.repository; | |
import com.thinkmicroservices.ri.spring.account.profile.model.Profile; | |
import java.util.Optional; | |
import org.springframework.data.domain.Page; | |
import org.springframework.data.domain.Pageable; | |
import org.springframework.data.mongodb.repository.MongoRepository; | |
import org.springframework.data.mongodb.repository.Query; | |
/** | |
* | |
* @author cwoodward | |
*/ | |
public interface ProfileRepository extends MongoRepository<Profile, String> { | |
/** | |
* | |
* @param accountId | |
* @return | |
*/ | |
Optional<Profile> findByAccountId(String accountId); | |
/** | |
* | |
* @param email | |
* @return | |
*/ | |
Optional<Profile> findByEmail(String email); | |
/** | |
* | |
* @param like | |
* @param paging | |
* @return | |
*/ | |
@Query(value = "{$or:[{firstName:{$regex:?0,$options:'i'}},{middleName:{$regex:?0,$options:'i'}},{lastName:{$regex:?0,$options:'i'}},{email:{$regex:?0,$options:'i'}}]}") | |
Page<Profile> findByQuery(String like, Pageable paging); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment