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);
|
}
|
}
|