From 9b9f424e6c1beaa43ffacbd38c008e98822a2569 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=96=AF=E7=8B=82=E7=9A=84=E7=8B=AE=E5=AD=90Li?= <15040126243@163.com> Date: Mon, 26 Jun 2023 12:41:06 +0800 Subject: [PATCH] =?UTF-8?q?fix=20=E4=BF=AE=E5=A4=8D=20=E5=AD=97=E5=85=B8?= =?UTF-8?q?=E7=BC=93=E5=AD=98=E6=B3=A8=E8=A7=A3=E4=BD=BF=E7=94=A8=E9=94=99?= =?UTF-8?q?=E8=AF=AF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/org/dromara/system/service/ISysDictTypeService.java | 2 +- .../dromara/system/service/impl/SysDictTypeServiceImpl.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysDictTypeService.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysDictTypeService.java index 52cdd2b0..3b32d6cb 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysDictTypeService.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISysDictTypeService.java @@ -75,7 +75,7 @@ public interface ISysDictTypeService { * @param bo 字典类型信息 * @return 结果 */ - List insertDictType(SysDictTypeBo bo); + List insertDictType(SysDictTypeBo bo); /** * 修改保存字典类型信息 diff --git a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDictTypeServiceImpl.java b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDictTypeServiceImpl.java index 971b0b2b..d0e95623 100644 --- a/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDictTypeServiceImpl.java +++ b/ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SysDictTypeServiceImpl.java @@ -123,7 +123,6 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService * @param dictType 字典类型 * @return 字典类型 */ - @Cacheable(cacheNames = CacheNames.SYS_DICT, key = "#dictType") @Override public SysDictTypeVo selectDictTypeByType(String dictType) { return baseMapper.selectVoById(new LambdaQueryWrapper().eq(SysDictType::getDictType, dictType)); @@ -163,10 +162,11 @@ public class SysDictTypeServiceImpl implements ISysDictTypeService, DictService */ @CachePut(cacheNames = CacheNames.SYS_DICT, key = "#bo.dictType") @Override - public List insertDictType(SysDictTypeBo bo) { + public List insertDictType(SysDictTypeBo bo) { SysDictType dict = MapstructUtils.convert(bo, SysDictType.class); int row = baseMapper.insert(dict); if (row > 0) { + // 新增 type 下无 data 数据 返回空防止缓存穿透 return new ArrayList<>(); } throw new ServiceException("操作失败");