package com.ghy.order.service.impl;

import com.ghy.order.domain.OrderGoods;
import com.ghy.order.mapper.OrderGoodsMapper;
import com.ghy.order.service.OrderGoodsService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class OrderGoodsServiceImpl implements OrderGoodsService {

    @Resource
    OrderGoodsMapper orderGoodsMapper;

    @Override
    public int insertOrderGoods(OrderGoods orderGoods) {
        return orderGoodsMapper.insertOrderGoods(orderGoods);
    }

    @Override
    public int updateOrderGoods(OrderGoods orderGoods) {
        Assert.notNull(orderGoods.getOrderGoodsId(), "OrderGoodsId cannot be null!");
        return orderGoodsMapper.updateOrderGoods(orderGoods);
    }

    @Override
    public List<OrderGoods> selectOrderGoodsList(OrderGoods orderGoods) {
        return orderGoodsMapper.selectOrderGoodsList(orderGoods);
    }

    @Override
    public OrderGoods selectById(Long orderGoodsId) {
        return orderGoodsMapper.selectById(orderGoodsId);
    }

    @Override
    public int deleteOrderGoodsByIds(Long[] orderGoodsIds) {
        return orderGoodsMapper.deleteOrderGoodsByIds(orderGoodsIds);
    }
}
