package com.red.circle.order.infra.database.rds.dao.order;

import com.red.circle.common.business.core.enums.SysOriginPlatformEnum;
import com.red.circle.framework.mybatis.dao.BaseDAO;
import com.red.circle.order.infra.database.rds.entity.order.OrderPurchaseHistory;
import java.math.BigDecimal;
import java.util.List;
import java.util.Set;
import org.apache.ibatis.annotations.Param;

/**
 * <p>
 * 购买记录 Mapper 接口
 * </p>
 *
 * @author pengliang
 * @since 2020-03-20
 */
public interface OrderPurchaseHistoryDAO extends BaseDAO<OrderPurchaseHistory> {

  /**
   * 今日内购总额(生产订单).
   */
  BigDecimal purchaseTodayTotal();

  /**
   * 今日内购总额(生产订单).
   *
   * @param sysOrigin 来源系统
   */
  BigDecimal purchaseTodayTotalBySysOrigin(@Param("sysOrigin") SysOriginPlatformEnum sysOrigin);


  /**
   * 今日内购.
   */
  List<OrderPurchaseHistory> purchaseTodayBySysOrigin(
      @Param("sysOrigin") String sysOrigin,
      @Param("userIds") Set<Long> userIds
  );

  /**
   * 根据用户ID查询购买总额
   *
   * @param userId 用户ID
   * @return 总额
   */
  BigDecimal getPurchaseTotalByUserId(@Param("userId") Long userId);

}
