admin
2025-02-25 30d8e227e8d823b6c38c3b9c90ac2df03b63befe
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
29
30
31
32
33
34
35
36
37
38
39
40
41
package com.yeshi.fanli.dao.mongo.system;
 
import com.ks.lijin.query.BaseDaoQuery;
import com.yeshi.common.MongodbBaseDao;
import com.yeshi.fanli.entity.SystemPIDInfo;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.stereotype.Repository;
 
import java.util.ArrayList;
import java.util.List;
 
@Repository
public class SystemPIDInfoDao extends MongodbBaseDao<SystemPIDInfo> {
 
    public List<SystemPIDInfo> list(DaoQuery daoQuery) {
        List<Criteria> andList = new ArrayList<>();
        if (daoQuery.pid != null) {
            andList.add(Criteria.where("pid").is(daoQuery.pid));
        }
        if (daoQuery.sourceType != null) {
            andList.add(Criteria.where("sourceType").is(daoQuery.sourceType));
        }
 
 
        Criteria[] ands = new Criteria[andList.size()];
        andList.toArray(ands);
        Query query = new Query();
        query.addCriteria(new Criteria().andOperator(ands));
        query.skip((int) daoQuery.start);
        query.limit(daoQuery.count);
        return findList(query);
    }
 
 
    public static class DaoQuery extends BaseDaoQuery {
        public String pid;
        public Integer sourceType;
    }
 
}