package com.ywt.mg.domain.entities;

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

import javax.transaction.Transactional;

public interface OfflineConsultationRepository extends JpaRepository<OfflineConsultation, Integer> {

    @Modifying
    @Transactional
    @Query(value = "update offline_consultation set order_id = ?1, order_no = ?2 where id = ?3", nativeQuery = true)
    void updateOrderIdAndOrderNoById(int orderId, String orderNo, int id);

    OfflineConsultation getFirstByOrderIdAndDeletedFalse(int orderId);
}
