package cn.axzo.workflow.core.service.impl;

import cn.axzo.workflow.core.repository.entity.ExtAxApiLog;
import cn.axzo.workflow.core.repository.mapper.ExtAxApiLogMapper;
import cn.axzo.workflow.core.service.ExtAxApiLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Objects;

/**
 * Api Log 表操服务实现
 *
 * @author wangli
 * @since 2024/4/3 10:41
 */
@Service
@Slf4j
public class ExtAxApiLogServiceImpl implements ExtAxApiLogService {
    @Resource
    private ExtAxApiLogMapper apiLogMapper;

    @Override
    public Long insert(ExtAxApiLog apiLog) {
        if (Objects.isNull(apiLog.getRequestBody())) {
            apiLog.setRequestBody("");
        }
        if (Objects.isNull(apiLog.getResponseBody())) {
            apiLog.setResponseBody("");
        }
        apiLogMapper.insert(apiLog);
        return apiLog.getId();
    }
}
