package org.jebot.repository.jebot;

import org.jebot.models.jebot.BotAccountBookHistory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;

@Component
public interface BotAccountBookHistoryRepository extends JpaRepository<BotAccountBookHistory, Long> {

    @Query( "SELECT abh FROM bot_account_book_history abh WHERE abh.belongId = :dataId and abh.belongType =:belongType AND abh.type = :historyType and abh.createTime >= :startTime order by  abh.createTime desc")
    List<BotAccountBookHistory> findByBelongIdAndBelongTypeAndType(Long dataId, String belongType, String historyType, Date startTime);

}
