package com.hzs.member.achieve.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.common.domain.member.achieve.CuMemberAchieve;
import com.hzs.common.domain.member.achieve.ext.CuMemberAchieveExt;
import com.hzs.member.achieve.controller.vo.*;
import com.hzs.member.achieve.param.MonthAchieveParam;
import com.hzs.member.achieve.vo.CuMemberAwardsUnderVO;
import com.hzs.member.achieve.vo.CuMemberMonthAchieveContrastVO;
import com.hzs.member.achieve.vo.CuMemberNewAddAchieveVO;
import com.hzs.member.settlecenter.param.PlacementDataParam;
import com.hzs.member.settlecenter.vo.*;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 会员业绩记录 Mapper 接口
 *
 * @author hzs
 * @since 2022-10-26
 */
public interface CuMemberAchieveMapper extends BaseMapper<CuMemberAchieve> {

    /**
     * 查询会员最新业绩
     *
     * @param pkMember  会员主键
     * @param pkCountry 公司
     * @param tableName 结算表
     */
    CuMemberAchieve queryCuMemberAchieveByPkMember(@Param("pkMember") Long pkMember, @Param("pkCountry") Integer pkCountry, @Param("tableName") String tableName);

    /**
     * 会员端新增业绩
     *
     * @param cuMemberNewAddAchieveVO 端新增业绩
     * @return CuMemberNewAddAchieveVO
     */
    List<CuMemberNewAddAchieveVO> selectNewAddAchieve(CuMemberNewAddAchieveVO cuMemberNewAddAchieveVO);

    /**
     * 根据用户ID查询奖衔
     *
     * @param memberAwardsUnderVO 奖衔VO
     * @return CuMemberAwardsUnderVO
     */
    CuMemberAwardsUnderVO selectAwardsByPkMember(CuMemberAwardsUnderVO memberAwardsUnderVO);

    /**
     * 根据用户ID查询结余大小信息
     *
     * @param memberAwardsUnderVO 奖衔VO
     * @return CuMemberAwardsUnderVO
     */
    CuMemberAwardsUnderVO selectBalanceByPkMember(CuMemberAwardsUnderVO memberAwardsUnderVO);

    /**
     * 查询本月小区新增业绩
     *
     * @param memberAwardsUnderVO 入参
     * @return CuMemberAwardsUnderVO
     */
    CuMemberAwardsUnderVO selectMemberSmallAchieve(CuMemberAwardsUnderVO memberAwardsUnderVO);

    /**
     * 根据用户ID查询奖衔伞下
     *
     * @param memberAwardsUnderVO 奖衔VO
     * @return List<CuMemberAwardsUnderVO>
     */
    List<CuMemberAwardsUnderVO> selectUnderMemberAwards(CuMemberAwardsUnderVO memberAwardsUnderVO);


    /**
     * 月度新增业绩对比
     *
     * @param memberMonthAchieveContrastVO 参数
     * @return CuMemberMonthAchieveContrastVO
     */
    CuMemberMonthAchieveContrastVO selectNewAddAchieveContrast(CuMemberMonthAchieveContrastVO memberMonthAchieveContrastVO);

    /**
     * 查询表名是否存在
     *
     * @param tableName 表名
     * @return Integer
     */
    Integer selectExistTable(String tableName);

    /**
     * 查询左右区新增业绩
     **/
    PlaceNewAddAchieveVO selectNewABAchieve(PlaceNewAddAchieveVO pna);

    List<PlaceNewAddAchieveVO> selectABDirectAchieve(PlaceNewAddAchieveVO pna);

    /**
     * @description: 月度业绩-左右区人数详情(最新)
     **/
    List<PlaceNewAddAchieveVO> placeNewAddAchieveDetails(PlaceNewAddAchieveVO pna);

    /**
     * @description: 月度业绩-左右区人数详情(历史)
     **/
    List<PlaceNewAddAchieveVO> placeNewAddAchieveHistoryDetails(PlaceNewAddAchieveVO pna);

    /**
     * @description: 月度业绩-左右区业绩详情
     **/
    List<PlaceNewAddAchieveVO> leftRightAchieveDetails(PlaceNewAddAchieveVO pna);

