【8.3.0】增加临时缓存

master
stylefeng 2024-10-14 11:23:49 +08:00
parent 6584441532
commit 5b668e4d6f
2 changed files with 5 additions and 0 deletions

View File

@ -52,6 +52,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -201,6 +202,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
}
@Override
@Cacheable(value = "dicts", key = "#dictTypeId+#dictCode", unless = "#result.length() == 0")
public String getDictName(Long dictTypeId, String dictCode) {
LambdaQueryWrapper<SysDict> sysDictLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysDictLambdaQueryWrapper.eq(SysDict::getDictTypeId, dictTypeId);
@ -215,6 +217,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
}
@Override
@Cacheable(value = "dicts", key = "#dictTypeCode+#dictCode", unless = "#result.length() == 0")
public String getDictName(String dictTypeCode, String dictCode) {
// 获取字典类型编码对应的字典类型id

View File

@ -50,6 +50,7 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import jakarta.annotation.Resource;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -469,6 +470,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
}
@Override
@Cacheable(value = "users", key = "#userId", unless = "#result.length() == 0")
public String getUserRealName(Long userId) {
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
sysUserLambdaQueryWrapper.select(SysUser::getRealName);