package com.ruoyi.ss.cardOrder.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.ss.cardOrder.mapper.CardOrderMapper;
import com.ruoyi.ss.cardOrder.domain.CardOrder;
import com.ruoyi.ss.cardOrder.domain.CardOrderVO;
import com.ruoyi.ss.cardOrder.domain.CardOrderQuery;
import com.ruoyi.ss.cardOrder.service.ICardOrderService;

/**
 * 卡券订单Service业务层处理
 *
 * @author qzz
 * @date 2025-03-20
 */
@Service
public class CardOrderServiceImpl implements ICardOrderService
{
    @Autowired
    private CardOrderMapper cardOrderMapper;

    /**
     * 查询卡券订单
     *
     * @param orderId 卡券订单主键
     * @return 卡券订单
     */
    @Override
    public CardOrderVO selectCardOrderByOrderId(Long orderId)
    {
        return cardOrderMapper.selectCardOrderByOrderId(orderId);
    }

    @Override
    public CardOrderVO selectCardOrderByOrderNo(String orderNo) {
        return cardOrderMapper.selectCardOrderByOrderNo(orderNo);
    }

    /**
     * 查询卡券订单列表
     *
     * @param cardOrder 卡券订单
     * @return 卡券订单
     */
    @Override
    public List<CardOrderVO> selectCardOrderList(CardOrderQuery cardOrder)
    {
        return cardOrderMapper.selectCardOrderList(cardOrder);
    }

    /**
     * 新增卡券订单
     *
     * @param cardOrder 卡券订单
     * @return 结果
     */
    @Override
    public int insertCardOrder(CardOrder cardOrder)
    {
        cardOrder.setCreateTime(DateUtils.getNowDate());
        return cardOrderMapper.insertCardOrder(cardOrder);
    }

    /**
     * 修改卡券订单
     *
     * @param cardOrder 卡券订单
     * @return 结果
     */
    @Override
    public int updateCardOrder(CardOrder cardOrder)
    {
        return cardOrderMapper.updateCardOrder(cardOrder);
    }

    /**
     * 批量删除卡券订单
     *
     * @param orderIds 需要删除的卡券订单主键
     * @return 结果
     */
    @Override
    public int deleteCardOrderByOrderIds(Long[] orderIds)
    {
        return cardOrderMapper.deleteCardOrderByOrderIds(orderIds);
    }

    /**
     * 删除卡券订单信息
     *
     * @param orderId 卡券订单主键
     * @return 结果
     */
    @Override
    public int deleteCardOrderByOrderId(Long orderId)
    {
        return cardOrderMapper.deleteCardOrderByOrderId(orderId);
    }
}
