admin
2021-02-04 e8e342cd6c1334f1b8f71d24baa3157637a9ac43
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
42
43
44
package com.yeshi.buwan.dao.vip;
 
import com.yeshi.buwan.dao.base.BaseDao;
import com.yeshi.buwan.domain.vip.VIPOrderRecord;
import org.springframework.stereotype.Repository;
 
import java.util.List;
 
@Repository
public class VIPOrderRecordDao extends BaseDao<VIPOrderRecord> {
 
 
    private String getHql(DaoQuery daoQuery) {
 
        String hql = "from VIPOrderRecord r where 1=1";
 
        if (daoQuery.state != null) {
            hql += " and r.state=" + daoQuery.state;
        }
 
        if (daoQuery.uid != null) {
            hql += " and r.uid=" + daoQuery.uid;
        }
        return hql;
    }
 
 
    public List<VIPOrderRecord> list(DaoQuery daoQuery) {
        return super.list(getHql(daoQuery), daoQuery.start, daoQuery.count, null);
    }
 
 
    public long count(DaoQuery daoQuery) {
        return super.getCount(getHql(daoQuery),null);
    }
 
    public static class DaoQuery {
        public Integer state;
        public String uid;
        public int start;
        public int count;
    }
 
}