feat(新增): 使用Cacheable插入数据
Signed-off-by: bunny <1319900154@qq.com>
This commit is contained in:
parent
7b06d59e57
commit
75de44cda0
|
@ -6,6 +6,7 @@ import com.atguigu.product.service.CategoryService;
|
|||
import com.atguigu.spzx.model.entity.product.Category;
|
||||
import com.atguigu.utils.CategoryHelper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.cache.annotation.Cacheable;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
|
@ -46,6 +47,7 @@ public class CategoryServiceImpl implements CategoryService {
|
|||
*
|
||||
* @return 分类实体类列表
|
||||
*/
|
||||
@Cacheable(value = "category", key = "'all'")
|
||||
@Override
|
||||
public List<Category> findCategoryTree() {
|
||||
// 查询所以分类,返回list集合
|
||||
|
|
Loading…
Reference in New Issue