package com.hzs.member.base.mapper;


import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.common.domain.member.detail.CuMemberAchieveLog;
import com.hzs.member.base.vo.CuMemberAchieveLogVO;
import org.apache.ibatis.annotations.Param;

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

/**
 * <p>
 * 注水业绩记录表 Mapper 接口
 * </p>
 *
 * @author zhangjing
 * @since 2023-02-03
 */
public interface CuMemberAchieveLogMapper extends BaseMapper<CuMemberAchieveLog> {

   /**
    * @description: 特殊业务-注水业绩记录查询
    * @author: zhang jing
    * @date: 2023/2/3 17:15
    * @param: [cuMemberAchieveLogVO]
    * @return: java.util.List<com.hzs.member.base.vo.CuMemberAchieveLogVO>
    **/
   List<CuMemberAchieveLogVO> queryMemberAchieveLogList( @Param("memberCode") String memberCode,
                                                        @Param("memberName") String memberName,
                                                        @Param("pkCountry") Integer pkCountry,
                                                        @Param("pkAwards") Integer pkAwards,
                                                        @Param("pkTeamCode") Integer pkTeamCode,
                                                        @Param("pkVertex") Integer pkVertex,
                                                        @Param("startDate") Date startDate,
                                                        @Param("endDate") Date endDate,
                                                        @Param("staDueDate") Date staDueDate,
                                                        @Param("endDueDate") Date endDueDate,
                                                        @Param("waterStatus") Integer waterStatus,
                                                        @Param("infusingWaterType") Integer infusingWaterType
                                                        );

   /**
    * @description: 根据历史期数查询历史业绩
    * @author: zhang jing
    * @date: 2023/9/10 14:18
    * @param: [memberAchieveLogVO]
    * @return: java.util.List<com.hzs.member.base.vo.CuMemberAchieveLogVO>
    **/
   List<CuMemberAchieveLogVO> queryMemberAchieveHistoryList(@Param("calList") List<CuMemberAchieveLogVO> calList);

   /**
    * @description: 特殊业务-注水业绩-审核列表
    * @author: zhang jing
    * @date: 2023/3/28 16:25
    * @param: [tableName]
    * @return: java.util.List<com.hzs.member.base.vo.CuMemberAchieveLogVO>
    **/
   List<CuMemberAchieveLogVO> queryTryAchieveLogList(@Param("approveStatus") Integer approveStatus,
                                                     @Param("businessNo") String businessNo);


   /**
    * @description: 查询会员当期业绩
    * @author: zhang jing
    * @date: 2023/2/4 9:28
    * @param: [tableName, cuMemberAchieveLogVO]
    * @return: java.util.List<com.hzs.member.base.vo.CuMemberAchieveLogVO>
    **/
   List<CuMemberAchieveLogVO> searchList(@Param("tableName") String tableName,
                                         @Param("memberCode") String memberCode,
                                         @Param("pkMemberList") Set<Long> pkMemberList);

   /**
    * @description: 查询单个会员当期业绩
    * @author: zhang jing
    * @date: 2023/2/4 10:13
    * @param: [tableName, cuMemberAchieveLogVO]
    * @return: com.hzs.member.base.vo.CuMemberAchieveLogVO
    **/
   CuMemberAchieveLogVO searchOne(@Param("tableName") String tableName,
                                  @Param("pkMember") Long pkMember);

   /**
    * @description: 查询最大审核次数
    * @author: zhang jing
    * @date: 2023/2/6 16:11
    * @param: [pkMember, approveStatus]
    * @return: java.lang.Integer
    **/
   Integer selectByMaxApproveNumber(@Param("pkMember") Long pkMember,@Param("approveStatus") int approveStatus);

   /**
    * @description: 通过注水修改业绩
    * @author: zhang jing
    * @date: 2023/2/9 10:22
    * @param: [cuMemberAchieveLogVO]
    * @return: boolean
    **/
   boolean updateSearch(@Param("tableName") String tableName,
                        @Param("asumRealPv") BigDecimal asumRealPv,
                        @Param("bsumRealPv") BigDecimal bsumRealPv,
                        @Param("afirstPv") BigDecimal afirstPv,
                        @Param("bfirstPv") BigDecimal bfirstPv,
                        @Param("abalance") BigDecimal abalance,
                        @Param("bbalance") BigDecimal bbalance,
                        @Param("repASumPv") BigDecimal repASumPv,
                        @Param("repBSumPv") BigDecimal repBSumPv,
                        @Param("repABalance") BigDecimal repABalance,
                        @Param("repBBalance") BigDecimal repBBalance,
                        @Param("pkModified") Long pkModified,
                        @Param("pkMember") Long pkMember,
                        @Param("pkCountry") Integer pkCountry);

   /**
    * @description: 校验是否存在未审核数据
    * @author: zhang jing
    * @date: 2023/3/28 14:36
    * @param: [memberAchieveLogVO]
    * @return: java.util.List<com.hzs.member.base.vo.CuMemberAchieveLogVO>
    **/
   List<CuMemberAchieveLogVO> checkAchieveList(CuMemberAchieveLogVO memberAchieveLogVO);

}
