package com.ssj.dao.sys.fx.dao;

import com.ssj.bean.sys.fx.domain.DeviceActive;
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 DeviceActiveDao extends JpaRepository<DeviceActive, String> {

	@Query(nativeQuery = true, value = " SELECT * from fx_device_active t where t.pos_code=?1 AND t.imei is NULL ORDER BY t.create_time ASC LIMIT 1 ")
	public DeviceActive getDeviceActiveByPosCode(String posCode);
	
	@Query(nativeQuery = true, value = " SELECT * from fx_device_active t where t.batch_code=?1 ORDER BY t.create_time ASC ")
	public List<DeviceActive> findDeviceActiveByBatchCode(String batchCode);
	
}
