perf(utils): 优化字典工具类性能并移除重复依赖

- 在DictUtils中添加类型检查避免不必要的序列化反序列化操作
- 移除pom.xml中的重复jackson-databind依赖配置
- 提升字典数据获取的执行效率
This commit is contained in:
2026-06-11 14:49:42 +08:00
parent 773a485114
commit 3e650dd041
2 changed files with 6 additions and 4 deletions

View File

@@ -115,10 +115,6 @@
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<dependency>
<groupId>tools.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
</dependency>
<!-- éÜÿéââ¬Â¡Ã…’JSONèçãæžÐå™è -->
<!-- ioåøøçââ¬ÂÃ¨Ã¥Ã·Ã¥Ã¥ââ¬Â¦Ã·Ã§Ã±Ã» -->

View File

@@ -43,6 +43,12 @@ public class DictUtils {
if (StringUtils.isNull(cached)) {
return null;
}
// 如果已经是目标类型,直接返回
if (cached instanceof List && ((List<?>) cached).stream().allMatch(e -> e instanceof SysDictData)) {
@SuppressWarnings("unchecked")
List<SysDictData> result = (List<SysDictData>) cached;
return result;
}
com.fasterxml.jackson.core.type.TypeReference<List<SysDictData>> typeRef =
new com.fasterxml.jackson.core.type.TypeReference<List<SysDictData>>() {};
ObjectMapper mapper = new ObjectMapper()