package com.fzm.mall.server.front.order.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.fzm.mall.server.front.order.model.BiddingRecord;
import com.fzm.mall.server.front.order.model.Deposit;
import com.fzm.mall.server.front.order.mapper.DepositMapper;
import com.fzm.mall.server.front.order.service.IDepositService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;

/**
 * <p>
 * 用户拍卖保证金记录表 服务实现类
 * </p>
 *
 * @author fzm
 * @since 2021-09-02
 */
@Service
@Slf4j
@RequiredArgsConstructor(onConstructor = @__(@Autowired))
public class DepositServiceImpl extends ServiceImpl<DepositMapper, Deposit> implements IDepositService {
    public Deposit getDepositByUid(String uid, String auctionId) {
        QueryWrapper<Deposit> q = new QueryWrapper<>();
        q.eq("uid", uid);
        q.eq("auction_id", auctionId);
        return getOne(q);
    }

    public List<Deposit> getDepositByUidAndStatus(String uid,String status) {
        QueryWrapper<Deposit> q = new QueryWrapper<>();
        q.eq("uid", uid);
        q.eq("status", status);
        return list(q);
    }
}
