package org.hx.springboot_jpa_demo30.dao;import org.hx.springboot_jpa_demo30.model.Book;import org.springframework.data.jpa.repository.JpaRepository;import org.springframework.data.jpa.repository.Modifying;import org.springframework.data.jpa.repository.Query;import java.util.List;publicinterfaceBookDaoextendsJpaRepository<Book,Integer>{
List<Book>getBookByAuthorEquals(String author);@Query(nativeQuery =true,value ="select * from t_book where id=(select max(id) from t_book)")
Book maxIdBook();@Query("update t_book set b_name=:name where id=:id")@ModifyingvoidupdateBookById(String name ,Integer id);}