package com.sonic.frog.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sonic.frog.dao.BuyCreateCountRecordDao;
import com.sonic.frog.domain.entity.BuyCreateCountRecord;
import com.sonic.frog.service.BuyCreateCountRecordService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;

/**
 * 用户购买相册创作次数记录 Service实现类
 */
@Slf4j
@Service
public class BuyCreateCountRecordServiceImpl extends ServiceImpl<BuyCreateCountRecordDao, BuyCreateCountRecord> implements BuyCreateCountRecordService {
    @Override
    public void add(Long userId, Long totalAmount, Integer count, String orderNo) {
        BuyCreateCountRecord buyCreateCountRecord = new BuyCreateCountRecord();
        buyCreateCountRecord.setUserId(userId);
        buyCreateCountRecord.setBuyNum(count);
        buyCreateCountRecord.setTotalAmount(totalAmount);
        buyCreateCountRecord.setOrderNo(orderNo);
        buyCreateCountRecord.setCreateTime(LocalDateTime.now());
        buyCreateCountRecord.setEditTime(LocalDateTime.now());
        save(buyCreateCountRecord);
    }
}