/**
 * 
 */
package org.springblade.etl.service;

import java.util.List;

import org.springblade.etl.dto.InstanceStatusCount;
import org.springblade.etl.dto.etl.JobStatReq;
import org.springblade.etl.dto.etl.JobStatRes;
import org.springblade.etl.dto.vo.InstanceCountVO;
import org.springblade.etl.entity.SqlJobInstance;
import org.springblade.etl.mapper.SqlJobInstanceMapper;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

/**
 *	SQL任务实例 服务处理
 *
 * @author aokunsang
 * @date   2023-12-03
 */
@Service
public class SqlJobInstanceService extends ServiceImpl<SqlJobInstanceMapper, SqlJobInstance>{
	/**
	 * 
	 * @param page
	 * @param queryWrapper
	 * @return
	 */
	public IPage<SqlJobInstance> customPage(IPage<SqlJobInstance> page, LambdaQueryWrapper<SqlJobInstance> queryWrapper){
		return baseMapper.customPage(page, queryWrapper);
	}
	
	/**
	 * 
	 * @param queryWrapper
	 * @return
	 */
	public Long countPage(LambdaQueryWrapper<SqlJobInstance> queryWrapper) {
		return baseMapper.countPage(queryWrapper);
	}
	
	/**
	 * 
	 * @param jobId
	 * @return
	 */
	public InstanceStatusCount statInstanceStatusByJobId(Integer jobId) {
		return baseMapper.statInstanceStatusByJobId(jobId);
	}
	
	/**
	 * @param statReq
	 * @return
	 */
	public List<JobStatRes> stat(JobStatReq statReq){
		return baseMapper.stat(statReq);
	}

	/**
	 * 查询sql运行各种状态的总数
	 */
	public InstanceCountVO getCounts() {

		return baseMapper.getCounts();
	}

	/**
	 * 30天实例运行折线图
	 */
	public List<InstanceCountVO> getCountByDate() {

		return baseMapper.getCountByDate();
	}

	/**
	 * 7天sql饼图和sql簇状图
	 */
	public List<InstanceCountVO> getCountByDays(Integer day) {

		return baseMapper.getCountByDays(day);
	}

	/**
	 * sql当天24小时调度折柱图
	 */
	public List<InstanceCountVO> instanceLineChart() {

		return baseMapper.instanceLineChart();
	}

	/**
	 * 当日饼图
	 */
	public InstanceCountVO getCountToday() {

		return baseMapper.getCountToday();
	}

    public IPage<SqlJobInstance> pageDo(IPage<SqlJobInstance> page) {

		return baseMapper.pageDo(page);
    }
}