package com.jsowell.pile.mapper;

import com.jsowell.pile.domain.MemberAdapayRecord;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface MemberAdapayRecordMapper {
    /**
     * insert record to table selective
     *
     * @param record the record
     * @return insert count
     */
    int insertSelective(MemberAdapayRecord record);

    /**
     * select by primary key
     *
     * @param id primary key
     * @return object by primary key
     */
    MemberAdapayRecord selectByPrimaryKey(Integer id);

    /**
     * update record selective
     *
     * @param record the updated record
     * @return update count
     */
    int updateByPrimaryKeySelective(MemberAdapayRecord record);

    int updateBatch(List<MemberAdapayRecord> list);

    int batchInsert(@Param("list") List<MemberAdapayRecord> list);

    int insertOrUpdate(MemberAdapayRecord record);

    int insertOrUpdateSelective(MemberAdapayRecord record);

    List<MemberAdapayRecord> selectAdapayRecordList(@Param("memberId") String memberId, @Param("scenarioType") String scenarioType);

    MemberAdapayRecord selectByPaymentId(@Param("paymentId") String paymentId);

    /**
     * 查询可用余额的充值记录
     * 用于支付订单/余额退款场景
     * @param memberId 会员id
     * @return
     */
    List<MemberAdapayRecord> selectAvailableBalance(@Param("memberId") String memberId);

    /**
     * 查询存在冻结金额的充值记录
     * 用于订单分账的场景
     * @param memberId 会员id
     * @return
     */
    List<MemberAdapayRecord> selectAvailableFreeze(@Param("memberId") String memberId);
}