package com.hzs.retail.member.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.common.domain.member.achieve.CuMemberRetailRange;
import com.hzs.retail.member.param.MarketDynamicsQueryDateParam;
import com.hzs.retail.member.vo.CuMemberRetailAchieveVO;
import com.hzs.retail.member.vo.CuMemberRetailDataStatisticsDetailVO;
import com.hzs.retail.member.vo.MarketDynamicsDetailVO;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

/**
 * Mapper 接口
 */
public interface CuMemberRetailRangeMapper extends BaseMapper<CuMemberRetailRange> {
    /**
     * 查询会员直推会员
     *
     * @param pkMember 会员主键
     * @return List<Long>
     */
    List<Long> selectDirectPushByPkMember(@Param("pkMember") Long pkMember, @Param("systemType") Integer systemType);

    /**
     * 查询大区用户信息
     *
     * @param cuMemberAchieveVO
     * @return
     */
    CuMemberRetailAchieveVO selectBigAreaByPkMember(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 查询表名是否存在
     *
     * @param tableNames 表名
     * @return List<String>
     */
    List<String> selectTableNameIsExist(@Param("tableNames") List<String> tableNames);

    /**
     * 查询会员当天是否下订单
     *
     * @param pkMember 会员
     * @return Integer
     */
    CuMemberRetailAchieveVO selectMemberOrderByPkMember(@Param("pkMember") Long pkMember);


    /**
     * 查询会员的极差业绩
     *
     * @param cuMemberAchieveVO 入参
     * @return CuMemberAchieveVO
     */
    List<CuMemberRetailAchieveVO> selectMemberParentByPkMember(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 查询会员没有注水的大区盒数
     *
     * @param cuMemberAchieveVO 入参
     * @return CuMemberRetailAchieveVO
     */
    BigDecimal selectMemberBoxNoWaterInjection(CuMemberRetailAchieveVO cuMemberAchieveVO);


    /**
     * 查询会员注水的大区盒数
     *
     * @param cuMemberAchieveVO 入参
     * @return CuMemberRetailAchieveVO
     */
    BigDecimal selectMemberBoxWaterInjection(CuMemberRetailAchieveVO cuMemberAchieveVO);


    /**
     * 查询会员最大盒数
     *
     * @param cuMemberAchieveVO 入参
     * @return CuMemberRetailAchieveVO
     */
    BigDecimal selectMemberTotalBox(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 查询会员业绩
     *
     * @param cuMemberAchieveVO 入参
     * @return List<CuMemberRetailAchieveVO>
     */
    List<CuMemberRetailAchieveVO> selectMemberAchieve(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 查询会员业绩列表
     *
     * @param cuMemberAchieveVO 入参
     * @return List<CuMemberRetailAchieveVO>
     */
    List<CuMemberRetailAchieveVO> selectMemberAchieveDetail(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 查询大区会员ID
     *
     * @param cuMemberAchieveVO 入参
     * @return CuMemberRetailAchieveVO
     */
    CuMemberRetailAchieveVO selectMemberBigAchieve(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 查询会员业绩
     *
     * @param cuMemberAchieveVO 入参
     * @return CuMemberRetailAchieveVO
     */
    CuMemberRetailAchieveVO selectMemberOrderAchieveByPkMember(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 排除注水的小区业绩
     *
     * @param cuMemberAchieveVO 入参
     * @return CuMemberRetailAchieveVO
     */
    CuMemberRetailAchieveVO selectExcludeWaterSmallAchieve(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 市场动态的大小区业绩详情（自己的业绩算一个区）
     *
     * @param cuMemberAchieveVO 入参
     * @return
     */
    CuMemberRetailAchieveVO selectMemberBigSmallAchieveDetail(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 根据会员编号查询注水
     *
     * @param memberCode 会员编号
     * @return Integer
     */
    Integer selectWaterInjection(@Param("memberCode") String memberCode);

    /**
     * 查询会员的激活状态
     *
     * @param cuMemberAchieveVO 入参
     * @return Integer
     */
    Integer selectMemberActiveState(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 根据会员ID查询上月业绩
     *
     * @param cuMemberAchieveVO 入参
     * @return CuMemberRetailAchieveVO
     */
    CuMemberRetailAchieveVO selectUpMonthAchieveByPkMember(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 查询会员累计业绩
     *
     * @param cuMemberAchieveVO 入参
     * @return CuMemberRetailAchieveVO
     */
    CuMemberRetailAchieveVO selectMemberOrderSumAchieveByPkMember(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 查询会员直推业绩(日结+秒结)
     *  orderType in (41,42,43,44)
     * @param cuMemberAchieveVO 入参
     * @return List<CuMemberRetailAchieveVO>
     */
    List<CuMemberRetailAchieveVO> selectMemberSumAchieve(CuMemberRetailAchieveVO cuMemberAchieveVO);

    /**
     * 获取会员结算明细
     * @param cuMemberAchieveVO
     * @return
     */
    List<CuMemberRetailDataStatisticsDetailVO> getRetailDataStatisticsDetail(CuMemberRetailAchieveVO cuMemberAchieveVO);

    List<MarketDynamicsDetailVO> getMarketDynamicsDetail(@Param("param") MarketDynamicsQueryDateParam param);

    /**
     * 查询当天自己新增盒数
     *
     * @param param 入参
     * @return Integer
     */
    BigDecimal selectSelfNewBox(CuMemberRetailAchieveVO param);

    /**
     * 查询会员大小区盒数（市场动态）
     *
     * @param param 入参
     * @return CuMemberRetailAchieveVO
     */
    CuMemberRetailAchieveVO selectMemberBigSmallBox(CuMemberRetailAchieveVO param);


    /**
     * 查询大区盒数列表（市场动态）
     *
     * @param param 入参
     * @return CuMemberRetailAchieveVO
     */
    CuMemberRetailAchieveVO selectMemberBigBoxList(CuMemberRetailAchieveVO param);

    /**
     * 查询会员小区盒数列表（市场动态）
     *
     * @param param 入参
     * @return List<CuMemberRetailAchieveVO>
     */
    List<CuMemberRetailAchieveVO> selectMemberSmallBoxList(CuMemberRetailAchieveVO param);

    List<Long> selectSubMemberIdByRootMember(@Param("pkMember") Long pkMember, @Param("systemType") Integer systemType);
}
