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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
package com.yeshi.fanli.service.impl.user;
 
import java.util.List;
 
import javax.annotation.Resource;
 
import org.springframework.stereotype.Service;
 
import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponGiveRecordMapper;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserSystemCouponGiveRecord;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponGiveRecordService;
 
@Service
public class UserSystemCouponGiveRecordServiceImpl implements UserSystemCouponGiveRecordService{
 
    @Resource
    private UserSystemCouponGiveRecordMapper userSystemCouponGiveRecordMapper;
    
    @Resource
    private UserInfoService userInfoService;
    
    @Override
    public void insertSelective(UserSystemCouponGiveRecord record) {
        userSystemCouponGiveRecordMapper.insertSelective(record);
    }
    
    @Override
    public UserSystemCouponGiveRecord selectByPrimaryKey(Long id) {
        return userSystemCouponGiveRecordMapper.selectByPrimaryKey(id);
    }
    
    @Override
    public UserSystemCouponGiveRecord getRecordByUidAndCouponId(Long giveUid, Long couponId) {
        return userSystemCouponGiveRecordMapper.getRecordByUidAndCouponId(giveUid, couponId);
    }
    
    @Override
    public void updateByPrimaryKeySelective(UserSystemCouponGiveRecord giveRecord) {
        userSystemCouponGiveRecordMapper.updateByPrimaryKeySelective(giveRecord);
    }
    
    @Override
    public List<UserSystemCouponGiveRecord> overdueList(int count) {
        return userSystemCouponGiveRecordMapper.overdueList(count);
    }
    
    @Override
    public List<UserSystemCouponGiveRecord> overdueListByUser(Long uid) {
        return userSystemCouponGiveRecordMapper.overdueListByUser(uid);
    }
 
    @Override
    public UserSystemCouponGiveRecord getByReceiveId(Long receiveId) {
        return userSystemCouponGiveRecordMapper.getByReceiveId(receiveId);
    }
    
    @Override
    public List<UserSystemCouponGiveRecord> listGiveRecord(long start, int count, String type, Integer state) {
        List<UserSystemCouponGiveRecord> list = userSystemCouponGiveRecordMapper.listGiveRecord(start, count, type, state);
        if (list == null || list.size() == 0)            
            return list;
        
        for (UserSystemCouponGiveRecord giveRecord: list) {
            UserInfo giveUser = userInfoService.selectByPKey(giveRecord.getGiveUid());
            if (giveUser != null) 
                giveRecord.setGiveName(giveUser.getNickName());
            
            Long receiveUid = giveRecord.getReceiveUid();
            if (receiveUid == null)
                continue;
            
            UserInfo receiveUser = userInfoService.selectByPKey(receiveUid);
            if (receiveUser != null) 
                giveRecord.setReceiveName(receiveUser.getNickName());
        }
        return list;
    }
    
    
    @Override
    public long countGiveRecord(String type, Integer state) {
        return userSystemCouponGiveRecordMapper.countGiveRecord(type, state);
    }
 
    @Override
    public UserSystemCouponGiveRecord getByCouponId(Long couponId) {
        return userSystemCouponGiveRecordMapper.getByCouponId(couponId);
    }
}