package com.hzs.bonus.bonus.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hzs.bonus.bonus.service.ICuMemberBonusPushHisService;
import com.hzs.common.core.constant.MemberFieldConstants;
import com.hzs.common.domain.member.bonus.CuMemberBonusPushHis;
import com.hzs.bonus.bonus.mapper.CuMemberBonusPushHisMapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 会员奖金-直推历史轮次记录 服务实现类
 * </p>
 *
 * @author hzs
 * @since 2023-09-10
 */
@Service
public class CuMemberBonusPushHisServiceImpl extends ServiceImpl<CuMemberBonusPushHisMapper, CuMemberBonusPushHis> implements ICuMemberBonusPushHisService {

    @Override
    public List<CuMemberBonusPushHis> queryCuMemberBonusPushHis(Long pkMember) {
        QueryWrapper<CuMemberBonusPushHis> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("(round+1) round,second,cal_achieve");
        queryWrapper.eq(MemberFieldConstants.PK_MEMBER, pkMember);
        queryWrapper.orderByDesc("round,second");
        return baseMapper.selectList(queryWrapper);
    }
}
