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

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.ssj.bean.sys.fx.domain.Device;


@Repository
public interface DeviceDao extends JpaRepository<Device, String> {
	
	@Query(nativeQuery = true, value = " SELECT * from fx_device t where t.imei=?1  LIMIT 1 ")
	public Device getDeviceByImei(String imei);
	
	@Query(nativeQuery = true, value = " SELECT count(*) from fx_device t where t.pos_code=?1 ")
	public Integer countDeviceByPosCode(String posCode);
	
	public Page<Device> findAll(Specification<Device> specification, Pageable page);
	
	
}
