package com.qmth.themis.business.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.qmth.themis.business.dao.TBTaskHistoryMapper;
import com.qmth.themis.business.dto.response.TBTaskDto;
import com.qmth.themis.business.entity.TBTaskHistory;
import com.qmth.themis.business.enums.TaskStatusEnum;
import com.qmth.themis.business.enums.TaskTypeEnum;
import com.qmth.themis.business.service.TBTaskHistoryService;
import org.springframework.stereotype.Service;

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

/**
 * @Description: 异步任务 服务实现类
 * @Param:
 * @return:
 * @Author: wangliang
 * @Date: 2020/7/9
 */
@Service
public class TBTaskHistoryServiceImpl extends ServiceImpl<TBTaskHistoryMapper, TBTaskHistory>
		implements TBTaskHistoryService {

	@Resource
	TBTaskHistoryMapper tbTaskHistoryMapper;

	/**
	 * 查询任务
	 *
	 * @param iPage
	 * @param taskId
	 * @param entityId
	 * @param type
	 * @param status
	 * @param orgId
	 * @return
	 */
	@Override
	public IPage<TBTaskDto> taskQuery(IPage<Map> iPage, Long taskId, Long entityId, TaskTypeEnum type,
			TaskStatusEnum status, Long orgId,Long examId) {
		return tbTaskHistoryMapper.taskQuery(iPage, taskId, entityId, Objects.isNull(type) ? null : type.name(),
				Objects.isNull(status) ? null : status.name(), orgId,examId);
	}
}
