package com.docus.server.archivefile.service.impl;

import com.docus.infrastructure.web.request.SearchRequest;
import com.docus.infrastructure.web.response.PageResult;
import com.docus.server.archivefile.infrastructure.dao.ITaskMessageRetryLogDao;
import com.docus.server.archivefile.service.ITaskMessageRetryLogService;
import com.docus.server.entity.TaskMessageRetryLog;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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

@Service
public class TaskMessageRetryLogServiceImpl implements ITaskMessageRetryLogService {
    @Resource
    private ITaskMessageRetryLogDao taskMessageRetryLogDao;

    @Override
    public List<TaskMessageRetryLog> findByTaskIds(List<Long> taskIds) {
        return taskMessageRetryLogDao.findBy("messageId", taskIds);
    }

    @Override
    public TaskMessageRetryLog findById(String id) {
        return taskMessageRetryLogDao.findById(id);
    }

    @Override
    public PageResult<TaskMessageRetryLog> search(SearchRequest searchRequest) {
        return taskMessageRetryLogDao.search(searchRequest);
    }

    @Transactional(rollbackFor = Exception.class)
    @Override
    public void saveTaskMessageRetryLog(TaskMessageRetryLog taskMessageRetryLog) {
        taskMessageRetryLogDao.save(taskMessageRetryLog);
    }
}