-
Notifications
You must be signed in to change notification settings - Fork 87
/
TradeRepository.java
28 lines (18 loc) · 973 Bytes
/
TradeRepository.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
package me.jcala.xmarket.server.repository;
import me.jcala.xmarket.server.entity.document.Trade;
import org.springframework.data.domain.Pageable;
import org.springframework.data.mongodb.repository.MongoRepository;
import org.springframework.data.mongodb.repository.Query;
import org.springframework.stereotype.Repository;
import java.util.List;
import java.util.Optional;
@Repository
public interface TradeRepository extends MongoRepository<Trade,String>{
@Query(fields = "{ 'id': 1,'title':1,'price':1,'imgUrls': 1,'author':1}")
List<Trade> findBySchoolNameAndStatus(String schoolName,int status,Pageable pageable);
@Query(fields = "{ 'id': 1,'title':1,'price':1,'imgUrls': 1,'author':1}")
List<Trade> findByTagNameAndStatus(String tagName, int status, Pageable pageable);
Trade findById(String id);
@Query(value = "{ 'id' : ?0 }", fields = "{ 'id': 1,'title':1,'price':1,'imgUrls': 1,'author':1}")
Trade findPartsById(String id);
}