package com.starry.admin.modules.withdraw.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.starry.admin.modules.withdraw.entity.WithdrawalLogEntity;
import com.starry.admin.modules.withdraw.mapper.WithdrawalLogMapper;
import com.starry.admin.modules.withdraw.service.IWithdrawalLogService;
import com.starry.common.utils.IdUtils;
import org.springframework.stereotype.Service;

@Service
public class WithdrawalLogServiceImpl extends ServiceImpl<WithdrawalLogMapper, WithdrawalLogEntity>
        implements IWithdrawalLogService {

    @Override
    public void log(String tenantId, String clerkId, String withdrawalId, String eventType, String from, String to,
                    String message, String payload) {
        WithdrawalLogEntity e = new WithdrawalLogEntity();
        e.setId(IdUtils.getUuid());
        e.setTenantId(tenantId);
        e.setClerkId(clerkId);
        e.setWithdrawalId(withdrawalId);
        e.setEventType(eventType);
        e.setStatusFrom(from);
        e.setStatusTo(to);
        e.setMessage(message);
        e.setPayload(payload);
        this.save(e);
    }
}
