package com.bz.rmcp.dap.service.impl;

import com.bz.rmcp.dap.service.ProductService;
import com.zcxk.rmcp.core.dao.ProductMapper;
import com.zcxk.rmcp.core.entity.Product;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author linqingwei
 * @date 2021-08-05 15:48
 */
@Service
public class ProductServiceImpl implements ProductService {

    @Resource
    private ProductMapper productMapper;

    @Override
    @Cacheable(value = "CacheProduct", key = "#productId",unless = "#result == null")
    public Product findProductByCache(Integer productId) {
        return productMapper.findById(productId);
    }
}
