package com.zcxk.rmcp.web.service.impl;


import com.zcxk.rmcp.api.dto.product.ProductVo;
import com.zcxk.rmcp.api.vo.ProductCategoryVo;
import com.zcxk.rmcp.core.dao.ProductCategoryMapper;
import com.zcxk.rmcp.web.service.ProductService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import com.zcxk.rmcp.core.dao.ProductMapper;
import com.zcxk.rmcp.core.entity.Product;

import java.util.List;

import static com.google.common.collect.Lists.newArrayList;

/**
 * 
 * @author linqingwei
 * @date 2021-07-21 9:43
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Resource
    private ProductMapper productMapper;
    @Resource
    private ProductCategoryMapper productCategoryMapper;

    @Override
    public int insertSelective(Product record) {
        return productMapper.insertSelective(record);
    }

    @Override
    public int updateByPrimaryKeySelective(Product record) {
        return productMapper.updateByPrimaryKeySelective(record);
    }

    @Override
    public Product getByName(String productName, String productModel) {
        return productMapper.getByName(productName,productModel);
    }

    @Override
    public Product findById(Integer productId) {
        return productMapper.findById(productId);
    }

    @Override
    public List<ProductVo> getProductList(Integer categoryId) {
        return productMapper.findList(categoryId);
    }

    @Override
    public List<ProductCategoryVo> getCategoryList() {
        return productCategoryMapper.queryList();
    }


}
