package com.heyu.api.data.dao.vv;
/**
 * <p>
 * 买家信息 服务类
 * </p>
 *
 * @author quyixiao
 * @since 2025-08-23
 */

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.heyu.api.data.entity.vv.VvBuyerEntity;
import com.lz.mybatis.plugin.annotations.*;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

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

@Mapper
public interface VvBuyerDao extends BaseMapper<VvBuyerEntity> {


    VvBuyerEntity selectVvBuyerById(@Param("id") Long id);


    Long insertVvBuyer(VvBuyerEntity vvBuyer);


    Long insertOrUpdateVvBuyer(VvBuyerEntity vvBuyer);


    int updateVvBuyerById(VvBuyerEntity vvBuyer);


    int updateCoverVvBuyerById(VvBuyerEntity vvBuyer);


    int deleteVvBuyerById(@Param("id") Long id);


    @OrderBy(VvBuyerEntity.id_ )
    List<VvBuyerEntity> selectBuyerByCondition(IPage page,
                                               @IF @LIKE String buyerName,
                                               @IF @LIKE String buyerPhone,
                                               @IF @LIKE String buyerWeixin,
                                               @IF @GE @Column(VvBuyerEntity.create_timestamp) Long minCreateTimestamp,
                                               @IF @LE @Column(VvBuyerEntity.create_timestamp) Long maxCreateTimestamp,
                                               @IF Integer isTest,
                                               @IF String promoterId,
                                               @IF Integer scanCode,
                                               @IF Integer scanCodeAwardCount,
                                               @IF @GE @Column(VvBuyerEntity.promoter_sum_amount) BigDecimal minPromoterSumAmount,
                                               @IF @LE @Column(VvBuyerEntity.promoter_sum_amount) BigDecimal maxPromoterSumAmount,
                                               @OrderBy @IF @Column(VvBuyerEntity.create_timestamp) String createTimestampSort);


    @LIMIT
    VvBuyerEntity selectVvBuyerIsTestById(Long id, Integer isTest);


    @LIMIT
    VvBuyerEntity selectVvBuyerInfo(String buyerName, @OR String buyerWeixin, @OR String buyerPhone);


    int updateVvBuyerApplyAmountDrawCashAmountById(@Plus BigDecimal promoterDrawCashSuccessAmount,
                                                   @Sub BigDecimal promoterApplyDrawCashAmount,
                                                   Long id);

    int updateVvBuyerDrawFailedById(@Plus BigDecimal promoterDrawCashFailedCount,
                                    @Sub BigDecimal promoterApplyDrawCashAmount, Long id);

    @LIMIT
    VvBuyerEntity selectVvBuyerOpenId(String openid);

    List<VvBuyerEntity> selectVvBuyerByIdList(@IN List<Long> id);

    int updateVvBuyerByIdPromoterSumAmountPromoterNotArriveAmount(@Plus BigDecimal promoterSumAmount,@Plus BigDecimal promoterNotArriveAmount, Long id);

    int updateVvBuyerByIdPromoterCanceledAmountPromoterNotArriveAmount(@Plus BigDecimal promoterCanceledAmount,@Sub BigDecimal promoterNotArriveAmount, Long id);


    int updateVvBuyerByIdPromoterArriveAccountAmountPromoterNotArriveAmount(@Plus BigDecimal promoterArriveAccountAmount,
                                                                            @Sub BigDecimal promoterNotArriveAmount, Long id);



    int updateVvBuyerByIdPromoterDrawCashFailedAmountPromoterArriveAccountAmount(@Plus BigDecimal promoterDrawCashFailedAmount,
                                                                                 @Sub BigDecimal promoterArriveAccountAmount,
                                                                                 Long id);


    int updateVvBuyerByIdPromoterDrawCashFailedAmountPromoterApplyDrawCashAmount(@Plus BigDecimal promoterDrawCashFailedAmount,
                                                                                 @Sub BigDecimal promoterApplyDrawCashAmount,
                                                                                 Long id);


    int updateVvBuyerByIdPromoterApplyDrawCashAmountPromoterArriveAccountAmount(@Plus BigDecimal promoterApplyDrawCashAmount,
                                                                                 @Sub BigDecimal promoterArriveAccountAmount,
                                                                                 Long id);



    int updateVvBuyerByIdPromoterDrawCashSuccessAmountPromoterArriveAccountAmount(@Plus BigDecimal promoterDrawCashSuccessAmount,
                                                                                 @Sub BigDecimal promoterArriveAccountAmount,
                                                                                 Long id);


    int updateVvBuyerByIdPromoterDrawCashSuccessAmountPromoterApplyDrawCashAmount(@Plus BigDecimal promoterDrawCashSuccessAmount,
                                                                                 @Sub BigDecimal promoterApplyDrawCashAmount,
                                                                                 Long id);




}