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

import com.ssj.bean.weixin.libmy.domain.TbLibBookPl;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;


@Repository
public interface IBookPlDao extends JpaRepository<TbLibBookPl, String> {

	TbLibBookPl findByIdAndUserId(String id, String userId);
	
	@Query(nativeQuery = true, value = "SELECT count(1) from tb_lib_book_pl t where t.user_id =?1 AND t.vip_ids LIKE CONCAT('%',?2,'%')")
	Integer countByUserIdAndVip(String userId, String vipId);

}
