package com.ssj.dao.conch.conch.dao;



import com.ssj.bean.conch.conch.domain.ConchSystemDerver;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface ConchSystemDerverDao extends JpaRepository<ConchSystemDerver, String> {
     @Query(nativeQuery = true, value = " SELECT * from conch_system_derver where imei = ?1 and simcard =?2 ")
     public ConchSystemDerver findByImeiAndSimcard(String imei, String simcard);

     @Query(nativeQuery = true, value = " SELECT * from conch_system_derver where imei = ?1   ")
     public List<ConchSystemDerver> findByImei(String imei);

     @Query(nativeQuery = true, value = " SELECT * from conch_system_derver where simcard =?1 order by  created_date desc limit 1 ")
     public ConchSystemDerver findBySimcard(String simcard);

     @Query(nativeQuery = true, value = " SELECT * from conch_system_derver where old_derver = ?1  order by  created_date desc  limit 1 ")
     public ConchSystemDerver findByOldDerver(String oldDerver);
}
