package com.fzm.mall.server.front.user.mapper;

import com.fzm.mall.server.front.user.model.SysMember;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.math.BigDecimal;

/**
 * <p>
 * 会员配置表 Mapper 接口
 * </p>
 *
 * @author fzm
 * @since 2021-06-04
 */
public interface SysMemberMapper extends BaseMapper<SysMember> {

    @Select("select level from sys_member where total_recommend <=#{count} and total_consume <=#{totalConsume} order by level desc limit 1")
    int check(@Param("totalConsume") BigDecimal totalConsume, @Param("count") Integer count);
}
