package com.yaoai.domain.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yaoai.domain.entity.GraphRun;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.Optional;

@Mapper
public interface GraphRunMapper extends BaseMapper<GraphRun> {

    @Select("SELECT * FROM graph_runs WHERE project_id = #{projectId} AND tenant_id = #{tenantId} ORDER BY id DESC LIMIT 1")
    Optional<GraphRun> findLatestByProject(Long projectId, Long tenantId);
}
