package com.nmgs.mapper;


import com.github.jeffreyning.mybatisplus.base.MppBaseMapper;
import com.nmgs.entity.IntegrationList;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

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

@Mapper
public interface IntegrationListMapper extends MppBaseMapper<IntegrationList> {


    /**
     * 获取用户增加积分清单
     * @param params
     * @return
     */
    List<IntegrationList> getUserAddIntegation(@Param("params") Map<String, Object> params);

    /**
     * 获取用户消费积分清单
     * @param params
     * @return
     */
    List<IntegrationList> getUserPayIntegation(@Param("params") Map<String, Object> params);

    Integer getMaxId();

    /**
     * 获取每日积分增长量
     * @param param
     * @return
     */
    List<Map<String, Object>> getIntegrationGrowTotal(@Param("params")Map<String, Object> param);

    /**
     * 获取车辆积分增长量排名前十
     * @param params
     * @return
     */
    List<Map<String, Object>> getCarIntegrationGrowTotal(@Param("params")Map<String, Object> params);

    /**
     * 获取月增长积分、消费积分
     * @param params
     * @return
     */
    Map<String, Object> getMonthFeeTotal(@Param("params")Map<String, Object> params);

    /**
     * 消费积分分类占比
     * @param params
     * @return
     */
    List<Map<String, Object>> getFeeTypeTotal(@Param("params")Map<String, Object> params);

    /**
     * 根据日期获取排名积分奖励情况
     * @param params
     * @return
     */
    List<IntegrationList> getAMEScoreByTime(@Param("params") Map<String, Object> params);

    @Select("select max(list.TOTALADDINTEGRATION) from INTEGRATION_LIST_TABLE list where list.USERID = #{id}")
    BigDecimal getTotalAddIntegrationByUserId(@Param("id")Integer id);
}
