Skip to content

Commit b00d779

Browse files
feat: 仪表板有过滤条件时 不使用缓存
1 parent f098f65 commit b00d779

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

backend/src/main/java/io/dataease/service/chart/ChartViewService.java

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,10 +222,17 @@ public ChartViewDTO getData(String id, ChartExtRequest requestList) throws Excep
222222
// String key = "provider_sql_"+datasourceRequest.getDatasource().getId() + "_" + datasourceRequest.getTable() + "_" +datasourceRequest.getQuery();
223223
// 定时抽取使用缓存
224224
Object cache;
225-
if ((cache = CacheUtils.get(JdbcConstants.VIEW_CACHE_KEY, id)) == null) {
225+
// 仪表板有参数不实用缓存
226+
if (CollectionUtils.isNotEmpty(requestList.getFilter())) {
227+
data = datasourceProvider.getData(datasourceRequest);
228+
}
229+
// 仪表板无参数 且 未缓存过该视图 则查询后缓存
230+
else if ((cache = CacheUtils.get(JdbcConstants.VIEW_CACHE_KEY, id)) == null) {
226231
data = datasourceProvider.getData(datasourceRequest);
227232
CacheUtils.put(JdbcConstants.VIEW_CACHE_KEY, id, data, null, null);
228-
}else {
233+
}
234+
// 仪表板有缓存 使用缓存
235+
else {
229236
data = (List<String[]>) cache;
230237
}
231238
}

0 commit comments

Comments
 (0)