package com.qqchen.deploy.backend.deploy.repository;

import com.qqchen.deploy.backend.framework.repository.IBaseRepository;
import com.qqchen.deploy.backend.deploy.entity.JenkinsSyncHistory;
import com.qqchen.deploy.backend.deploy.enums.ExternalSystemSyncStatus;
import com.qqchen.deploy.backend.deploy.enums.JenkinsSyncType;
import org.springframework.stereotype.Repository;

/**
 * Jenkin同步日志 Repository
 */
@Repository
public interface IJenkinsSyncHistoryRepository extends IBaseRepository<JenkinsSyncHistory, Long> {
    JenkinsSyncHistory findByNumber(String number);

    /**
     * 查找最后一次成功同步记录
     *
     * @param externalSystemId 外部系统ID
     * @param syncType 同步类型
     * @param status 同步状态
     * @return 同步历史记录
     */
    JenkinsSyncHistory findTopByExternalSystemIdAndSyncTypeAndStatusOrderByStartTimeDesc(
        Long externalSystemId,
        JenkinsSyncType syncType,
        ExternalSystemSyncStatus status
    );
} 