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

import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

import com.ssj.bean.weixin.libmy.domain.LibBookSwitchInfo;

import java.util.List;


@Repository
public interface IBookSwitchInfoDao extends JpaRepository<LibBookSwitchInfo, String> {

    @Query(nativeQuery = true,value = "select * from tb_lib_book_switch_info where lib_id=?1 and type=?2 and state=1 limit 500 ")
    List<LibBookSwitchInfo> findSwitchList(String searchLibId, int type);

    @Query(nativeQuery = true,value = "select * from tb_lib_book_switch_info where lib_id=?1 and type=?2 and state=1 and book_detail_id=?3 ")
    LibBookSwitchInfo findSwitchInfo(String libId, Integer type,String detailId);
}
