DeviceRepo.java 1.1 KB

12345678910111213141516171819202122232425262728293031
  1. package cn.efunbox.audio.repository;
  2. import cn.efunbox.audio.entity.Device;
  3. import org.springframework.data.domain.Pageable;
  4. import org.springframework.data.jpa.repository.JpaRepository;
  5. import org.springframework.data.jpa.repository.Query;
  6. import org.springframework.data.repository.query.Param;
  7. import org.springframework.stereotype.Repository;
  8. import java.util.List;
  9. /**
  10. * Created by yao on 17-9-26.
  11. */
  12. @Repository
  13. public interface DeviceRepo extends JpaRepository<Device, Long> {
  14. Device findById(Long id);
  15. List<Device> findByIdDevice(Long idDevice);
  16. List<Device> findByIdChannel(Long idChannel, Pageable pageable);
  17. @Query("from Device d where d.idDevice=:idDevice")
  18. List<Device> findByDevice(@Param("idDevice")String idDevice);
  19. @Query("from Device d where d.idChannel=:idChannel")
  20. List<Device> findByChannel(@Param("idChannel")String idChannel);
  21. @Query("from Device d where d.idChannel=:idChannel and d.idDevice=:idDevice")
  22. List<Device> findByChannelDevice(@Param("idChannel")Long idChannel, @Param("idDevice")Long idDevice);
  23. }