package com.ruoyi.system.service.impl;

import com.ruoyi.system.domain.PaymentGatewayLog;
import com.ruoyi.system.mapper.PaymentGatewayLogMapper;
import com.ruoyi.system.service.IPaymentGatewayLogService;
import org.springframework.stereotype.Service;

import java.util.Date;

@Service
public class PaymentGatewayLogServiceImpl implements IPaymentGatewayLogService {
    private final PaymentGatewayLogMapper gatewayLogMapper;

    public PaymentGatewayLogServiceImpl(PaymentGatewayLogMapper gatewayLogMapper) {
        this.gatewayLogMapper = gatewayLogMapper;
    }

    @Override
    public int append(PaymentGatewayLog gatewayLog) {
        if (gatewayLog == null) {
            return 0;
        }
        if (gatewayLog.getCreateTime() == null) {
            gatewayLog.setCreateTime(new Date());
        }
        return gatewayLogMapper.insert(gatewayLog);
    }
}

