package com.ywt.outpatient.domain.entity.center;

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;
import java.util.Optional;


public interface AccountRepository extends JpaRepository<Account, Integer> {

    @Query(value = "Select * From account Where user_id = ? and deleted = 0 limit 1 ;", nativeQuery = true)
    List<Account> findByUserId(Integer userId);

    @Override
    Optional<Account> findById(Integer id);

    @Query(value = "select * from account where user_id = ? and deleted = 0 limit 1;", nativeQuery = true)
    Account getByUserId(Integer userId);
}
