admin
2020-05-19 744594ef1a2f530fc3e86ea9dc48b62247f79420
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
package com.yeshi.fanli.service.impl.user;
 
import java.util.Date;
 
import javax.annotation.Resource;
 
import org.springframework.stereotype.Service;
 
import com.yeshi.fanli.dao.mybatis.user.UserSystemCouponActivateMapper;
import com.yeshi.fanli.entity.bus.user.UserSystemCouponActivate;
import com.yeshi.fanli.service.inter.config.ConfigService;
import com.yeshi.fanli.service.inter.user.UserSystemCouponActivateService;
 
@Service
public class UserSystemCouponActivateServiceImpl implements UserSystemCouponActivateService{
 
    @Resource
    private UserSystemCouponActivateMapper userSystemCouponActivateMapper;
    
    @Resource
    private ConfigService configService;
    
    
    
    @Override
    public UserSystemCouponActivate selectForUpdate(Long id) {
        return userSystemCouponActivateMapper.selectForUpdate(id);
    }
    
    @Override
    public void addActivateRecord(Long id) {
        UserSystemCouponActivate record = new UserSystemCouponActivate();
        record.setId(id);
        record.setCount(0);
        record.setState(UserSystemCouponActivate.STATE_INIT);
        record.setCreateTime(new Date());
        record.setUpdateTime(new Date());
        userSystemCouponActivateMapper.insertSelective(record);
    }
    
    @Override
    public void updateByPrimaryKeySelective(UserSystemCouponActivate record) {
        userSystemCouponActivateMapper.updateByPrimaryKeySelective(record);
    }
    
    @Override 
    public int getActivateCount(Long id) {
        UserSystemCouponActivate coupon = userSystemCouponActivateMapper.selectByPrimaryKey(id);
        if (coupon != null)
            return coupon.getCount();
        
        return 0;
    }
}