package com.ruoyi.system.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.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.mapper.OrderParentMapper;
import com.ruoyi.system.domain.OrderParent;
import com.ruoyi.system.service.IOrderParentService;

/**
 * 父订单Service业务层处理
 *
 * @author ruoyi
 * @date 2025-09-02
 */
@Service
public class OrderParentServiceImpl extends ServiceImpl<BaseMapper<OrderParent>,OrderParent> implements IOrderParentService
{
    @Autowired
    private OrderParentMapper orderParentMapper;

    /**
     * 查询父订单
     *
     * @param id 父订单主键
     * @return 父订单
     */
    @Override
    public OrderParent selectOrderParentById(Long id)
    {
        return orderParentMapper.selectOrderParentById(id);
    }

    /**
     * 查询父订单列表
     *
     * @param orderParent 父订单
     * @return 父订单
     */
    @Override
    public List<OrderParent> selectOrderParentList(OrderParent orderParent)
    {
        return orderParentMapper.selectOrderParentList(orderParent);
    }

    /**
     * 新增父订单
     *
     * @param orderParent 父订单
     * @return 结果
     */
    @Override
    public int insertOrderParent(OrderParent orderParent)
    {
        orderParent.setCreateTime(DateUtils.getNowDate());
        return orderParentMapper.insertOrderParent(orderParent);
    }

    /**
     * 修改父订单
     *
     * @param orderParent 父订单
     * @return 结果
     */
    @Override
    public int updateOrderParent(OrderParent orderParent)
    {
        orderParent.setUpdateTime(DateUtils.getNowDate());
        return orderParentMapper.updateOrderParent(orderParent);
    }

    /**
     * 批量删除父订单
     *
     * @param ids 需要删除的父订单主键
     * @return 结果
     */
    @Override
    public int deleteOrderParentByIds(Long[] ids)
    {
        return orderParentMapper.deleteOrderParentByIds(ids);
    }

    /**
     * 删除父订单信息
     *
     * @param id 父订单主键
     * @return 结果
     */
    @Override
    public int deleteOrderParentById(Long id)
    {
        return orderParentMapper.deleteOrderParentById(id);
    }
}
