package com.ghy.payment.service.impl;

import com.ghy.payment.domain.OrderTimeoutRecord;
import com.ghy.payment.mapper.OrderFineRecordMapper;
import com.ghy.payment.service.OrderFineRecordService;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;

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

/**
 * @author ydq
 * @date : 2022-09-13 22:58
 */
@Service
public class OrderFineRecordServiceImpl implements OrderFineRecordService {

    @Resource
    private OrderFineRecordMapper orderFineRecordMapper;


    @Override
    public OrderTimeoutRecord selectByDetailIdAndStatus(Long orderDetailId, Integer orderStatus) {
        OrderTimeoutRecord orderTimeoutRecord = null;
        List<OrderTimeoutRecord> orderTimeoutRecords = orderFineRecordMapper.selectByDetailIdAndStatus(orderDetailId, orderStatus);
        if (CollectionUtils.isNotEmpty(orderTimeoutRecords)) {
            orderTimeoutRecord = orderTimeoutRecords.get(0);
        }
        return orderTimeoutRecord;
    }

    @Override
    public List<OrderTimeoutRecord> selectList(OrderTimeoutRecord params) {
        return orderFineRecordMapper.selectList(params);
    }


}
