admin
2021-07-05 2f071296b9e1d7a3aa6b6f3818196aaa40af3300
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
45
46
47
48
49
50
51
52
53
54
55
56
package com.ks.vip.service.remote;
 
import com.ks.vip.dao.UserLijinRecordDao;
import com.ks.vip.pojo.DO.UserLijinRecord;
import com.ks.vip.service.LijinRecordService;
import org.apache.dubbo.config.annotation.Service;
import org.springframework.data.domain.Sort;
 
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
 
@Service(version = "1.0")
public class LijinRecordServiceImpl implements LijinRecordService {
 
    @Resource
    private UserLijinRecordDao userLijinRecordDao;
 
    @Override
    public List<UserLijinRecord> listRecord(String uid, Integer type, int page, int pageSize) {
        UserLijinRecordDao.DaoQuery daoQuery = new UserLijinRecordDao.DaoQuery();
        daoQuery.uid = uid;
        daoQuery.type = type;
        daoQuery.start = (page - 1) * pageSize;
        daoQuery.count = pageSize;
        daoQuery.sortList = Arrays.asList(new Sort.Order[]{new Sort.Order(Sort.Direction.DESC, "createTime")});
        return userLijinRecordDao.list(daoQuery);
    }
 
    @Override
    public long countRecord(String uid, Integer type) {
        UserLijinRecordDao.DaoQuery daoQuery = new UserLijinRecordDao.DaoQuery();
        daoQuery.uid = uid;
        daoQuery.type = type;
        return userLijinRecordDao.count(daoQuery);
    }
 
    @Override
    public UserLijinRecord getRecord(String uid, Integer type, String category, String identifyCode) {
 
        UserLijinRecordDao.DaoQuery daoQuery = new UserLijinRecordDao.DaoQuery();
        daoQuery.uid = uid;
        daoQuery.type = type;
        daoQuery.identifyCode = identifyCode;
        daoQuery.category = category;
        daoQuery.start = 0;
        daoQuery.count = 1;
        daoQuery.sortList = Arrays.asList(new Sort.Order[]{new Sort.Order(Sort.Direction.DESC, "createTime")});
        List<UserLijinRecord> list = userLijinRecordDao.list(daoQuery);
        if (list == null || list.size() == 0) {
            return null;
        }
        return list.get(0);
    }
}