1. @Query(value = "select name,author,price from Book b where b.price>?1 and b.price<?2")
    List<Book> findByPriceRange(long price1, long price2);

  2. @Query(value = "select name,author,price from Book b where b.name like %:name%")
    List<Book> findByNameMatch(@Param("name") String name);

  3. @Query(value = "select * from book b where b.name=?1", nativeQuery = true)
    List<Book> findByName(String name);

  4. @Query(value = "select name,author,price from Book b where b.name = :name AND b.author=:author AND b.price=:price")
    List<Book> findByNamedParam(@Param("name") String name, @Param("author") String author,
    @Param("price") long price);

posted on 2021-03-25 18:15  qiao1127  阅读(114)  评论(0)    收藏  举报