From 5b668e4d6fda130bb039786c83c0d12eb6281976 Mon Sep 17 00:00:00 2001 From: stylefeng Date: Mon, 14 Oct 2024 11:23:49 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=908.3.0=E3=80=91=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E4=B8=B4=E6=97=B6=E7=BC=93=E5=AD=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../kernel/dict/modular/service/impl/DictServiceImpl.java | 3 +++ .../sys/modular/user/service/impl/SysUserServiceImpl.java | 2 ++ 2 files changed, 5 insertions(+) diff --git a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/service/impl/DictServiceImpl.java b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/service/impl/DictServiceImpl.java index e299140a4..5d37c1603 100644 --- a/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/service/impl/DictServiceImpl.java +++ b/kernel-s-dict/dict-business/src/main/java/cn/stylefeng/roses/kernel/dict/modular/service/impl/DictServiceImpl.java @@ -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 implements } @Override + @Cacheable(value = "dicts", key = "#dictTypeId+#dictCode", unless = "#result.length() == 0") public String getDictName(Long dictTypeId, String dictCode) { LambdaQueryWrapper sysDictLambdaQueryWrapper = new LambdaQueryWrapper<>(); sysDictLambdaQueryWrapper.eq(SysDict::getDictTypeId, dictTypeId); @@ -215,6 +217,7 @@ public class DictServiceImpl extends ServiceImpl implements } @Override + @Cacheable(value = "dicts", key = "#dictTypeCode+#dictCode", unless = "#result.length() == 0") public String getDictName(String dictTypeCode, String dictCode) { // 获取字典类型编码对应的字典类型id diff --git a/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java index 19b7ca0ed..767da1195 100644 --- a/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java +++ b/kernel-s-system/system-business-hr/src/main/java/cn/stylefeng/roses/kernel/sys/modular/user/service/impl/SysUserServiceImpl.java @@ -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 impl } @Override + @Cacheable(value = "users", key = "#userId", unless = "#result.length() == 0") public String getUserRealName(Long userId) { LambdaQueryWrapper sysUserLambdaQueryWrapper = new LambdaQueryWrapper<>(); sysUserLambdaQueryWrapper.select(SysUser::getRealName);