package com.hzs.bonus.detail.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.hzs.bonus.param.CuRegionAssessParam;
import com.hzs.common.domain.member.detail.CuRegionAssess;
import com.hzs.common.domain.member.detail.ext.CuRegionAssessExt;
import com.hzs.common.domain.retail.member.CuMemberRetailRegion;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

/**
 * <p>
 * 新零售会员区域考核 Mapper 接口
 * </p>
 *
 * @author hzs
 * @since 2025-01-13
 */
public interface CuRegionAssessMapper extends BaseMapper<CuRegionAssess> {

    /*
     * @description: 查询考核结果
     * @author: sui q
     * @date: 2025/1/15 17:22
     * @param: null null
     **/
    List<CuRegionAssessExt> queryRegionAssessByCondition(@Param("regionAssessParam") CuRegionAssessParam regionAssessParam);

    /*
     * @description: 考核开始日期
     * @author: sui q
     * @date: 2025/1/13 17:13
     * @param: null null
     **/
    void deleteAssessRegionByDate(@Param("assessStartDate") Date assessStartDate, @Param("assessPeriod") Integer assessPeriod);

    /*
     * @description: 考核开始日期
     * @author: sui q
     * @date: 2025/1/13 17:13
     * @param: null null
     **/
    void updateAssessRegionByDate(@Param("assessStartDate") Date assessStartDate, @Param("assessEndDate") Date assessEndDate);

    /**
     * 批量获取cuMemberBonus主键
     *
     * @param rowNum 数量
     * @return: List<Integer>
     * @Author: sui q
     * @Date: 2022/12/13 13:47
     */
    List<Long> batchQueryCuRegionAssessSeq(Integer rowNum);

    /*
     * @description: 批量插入区域考核数据
     * @author: sui q
     * @date: 2025/1/14 14:31
     * @param: null null
     **/
    void batchInsertCuRegionAssess(@Param("cuRegionAssessList") List<?> cuRegionAssessList);

    /*
     * @description: 更新达标次数
     * @author: sui q
     * @date: 2025/1/15 10:44
     * @param: null null
     **/
    void mergeCuRegionAssess(@Param("assessDate") Date assessDate);

    /*
     * @description: 查询待考核的区域
     * @author: sui q
     * @date: 2025/1/13 17:31
     * @param: null null
     **/
    List<CuMemberRetailRegion> queryCuMemberRetailRegion(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    /*
     * @description: 查询到期日期是上个月的区域
     * @author: sui q
     * @date: 2025/2/25 15:45
     * @param: null null
     **/
    List<CuMemberRetailRegion> queryDueCuMemberRetailRegion(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    /*
     * @description: 查询手动设置考核的近6个月考核记录
     * @author: sui q
     * @date: 2025/2/26 9:21
     * @param: null null
     **/
    List<CuRegionAssessExt> queryRegionAssessByDate(@Param("memberRetailRegionList") List<CuMemberRetailRegion> memberRetailRegionList, @Param("startDate") Date startDate, @Param("endDate") Date endDate);
}
