package com.fzm.mall.server.front.user.service.impl;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzm.mall.server.front.user.model.SysMember;
import com.fzm.mall.server.front.user.mapper.SysMemberMapper;
import com.fzm.mall.server.front.user.service.ISysMemberService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;

/**
 * <p>
 * 会员配置表 服务实现类
 * </p>
 *
 * @author fzm
 * @since 2021-06-04
 */
@Service
public class SysMemberServiceImpl extends ServiceImpl<SysMemberMapper, SysMember> implements ISysMemberService {

    @Autowired
    private SysMemberMapper sysMemberMapper;
    @Override
    public SysMember getByMemberLevel(int i) {
        QueryWrapper<SysMember> q = new QueryWrapper<>();
        q.eq("level",i);
        return getOne(q);
    }

    @Override
    public int check(BigDecimal totalConsume, Integer count) {
        return sysMemberMapper.check(totalConsume,count);
    }
}
