/*
* Copyright (c) 京北方信息技术股份有限公司 Corporation 2021 . All rights reserved.
*
*/
package net.northking.cctp.dw.db.impl;

import net.northking.cctp.common.cache.EntityNameCache;
import net.northking.cctp.common.db.BasicDao;
import net.northking.cctp.common.db.PaginationService;
import net.northking.cctp.dw.db.dao.MidManualExecJobDao;
import net.northking.cctp.dw.db.dao.MtCaseExecChartDao;
import net.northking.cctp.dw.db.entity.*;
import net.northking.cctp.dw.db.service.MidManualExecJobService;
import net.northking.cctp.dw.dto.MidManualExecJobDetailDto;
import net.northking.cctp.dw.dto.ProjectDataVo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


/**
 * 执行数据中间表
 *
 * <p>文件内容由代码生成器产生，请不要手动修改！ <br>
 * createdate:  2021-12-15 10:09:06  <br>
 * @author:  maven-cctp-plugin  <br>
 * @since:  1.0 <br>
 */
@Service
@ConditionalOnMissingBean(name = "MidManualExecJobServiceImpl")
public class MidManualExecJobServiceImpl extends PaginationService<MidManualExecJob> implements MidManualExecJobService
{
private static final Logger logger = LoggerFactory.getLogger(MidManualExecJobServiceImpl.class);

  private final MidManualExecJobDao midManualExecJobDao;

  @Autowired
  private EntityNameCache entityNameCache;

  @Autowired
  private MtCaseExecChartDao mtCaseExecChartDao;

  public MidManualExecJobServiceImpl(MidManualExecJobDao midManualExecJobDao) {this.midManualExecJobDao = midManualExecJobDao;}

  public BasicDao<MidManualExecJob> getDao() {return midManualExecJobDao;}

  public MidManualExecJob createEntity() { return new MidManualExecJob();}

  @Override
  protected void beforeInsert(MidManualExecJob midManualExecJob) {

  }

  @Override
  protected void beforeUpdate(MidManualExecJob midManualExecJob) {

  }

  @Override
  public List<MidManualExecJobDetailDto> execJobPie(String projectId) {
    return midManualExecJobDao.execJobPie(projectId);
  }

  @Override
  public List<MtTestChart> createExecJobProgress(String tenantId) {
    return midManualExecJobDao.createExecJobProgress(tenantId);
  }

  @Override
  public Integer countExecJobData(List<MidProjectInfo> midProjectInfos,String tenantId) {
    return midManualExecJobDao.countExecJobData(midProjectInfos,tenantId);
  }

  @Override
  public List<MidManualExecJob> findByTenantId(List<MidProjectInfo> midProjectInfos) {
    return midManualExecJobDao.findByTenantId(midProjectInfos);
  }

  @Override
  public List<DwManualExecJob> findProIdList() {
    return midManualExecJobDao.findProIdList();
  }

  @Override
  public void deleteByData(List<MidProjectInfo> midProjectInfos) {
    midManualExecJobDao.deleteByData(midProjectInfos);
  }

  @Override
  public List<MtCaseExecChart> getNoExecCaseAmountByProjectId(String projectId) {
    List<MtCaseExecChart> query = mtCaseExecChartDao.queryByProjectId(projectId);
    if (null==query||query.size()==0)return new ArrayList<>();
    return query;
  }

  @Override
  public ProjectDataVo getCaseBugFindRateByTenantId(String tenantId,List<String> projectIds) {
    return midManualExecJobDao.getCaseBugFindRateByTenantId(tenantId,projectIds);
  }

  @Override
  public ProjectDataVo getCaseBugFindRateByProjectId(String projectId) {
    return midManualExecJobDao.getCaseBugFindRateByProjectId(projectId);
  }
}

