diff --git a/backend/src/main/java/com/yfd/platform/config/RedisConfig.java b/backend/src/main/java/com/yfd/platform/config/RedisConfig.java index f57ac0e2..e23850cb 100644 --- a/backend/src/main/java/com/yfd/platform/config/RedisConfig.java +++ b/backend/src/main/java/com/yfd/platform/config/RedisConfig.java @@ -63,6 +63,7 @@ public class RedisConfig { Map cacheConfigs = new HashMap<>(); cacheConfigs.put("dictCache", defaultConfig.entryTtl(Duration.ofHours(6))); cacheConfigs.put("dataCache", defaultConfig.entryTtl(Duration.ofMinutes(5))); + cacheConfigs.put("engInfoCache", defaultConfig.entryTtl(Duration.ofHours(2))); return RedisCacheManager.builder(redisConnectionFactory) .cacheDefaults(defaultConfig) diff --git a/backend/src/main/java/com/yfd/platform/qgc_base/service/impl/SdEngInfoBHServiceImpl.java b/backend/src/main/java/com/yfd/platform/qgc_base/service/impl/SdEngInfoBHServiceImpl.java index be1aa4b8..65b23e36 100644 --- a/backend/src/main/java/com/yfd/platform/qgc_base/service/impl/SdEngInfoBHServiceImpl.java +++ b/backend/src/main/java/com/yfd/platform/qgc_base/service/impl/SdEngInfoBHServiceImpl.java @@ -38,6 +38,8 @@ import com.yfd.platform.system.service.IAdminAuthService; import com.yfd.platform.utils.QgcQueryWrapperUtil; import com.yfd.platform.utils.SecurityUtils; import jakarta.annotation.Resource; +import org.springframework.cache.annotation.CacheEvict; +import org.springframework.cache.annotation.Cacheable; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; import org.springframework.util.StringUtils; @@ -104,16 +106,19 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl getByBaseId(String baseId) { return engInfoBHMapper.selectByBaseId(baseId); } @Override + @Cacheable(cacheNames = "engInfoCache", key = "'eng:hycd:' + #hycd") public List getByHycd(String hycd) { return engInfoBHMapper.selectByHycd(hycd); } @Override + @Cacheable(cacheNames = "engInfoCache", key = "'eng:rvcd:' + #rvcd + ':' + #reachcd") public List getByRvcd(String rvcd,String reachcd) { return engInfoBHMapper.selectByRvcd(rvcd,reachcd); } @@ -223,6 +228,7 @@ public class SdEngInfoBHServiceImpl extends ServiceImpl ids, String source) { List stcdList = ids == null ? new ArrayList<>() : ids.stream()