admin
2025-04-20 24b1d8e38de30063e2fc8008265455da32e959b2
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.taoke.autopay.service.impl.credit;
 
import javax.annotation.Resource;
import java.util.List;
import com.taoke.autopay.service.credit.CreditExchangeRecordService;
import com.taoke.autopay.dao.credit.CreditExchangeRecordMapper.DaoQuery;
import java.util.Date;
import org.springframework.stereotype.Service;
import com.taoke.autopay.entity.credit.CreditExchangeRecord;
import com.taoke.autopay.dao.credit.CreditExchangeRecordMapper;
import org.springframework.transaction.annotation.Transactional;
 
@Service
public class CreditExchangeRecordServiceImpl implements CreditExchangeRecordService {
    @Resource
    private CreditExchangeRecordMapper creditExchangeRecordMapper;
 
    @Override
    public Long addExchangeRecord(CreditExchangeRecord record) {
        if (record.getCreateTime() == null) {
            record.setCreateTime(new Date());
        }
        creditExchangeRecordMapper.insertSelective(record);
        return  record.getId();
    }
 
    @Override
    public CreditExchangeRecord getExchangeRecordById(Long id) {
        return creditExchangeRecordMapper.selectByPrimaryKey(id);
    }
 
    @Transactional(rollbackFor = Exception.class)
    @Override
    public CreditExchangeRecord getExchangeRecordByIdForUpdate(Long id) {
        return creditExchangeRecordMapper.selectByPrimaryKeyForUpdate(id);
    }
 
    @Override
    public List<CreditExchangeRecord> listExchangeRecords(DaoQuery query) {
        return creditExchangeRecordMapper.list(query);
    }
 
    @Override
    public long countExchangeRecords(DaoQuery query) {
        return creditExchangeRecordMapper.count(query);
    }
 
    @Override
    public int updateExchangeRecord(CreditExchangeRecord record) {
        return creditExchangeRecordMapper.updateByPrimaryKeySelective(record);
    }
}