package com.yonge.cooleshow.portal.service.impl;

import com.yonge.cooleshow.mbg.mapper.UserOrderPaymentMapper;
import com.yonge.cooleshow.mbg.model.UserOrderPayment;
import com.yonge.cooleshow.portal.service.UserOrderPaymentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * Description
 *
 * @author liujunchi
 * @date 2022-04-24
 */
@Service
public class UserOrderPaymentServiceImpl implements UserOrderPaymentService {

    @Autowired
    private UserOrderPaymentMapper userOrderPaymentMapper;



    @Override
    public void save(UserOrderPayment userOrderPayment) {
        userOrderPaymentMapper.insert(userOrderPayment);
    }

    @Override
    public void saveOrUpdate(UserOrderPayment userOrderPayment) {
        if (userOrderPayment.getId() == null) {
            userOrderPaymentMapper.insert(userOrderPayment);
        } else {
            userOrderPaymentMapper.updateByPrimaryKeySelective(userOrderPayment);
        }
    }


    @Override
    public List<UserOrderPayment> getByOrderNo(String orderSn) {
        return userOrderPaymentMapper.selectByOrderNo(orderSn);
    }


    @Override
    public UserOrderPayment getByOrderNoAndStatusPaying(String orderSn) {
        return userOrderPaymentMapper.selectByOrderNoAndStatusPaying(orderSn);
    }

    @Override
    public UserOrderPayment getByAdapayNo(String paymentNo) {
        return userOrderPaymentMapper.selectByAdapayNo(paymentNo);
    }
}
