package cn.datax.service.data.market.service.impl;

import cn.datax.common.base.BaseServiceImpl;
import cn.datax.service.data.market.api.dto.ApiLogDto;
import cn.datax.service.data.market.api.entity.ApiLogEntity;
import cn.datax.service.data.market.dao.ApiLogDao;
import cn.datax.service.data.market.mapstruct.ApiLogMapper;
import cn.datax.service.data.market.service.ApiLogService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
public class ApiLogServiceImpl extends BaseServiceImpl<ApiLogDao, ApiLogEntity> implements ApiLogService {

    @Autowired
    private ApiLogDao apiLogDao;

    @Autowired
    private ApiLogMapper apiLogMapper;

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void saveApiLog(ApiLogDto apiLogDto) {
        ApiLogEntity apiLog = apiLogMapper.toEntity(apiLogDto);
        apiLogDao.insert(apiLog);
    }
}
