package com.ruoyi.model.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.model.mapper.AppOrderMapper;
import com.ruoyi.model.domain.AppOrder;
import com.ruoyi.model.service.IAppOrderService;

/**
 * 订单Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-03-08
 */
@Service
public class AppOrderServiceImpl implements IAppOrderService 
{
    @Autowired
    private AppOrderMapper appOrderMapper;

    /**
     * 查询订单
     * 
     * @param orderId 订单主键
     * @return 订单
     */
    @Override
    public AppOrder selectAppOrderByOrderId(Long orderId)
    {
        return appOrderMapper.selectAppOrderByOrderId(orderId);
    }

    /**
     * 查询订单列表
     * 
     * @param appOrder 订单
     * @return 订单
     */
    @Override
    public List<AppOrder> selectAppOrderList(AppOrder appOrder)
    {
        return appOrderMapper.selectAppOrderList(appOrder);
    }

    /**
     * 新增订单
     * 
     * @param appOrder 订单
     * @return 结果
     */
    @Override
    public int insertAppOrder(AppOrder appOrder)
    {
        appOrder.setCreateTime(DateUtils.getNowDate());
        return appOrderMapper.insertAppOrder(appOrder);
    }

    /**
     * 修改订单
     * 
     * @param appOrder 订单
     * @return 结果
     */
    @Override
    public int updateAppOrder(AppOrder appOrder)
    {
        appOrder.setUpdateTime(DateUtils.getNowDate());
        return appOrderMapper.updateAppOrder(appOrder);
    }

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

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

    /**
     * 查询订单列表
     *
     * @return 订单集合
     */
    @Override
    public List<AppOrder> getAppOrderList(){
        return appOrderMapper.getAppOrderList();
    }
}
