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

import com.ssj.bean.weixin.libmy.domain.TbJxyReadIn;
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 IOneBookDao extends JpaRepository<TbJxyReadIn, String>{

	@Query(nativeQuery = true, value = "select *  from tb_jxy_read_in  where isbn13=?1 order by create_time desc limit 3 ")
	List<TbJxyReadIn> getTop3Recode(String isbn13);
	
	@Query(nativeQuery = true, value = "select count(1)  from tb_jxy_read_in  where isbn13=?1 ")
	int getCountByIsbn(String isbn13);
	
	@Query(nativeQuery = true, value = "select *  from tb_jxy_read_in  where isbn13=?2 and user_id=?1  limit 1 ")
	TbJxyReadIn findInfoByUserIsbn(String id, String isbn13);
	
	@Query(nativeQuery = true, value = "select count(1)  from tb_jxy_read_sign  where isbn13=?1 and user_id = ?2 ")
	int getCountSign(String isbn13, String userId);
	
	public TbJxyReadIn findByisbn13AndUserId(String isbn13,String userId);
	
	@Query(nativeQuery = true, value = "SELECT content from tb_word where type=?1 ")
	List<String> findWordList(int type);

}
