| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.ruoyi.common.constant.CacheConstant; |
| | | import com.ruoyi.common.constant.Constants; |
| | | import com.ruoyi.common.core.domain.entity.SysDictData; |
| | | import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl; |
| | |
| | | import com.ruoyi.common.utils.StringUtils; |
| | | import com.ruoyi.system.mapper.SysDictDataMapper; |
| | | import com.ruoyi.system.service.ISysDictDataService; |
| | | import org.springframework.cache.annotation.Cacheable; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | |
| | | String getCacheKey(String configKey) { |
| | | return Constants.SYS_DICT_KEY + configKey; |
| | | } |
| | | |
| | | /** |
| | | * 通过查询指定code 获取字典值text |
| | | * |
| | | * @param code |
| | | * @param key |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Cacheable(value = CacheConstant.SYS_DICT_CACHE, key = "#code+':'+#key") |
| | | public String queryDictTextByKey(String code, String key) { |
| | | System.out.println("无缓存dictText的时候调用这里!"); |
| | | return baseMapper.queryDictTextByKey(code, key); |
| | | } |
| | | |
| | | /** |
| | | * 通过查询指定table的 text code 获取字典值text |
| | | * dictTableCache采用redis缓存有效期10分钟 |
| | | * |
| | | * @param table |
| | | * @param text |
| | | * @param code |
| | | * @param key |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Cacheable(value = CacheConstant.SYS_DICT_TABLE_CACHE) |
| | | public String queryTableDictTextByKey(String table, String text, String code, String key) { |
| | | System.out.println("无缓存dictTable的时候调用这里!"); |
| | | return baseMapper.queryTableDictTextByKey(table, text, code, key); |
| | | } |
| | | } |