package com.hzs.member.achieve.service;

import com.baomidou.mybatisplus.extension.service.IService;
import com.hzs.common.domain.member.achieve.CuMemberTree;
import com.hzs.common.domain.member.ext.CuMemberSettleExt;
import com.hzs.common.domain.member.ext.MemberSettleTreeExt;
import com.hzs.common.domain.sale.ext.SaOrderExt;
import com.hzs.member.achieve.param.MemberAchieveParam;
import com.hzs.member.achieve.param.MemberParentCountParam;
import com.hzs.member.census.param.CensusSummaryParam;
import com.hzs.member.census.vo.CensusSummaryVo;
import com.hzs.member.structure.controller.vo.CuMemberSettleVo;
import org.apache.ibatis.annotations.Param;

import java.util.*;

/**
 * <p>
 * 会员网体历史记录 服务类
 * </p>
 *
 * @author hzs
 * @since 2022-10-31
 */
public interface ICuMemberTreeService extends IService<CuMemberTree> {

    /**
     * 判断是否存在临时表
     *
     * @param tableName 表名
     * @Description:
     * @return: void
     * @Author: sui q
     * @Date: 2022/4/13 19:34
     */
    Integer queryExistOracleTable(String tableName);


    /**
     * 根据pkmember查询
     * @param pkMember
     * @return
     */
    CuMemberSettleExt queryCuMemberTreeByPkMemberTable( Long pkMember);

    /**
     * 查询推荐关系
     * @param settleTableName
     * @param pkMember
     * @return
     */
    List<CuMemberSettleExt> queryCuMemberTreeParentTable(String settleTableName, Long pkMember, Integer level);

    /**
     * 查询直推人数
     * @param settleTableName
     * @param pkMember
     * @return
     */
    Long queryCuMemberTreeParentTableCount(String settleTableName, Long pkMember);

    /**
     * 查询伞下安置新增业绩
     * @param settleTableName
     * @param pkMember
     * @return
     */
    List<CuMemberSettleExt> brollyBelowResettle(String settleTableName, Long pkMember);
    /**
     * 根据pkmember查询 关联parent
     * @param settleTableName
     * @param pkMember
     * @return
     */
    CuMemberSettleExt queryCuMemberTreeByPlacePkMemberTable(String settleTableName, Long pkMember);

    /**
     * 查询会员直推业绩
     * @param settleTableName
     * @param memberIds
     * @return
     */
    List<MemberParentCountParam> queryByMemberParentSumPv(String settleTableName, List<Long> memberIds);

    /**
     * 查询历史安置上下架
     * @param settleTableName
     * @param pkMember
     * @param memberIdList
     * @param level
     * @return
     */
    List<CuMemberSettleExt> queryCuMemberTreePlaceParentHistoryFramework(String settleTableName, Long pkMember, List<Long> memberIdList,Integer level);

    /**
     * 查询会员历史直推业绩
     * @param settleTableName
     * @param memberIds
     * @return
     */
    List<MemberParentCountParam> queryByMemberParentSettleSumPv(@Param("settleTableName") String settleTableName,@Param("memberIds") List<Long> memberIds);



}
