package com.ai.da.mapper.primary;

import com.ai.da.mapper.primary.entity.Referral;
import com.ai.da.model.vo.ReferralPageQueryVO;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

public interface ReferralMapper extends BaseMapper<Referral> {
    // 使用自定义SQL进行分页查询
    IPage<ReferralPageQueryVO> selectReferralWithAffiliate(Page<ReferralPageQueryVO> page, @Param("ew") Wrapper<ReferralPageQueryVO> wrapper);

    void batchDeleteByIds(List<Long> ids);

    BigDecimal sumAmount(
            Long affiliateId,
            List<String> statusList,  // 改为 List 类型
            LocalDateTime startTime,           // 开始时间（可选）
            LocalDateTime endTime                // 结束时间（可选）
    );

    List<Map<String, Object>> getPersonalMonthlyIncome(Long affiliateAccountId, int year);

    List<Map<String, Object>> getMonthlyAffiliateIncome(int year, int month);
}
