Guest User

Untitled

a guest
Nov 18th, 2018
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.86 KB | None | 0 0
  1. public interface MongoSearchRepository<T, ID> {
  2. List<T> searchByPage(String keyword, T example, Pageable page);
  3. }
  4.  
  5. public class MongoSearchRepositoryImpl<T, ID> implements MongoSearchRepository<T, ID> {
  6. protected MongoOperations mongoOperations;
  7.  
  8. @Autowired
  9. public MongoSearchRepositoryImpl(MongoOperations mongoOperations) {
  10. this.mongoOperations = mongoOperations;
  11. }
  12.  
  13. @Override
  14. public List<T> searchByPage(String keyword, T example, Pageable page) {
  15. Query query = ...;
  16.  
  17. return this.mongoOperations.find(
  18. query,
  19. this.getEntityInformation().getJavaType(),
  20. this.getEntityInformation().getCollectionName());
  21. }
  22.  
  23. @Repository
  24. public interface ProductRepository
  25. extends MongoCrudRepository<Product, String>,
  26. MongoSearchRepository<Product, String>
Add Comment
Please, Sign In to add comment