package com.izouma.dingdong.repo.rider;

import com.izouma.dingdong.domain.rider.Rider;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
import org.springframework.data.jpa.repository.Query;

import java.util.Optional;

public interface RiderRepo extends JpaRepository<Rider, Long>, JpaSpecificationExecutor<Rider> {

    Optional<Rider> findByUserId(Long userId);

    Rider findByJobNumber(String jobNumber);

    //骑手Id找出用户Id
    @Query("select t.userId from Rider t where t.id = ?1")
    Long findUserIdById(Long id);
}