package com.hzs.bonus.detail.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.common.domain.member.detail.CuMemberLevel;
import com.hzs.common.domain.member.ext.CuMemberSettleExt;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 会员信息-等级升级记录 Mapper 接口
 *
 * @author hzs
 * @since 2022-10-11
 */
public interface CuMemberLevelMapper extends BaseMapper<CuMemberLevel> {

    /**
     * 删除自动升级的等级升级记录
     *
     * @param period
     * @return
     */
    Integer deleteCuMemberGrade(@Param("period") Integer period);

    /**
     * 查询可以升级的会员信息
     *
     * @param settleTableName
     * @param gradeValue
     * @param boxSmallTotal
     * @param boxTotal
     * @return
     */
    List<CuMemberSettleExt> listCuMemberSettleEnoughUpGrade(@Param("settleTableName") String settleTableName,
                                                            @Param("gradeValue") Integer gradeValue,
                                                            @Param("boxSmallTotal") Integer boxSmallTotal,
                                                            @Param("boxTotal") Integer boxTotal);

    /**
     * 批量插入等级记录
     *
     * @param cuMemberLevelList 需要插入的等级列表
     */
    Integer saveBatchCuMemberLevel(@Param("cuMemberLevelList") List<CuMemberLevel> cuMemberLevelList);

}
