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

import net.northking.cctp.executePlan.db.entity.AtuPlanInfo;
import net.northking.cctp.executePlan.db.mapper.AtuPlanInfoMapper;
import net.northking.cctp.executePlan.dto.planBatch.AtuPlanBatchDto;
import net.northking.cctp.executePlan.dto.planInfo.AtuPlanInfoDetailDto;
import net.northking.cctp.executePlan.dto.planInfo.AtuPlanInfoPageDto;
import net.northking.cctp.executePlan.dto.planInfo.AtuPlanInfoQueryDto;
import net.northking.cctp.executePlan.dto.planInfo.AtuPlanPrincipalDto;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Mybatis数据库持久层（业务层）：执行计划表
 *
 * <p>文件内容由代码生成器产生，请不要手动修改！ <br>
 * createdate:  2022-12-07 17:41:08  <br>
 * @author:  maven-cctp-plugin  <br>
 * @since:  1.0 <br>
 */
@Repository
public interface AtuPlanInfoDao extends AtuPlanInfoMapper
{
    /**
     * 根据最后批次ID查询计划信息
     * @param batchId 批次ID
     * @return 计划信息
     */
    AtuPlanInfo queryByLastBatchId(String batchId);

    /**
     * 查询设置该计划为前置执行的计划ID集合
     * @param planId 计划ID
     * @return 计划ID集合
     */
    List<String> queryFollowUpPlanIdList(String planId);

    List<AtuPlanInfoDetailDto> queryPageByPlan(AtuPlanInfoQueryDto dto);

    String clonePlanName(AtuPlanInfo atuPlanInfo);

    List<String> checkPlanName(AtuPlanInfo atuPlanInfo);

    /**
     * 根据批次ID查询计划信息
     * @param batchId 批次ID
     * @return 计划信息
     */
    AtuPlanInfo findByBatchId(String batchId);

    /**
     * 根据任务ID查询计划信息
     * @param taskId 任务ID
     * @return 计划信息
     */
    AtuPlanBatchDto queryByTaskId(String taskId);

    /**
     * 更新计划下一次执行时间
     * @param atuPlanInfo 计划信息
     * @return 结果
     */
    Integer updatePlanNextExecTime(AtuPlanInfo atuPlanInfo);

    /**
     * 根据批次编号修改计划状态
     * @param batchId 批次编号
     * @param status 状态
     * @return 结果
     */
    Integer updatePlanByLastBatchId(@Param(value = "batchId") String batchId,
                                    @Param(value = "status") String status);

    Integer updatePlanByIds(@Param("ids")List<String> ids);
    // ----      The End by Generator     ----//
    List<AtuPlanInfo> queryPlanInfoByIds(List<String> execplanIdList);

    Integer checkNameUnique(AtuPlanInfo info);

    void updatePrincipal(AtuPlanPrincipalDto dto);

    List<AtuPlanInfoDetailDto> queryUpFrontPlan(AtuPlanInfoPageDto dto);

    List<AtuPlanInfo> queryByPage(@Param("fromIndex") int fromIndex, @Param("toIndex") int toIndex);

    Integer countDeleted(AtuPlanInfo countParams);

    Integer updatePlanRetryCount(AtuPlanInfo entity);

    List<String> selectManagerByProject(@Param("projectId") String projectId);

    List<String> selectCreatorByProject(@Param("projectId") String projectId);

    List<String> selectUpdaterByProject(@Param("projectId") String projectId);

}
