package cc.mrbird.febs.mall.service.impl; import cc.mrbird.febs.common.enumerates.YesOrNoEnum; import cc.mrbird.febs.common.utils.LoginUserUtil; import cc.mrbird.febs.mall.conversion.RunVipConversion; import cc.mrbird.febs.mall.entity.MallMember; import cc.mrbird.febs.mall.entity.RunVip; import cc.mrbird.febs.mall.mapper.RunVipMapper; import cc.mrbird.febs.mall.service.IRunVipService; import cc.mrbird.febs.mall.vo.ApiRunVipVo; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.List; @Slf4j @Service @RequiredArgsConstructor public class RunVipServiceImpl extends ServiceImpl implements IRunVipService { @Override public List vipInfo() { MallMember member = LoginUserUtil.getLoginUser(); List apiRunVipVos = new ArrayList<>(); if (StrUtil.isEmpty(member.getLevel())) { return apiRunVipVos; } String level = member.getLevel(); //获取当前用户的VIP等级 RunVip runVip = this.baseMapper.selectOne(new LambdaQueryWrapper().eq(RunVip::getVipCode, level)); //获取大于当前用户等级序号的所有的VIP等级 LambdaQueryWrapper runVipLambdaQueryWrapper = new LambdaQueryWrapper<>(); runVipLambdaQueryWrapper.eq(RunVip::getState, YesOrNoEnum.YES.getValue()); runVipLambdaQueryWrapper.gt(RunVip::getOrderNumber, runVip.getOrderNumber()); List runVips = this.baseMapper.selectList(runVipLambdaQueryWrapper); apiRunVipVos = RunVipConversion.INSTANCE.entityToVos(runVips); return apiRunVipVos; } }