package com.orangesale.cn.service;

import com.orangesale.cn.entity.OrangeProduct;
import com.orangesale.cn.mapper.ProductMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @Author zhijun
 * @Date 2019/12/13
 */
@Service
public class ProductService {
    @Autowired
    private ProductMapper productMapper;

    /**
     * 根据商品id查询商品信息
     *
     * @param productId
     * @return
     */
    public OrangeProduct selectById(Integer productId) {
        return productMapper.selectById(productId);
    }

    /**
     * 查询所有商品信息
     *
     * @return
     */
    public List<OrangeProduct> selectAll() {
        return productMapper.selectAll();
    }

    /**
     * 更新商品
     *
     * @param product
     * @return
     */
    public Integer updateProduct(OrangeProduct product) {
        return productMapper.updateProduct(product);
    }

    /**
     * 删除商品
     *
     * @param product
     * @return
     */
    public Integer deleteProduct(OrangeProduct product) {
        return productMapper.deleteProduct(product);
    }

    /**
     * 添加商品
     *
     * @param orangeProduct
     * @return
     */
    public Integer addProduct(OrangeProduct orangeProduct) {
        return productMapper.addProduct(orangeProduct);
    }
}
