admin
2021-04-30 cd4a4617fd33b0e25185ab2012a536821420fd80
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
package com.yeshi.buwan.query;
 
import org.springframework.data.domain.Sort;
import org.springframework.data.mongodb.core.query.Query;
 
import java.util.List;
 
public class BaseQuery {
    public long start;
    public int count;
 
    public static Query createBaseMongoQuery(BaseQuery baseQuery, List<Sort.Order> sortList) {
        Query query = new Query();
        query.skip((int) baseQuery.start);
        query.limit(baseQuery.count);
        if (sortList != null) {
            query.with(new Sort(sortList));
        }
        return query;
    }
}