package com.ssj.dao.weixin.library.dao;

import com.ssj.bean.weixin.libmy.domain.TbLibBookBase;
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 IBookBaseDao extends JpaRepository<TbLibBookBase, String> {
	
	@Query(nativeQuery = true, value = "select *  from tb_lib_book_base  where isbn13 = ?1 or csisbn=?1 limit 1 ")
	TbLibBookBase findByIsbn13(String isbn13);

	@Query(nativeQuery = true, value = "select *  from tb_lib_book_base  where csisbn = ?1  order by isbn13 asc ")
	List<TbLibBookBase> getBaseCsList(String isbn13);

	@Query(nativeQuery = true, value = "select *  from tb_lib_book_base  where isbn13 = ?2 and csisbn=?1 ")
	TbLibBookBase getBookcs(String isbn13, String csisbn);
	
	@Query(nativeQuery = true, value = "select *  from tb_lib_book_base  where isbn13 = ?1  limit 1")
	TbLibBookBase findInsertData(String isbn13);

	@Query(nativeQuery = true, value = "select *  from tb_lib_book_base  where book_gr is not null and   ")
	List<TbLibBookBase> findRecommendBook(int grTotal);

}
