package com.bonus.canteen.core.account.mapper;

import java.math.BigDecimal;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.List;
import com.bonus.canteen.core.account.domain.AccWalletInfo;
import org.apache.ibatis.annotations.Param;
import com.bonus.canteen.core.account.domain.vo.AccWalletInfoVO;

/**
 * 钱包详情信息Mapper接口
 * 
 * @author xsheng
 * @date 2025-04-05
 */
public interface AccWalletInfoMapper {
    /**
     * 查询钱包详情信息
     * 
     * @param userId 钱包详情信息主键
     * @return 钱包详情信息
     */
    public List<AccWalletInfo> selectAccWalletInfoByUserId(Long userId);
    public AccWalletInfo selectAccWalletInfoByUserIdAndWalletId(@Param("userId") Long userId, @Param("walletId") Integer walletId);

    List<AccWalletInfoVO> selectAccWalletInfoByUserIds(@Param("userIds") List<Long> userIds);

    /**
     * 查询钱包详情信息列表
     * 
     * @param accWalletInfo 钱包详情信息
     * @return 钱包详情信息集合
     */
    public List<AccWalletInfo> selectAccWalletInfoList(AccWalletInfo accWalletInfo);

    /**
     * 新增钱包详情信息
     * 
     * @param accWalletInfo 钱包详情信息
     * @return 结果
     */
    public int insertAccWalletInfo(AccWalletInfo accWalletInfo);

    public int batchInsertAccWalletInfo(@Param("list") List<AccWalletInfo> accWalletInfos);


    /**
     * 删除钱包详情信息
     * 
     * @param userId 钱包详情信息主键
     * @return 结果
     */
    public int deleteAccWalletInfoByUserId(Long userId);

    /**
     * 批量删除钱包详情信息
     * 
     * @param userIds 需要删除的数据主键集合
     * @return 结果
     */
    public int deleteAccWalletInfoByUserIds(Long[] userIds);

    void updateMinBalanceByUserId(@Param("minBalance") BigDecimal limitBalance,
                                  @Param("walletId") Integer walletId,
                                  @Param("userIds") List<Long> userIds,
                                  @Param("updateBy") String updateBy,
                                  @Param("updateTime") LocalDateTime updateTime);

    void addAccWalletInfo(@Param("amount") BigDecimal amount,
                          @Param("userId") Long userId,
                          @Param("walletId") Integer walletId,
                          @Param("updateBy") String updateBy,
                          @Param("updateTime") LocalDateTime updateTime
                          );
    void reduceAccWalletInfo(@Param("amount") BigDecimal amount,
                             @Param("userId") Long userId,
                             @Param("walletId") Integer walletId,
                             @Param("updateBy") String updateBy,
                             @Param("updateTime") LocalDateTime updateTime
    );

    void clearAccWalletInfo(@Param("userId") Long userId,
                            @Param("walletId") Integer walletId,
                            @Param("updateBy") String updateBy,
                            @Param("updateTime") LocalDateTime updateTime
    );
}
