package com.waimai.web.admin.service.impl;

import java.util.List;
import com.waimai.common.utils.DateUtils;
import com.waimai.web.admin.domain.OrderFoods;
import com.waimai.web.admin.mapper.OrderFoodsMapper;
import com.waimai.web.admin.service.IOrderFoodsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 订单商品Service业务层处理
 * 
 * @author callmeyan
 * @date 2023-03-24
 */
@Service
public class OrderFoodsServiceImpl implements IOrderFoodsService
{
    @Autowired
    private OrderFoodsMapper orderFoodsMapper;

    /**
     * 查询订单商品
     * 
     * @param id 订单商品主键
     * @return 订单商品
     */
    @Override
    public OrderFoods selectOrderFoodsById(Long id)
    {
        return orderFoodsMapper.selectOrderFoodsById(id);
    }

    /**
     * 查询订单商品列表
     * 
     * @param orderFoods 订单商品
     * @return 订单商品
     */
    @Override
    public List<OrderFoods> selectOrderFoodsList(OrderFoods orderFoods)
    {
        return orderFoodsMapper.selectOrderFoodsList(orderFoods);
    }

    /**
     * 新增订单商品
     * 
     * @param orderFoods 订单商品
     * @return 结果
     */
    @Override
    public int insertOrderFoods(OrderFoods orderFoods)
    {
        orderFoods.setCreateTime(DateUtils.getNowDate());
        return orderFoodsMapper.insertOrderFoods(orderFoods);
    }

    /**
     * 修改订单商品
     * 
     * @param orderFoods 订单商品
     * @return 结果
     */
    @Override
    public int updateOrderFoods(OrderFoods orderFoods)
    {
        orderFoods.setUpdateTime(DateUtils.getNowDate());
        return orderFoodsMapper.updateOrderFoods(orderFoods);
    }

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

    /**
     * 删除订单商品信息
     * 
     * @param id 订单商品主键
     * @return 结果
     */
    @Override
    public int deleteOrderFoodsById(Long id)
    {
        return orderFoodsMapper.deleteOrderFoodsById(id);
    }
}
