package org.jebot.repository.xxpay;

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

import java.math.BigDecimal;

@Component
public interface TransOrderRepository extends JpaRepository<TransOrder, Long> {

    @Query("SELECT SUM(t.Amount) FROM t_trans_order t WHERE t.MchId = :mchId AND t.CreateTime>= :startTime")
    BigDecimal findTransOrderAmountByMchIdAndCreateTime(Long mchId, String startTime);

}
