package com.ghy.payment.service.impl;

import com.ghy.payment.domain.PaymentRelation;
import com.ghy.payment.mapper.PaymentRelationMapper;
import com.ghy.payment.service.IPaymentRelationService;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

@Service
public class PaymentRelationServiceImpl implements IPaymentRelationService {

    @Resource
    private PaymentRelationMapper paymentRelationMapper;

    @Override
    public int insert(PaymentRelation record) {
        return paymentRelationMapper.insert(record);
    }

    @Override
    public int batchInsert(Collection<PaymentRelation> records) {
        if (CollectionUtils.isEmpty(records)) {
            return 0;
        } else {
            int i = 0;
            for (PaymentRelation record : records) {
                i += paymentRelationMapper.insert(record);
            }
            return i;
        }
    }

    @Override
    public List<PaymentRelation> select(String paymentId, Long relationId, String relationIdType) {
        return null;
    }

    @Override
    public List<PaymentRelation> selectByPaymentId(String paymentId) {
        return null;
    }
}
