yujian
2020-05-09 7e7db2fa55a9a3af46d4fd8ede0dee147f101d64
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
package com.yeshi.fanli.service.impl.push;
 
import java.util.List;
 
import javax.annotation.Resource;
 
import org.springframework.stereotype.Service;
 
import com.yeshi.fanli.dao.mybatis.push.PushRecordMapper;
import com.yeshi.fanli.entity.xinge.PushRecord;
import com.yeshi.fanli.service.inter.push.PushRecordService;
@Service
public class PushRecordServiceImpl implements PushRecordService {
    
    @Resource
    private PushRecordMapper pushRecordMapper;
 
 
    public List<PushRecord> getPushRecordList(long start, int pageSize,String key, int type) {
        return pushRecordMapper.listQuery(start, pageSize, key, type);
    }
 
    public Long getCount(String title, int type) {
        return pushRecordMapper.countQuery(title, type);
    }
 
    public void increaseByAndroid(String pushId) {
        PushRecord pushRecord = pushRecordMapper.getByAndroidPushId(pushId);
        if (pushRecord != null) {
            Long count = pushRecord.getCount();
            if(count == null) {
                pushRecord.setCount(1L);
            } else {
                pushRecord.setCount(count + 1);
            }
            pushRecordMapper.updateByPrimaryKeySelective(pushRecord);
        }
    }
 
    public void increaseByIOS(String pushId) {
        PushRecord pushRecord = pushRecordMapper.getByIosPushId(pushId);
        if (pushRecord != null) {
            Long count = pushRecord.getCount();
            if(count == null) {
                pushRecord.setCount(1L);
            } else {
                pushRecord.setCount(count + 1);
            }
            pushRecordMapper.updateByPrimaryKeySelective(pushRecord);
        }
    }
}