package com.hai.dao;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;
import java.util.Map;

/**
 * mapper扩展类
 */
public interface BsDistributionRebateMapperExt {


    @Select({
            "<script> " +
             " select count(*) as count , sum(integral_num) as sum from bs_distribution_rebate where popularize_user_id = #{userId} " +
             "</script>"
    })
    Map<String, Object> countDistribution(@Param("userId") Long userId);

    @Select({
            "<script> " +
              " SELECT sum(integral_num) FROM bs_distribution_rebate WHERE DATEDIFF(create_time,NOW())=0 and  popularize_user_id = #{userId} " +
            "</script>"
    })
    BigDecimal toDayIntegralNum(@Param("userId") Long userId);

}
