package com.yc.education.service.impl;

import com.github.pagehelper.PageHelper;
import com.yc.education.mapper.ProductMapper;
import com.yc.education.model.Product;
import com.yc.education.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * huangpan
 * 2019/10/8
 * energy
 */
@Service
public class ProductServiceImpl  extends BaseService<Product> implements ProductService {
    @Autowired
    ProductMapper productMapper;

    @Override
    public List<Product> selAllProduct(Integer id, Integer pageNum, Integer pageSize) {
        PageHelper.startPage(pageNum, pageSize);
        return productMapper.selAllProduct(id);
    }

    @Override
    public Product selProductById(Integer id) {
        return productMapper.selProductById(id);
    }

    @Override
    public void deleteProductById(Integer id) {
        productMapper.deleteByPrimaryKey(id);
    }

    @Override
    public List<Product> getProductAll(Integer id) {
        return productMapper.getProductAll(id);
    }

    @Override
    public List<Product> selproductAll(Integer pageNum, Integer pageSize, String tName) {
        PageHelper.startPage(pageNum, pageSize);
        return productMapper.selproductAll(tName);
    }
}
