mirror of https://gitee.com/stylefeng/roses
【8.3.0】增加临时缓存
parent
6584441532
commit
5b668e4d6f
|
@ -52,6 +52,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@ -201,6 +202,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Cacheable(value = "dicts", key = "#dictTypeId+#dictCode", unless = "#result.length() == 0")
|
||||||
public String getDictName(Long dictTypeId, String dictCode) {
|
public String getDictName(Long dictTypeId, String dictCode) {
|
||||||
LambdaQueryWrapper<SysDict> sysDictLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysDict> sysDictLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
sysDictLambdaQueryWrapper.eq(SysDict::getDictTypeId, dictTypeId);
|
sysDictLambdaQueryWrapper.eq(SysDict::getDictTypeId, dictTypeId);
|
||||||
|
@ -215,6 +217,7 @@ public class DictServiceImpl extends ServiceImpl<DictMapper, SysDict> implements
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Cacheable(value = "dicts", key = "#dictTypeCode+#dictCode", unless = "#result.length() == 0")
|
||||||
public String getDictName(String dictTypeCode, String dictCode) {
|
public String getDictName(String dictTypeCode, String dictCode) {
|
||||||
|
|
||||||
// 获取字典类型编码对应的字典类型id
|
// 获取字典类型编码对应的字典类型id
|
||||||
|
|
|
@ -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.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import jakarta.annotation.Resource;
|
import jakarta.annotation.Resource;
|
||||||
|
import org.springframework.cache.annotation.Cacheable;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
|
@ -469,6 +470,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@Cacheable(value = "users", key = "#userId", unless = "#result.length() == 0")
|
||||||
public String getUserRealName(Long userId) {
|
public String getUserRealName(Long userId) {
|
||||||
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SysUser> sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||||
sysUserLambdaQueryWrapper.select(SysUser::getRealName);
|
sysUserLambdaQueryWrapper.select(SysUser::getRealName);
|
||||||
|
|
Loading…
Reference in New Issue