    /**
     * @description: 月度业绩-左右区血缘业绩详情
     **/
    List<PlaceNewAddAchieveVO> leftRightDirectAchieveDetails(PlaceNewAddAchieveVO pna);

    /**
     * @description: 月度业绩-查询血缘业绩详情
     **/
    List<PlaceNewAddAchieveVO> directAchieveDetails(PlaceNewAddAchieveVO pna);


    /**
     * @description: 查询直推业绩
     **/
    PlaceNewAddAchieveVO selectParentAchieve(PlaceNewAddAchieveVO pna);

    /**
     * @description: 查询左右区人数
     **/
    List<PlaceNewAddAchieveVO> selectABCoun(PlaceNewAddAchieveVO pna);

    /**
     * @description: 查询最新月份左右区人数
     **/
    List<PlaceNewAddAchieveVO> selectABNewMonthCoun(PlaceNewAddAchieveVO pna);

    /**
     * @description: 查询各个等级直推人数和业绩
     **/
    List<ParentAchieveVO> selectParentCounAchieve(ParentAchieveVO pav);

    /**
     * @description: 查询本人直推业绩
     **/
    List<ParentAchieveVO> selfParentCounAchieve(ParentAchieveVO pav);

    /**
     * @description: 查询前10直推业绩
     **/
    List<ParentAchieveVO> parentCounAchieveTop(ParentAchieveVO pav);

    /**
     * @description: 直推业绩前十人伞下等级业绩
     **/
    List<ParentAchieveVO> umbrellaAchieveTop(ParentAchieveVO pav);


    /**
     * 查询安置数据
     *
     * @param param 入参
     * @return List<PlacementDataVO>
     */
    List<PlacementDataBaseVO> selectPlacementDataList(PlacementDataParam param);

    /**
     * 根据会员ID查询安置
     *
     * @param param 入参
     * @return List<PlacementDataBaseVO>
     */
    List<PlacementDataBaseVO> selectAchieveByPkMember(PlacementDataParam param);


    /**
     * 查询推荐数据
     *
     * @param param 入参
     * @return List<PlacementDataVO>
     */
    List<RecommendDataBaseVO> selectRecommendDataList(PlacementDataParam param);

    /**
     * 根据PkMember查询推荐数据
     *
     * @param param 入参
     * @return List<PlacementDataVO>
     */
    List<RecommendDataBaseVO> selectRecommendDataListByPkMember(PlacementDataParam param);


    /**
     * 查询体系总和
     *
     * @param param 入参
     * @return RecommendDataDetailVO
     */
    List<RecommendDataDetailVO> selectRecommendVertexValue(PlacementDataParam param);

    /**
     * 查询大盘总和
     *
     * @param param 入参
     * @return RecommendDataDetailVO
     */
    RecommendDataDetailVO selectRecommendMarketValue(PlacementDataParam param);


    /**
     * 查询安置图表
     *
     * @param param 入参
     * @return PlacementImageDataVO
     */
    PlacementImageDataVO selectPlaceImage(PlacementDataParam param);

    /**
     * 查询推荐体第图表
     *
     * @param param 入参
     * @return RecommendImageDataVO
     */
    RecommendImageDataVO selectRecommendVertexImage(PlacementDataParam param);

    /**
     * 查询推荐团队图表
     *
     * @param param 入参
     * @return RecommendImageDataVO
     */
    List<RecommendImageDataVO> selectRecommendTeamImage(PlacementDataParam param);

    /*
     * @description: 查询月统计数据，按照月倒叙
     **/
    List<CuMemberAchieveExt> queryMemberMonthAchieve(@Param("pkMember") Long pkMember, @Param("monthList") List<String> monthList);

    /*
     * @description: 查询月统计数据，查询明细，安置伞下
     **/
    List<CuMemberAchieveExt> queryPlaceParentMemberMonthAchieve(MonthAchieveParam monthAchieveParam);

    /*
     * @description: 查询月统计数据，查询明细，安置伞下
     **/
    List<CuMemberAchieveExt> queryParentMemberMonthAchieve(MonthAchieveParam monthAchieveParam);
}
