Merge pull request #8757 from dataease/pr@dev@fix_copy

fix(仪表板): 修复复制操作后快速保存可能出现未复制的视图被删除情况
This commit is contained in:
王嘉豪 2024-03-28 09:01:01 +08:00 committed by GitHub
commit 514a6d9e23
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 14 additions and 3 deletions

View File

@ -109,6 +109,13 @@ public class ChartViewController {
return chartViewService.chartCopy(id, panelId);
}
@DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANEL_LEVEL_MANAGE, paramIndex = 1)
@ApiOperation("复制")
@PostMapping("chartCopyWithId/{id}/{panelId}/{newId}")
public String chartCopyWithId(@PathVariable String id, @PathVariable String panelId, @PathVariable String newId) {
return chartViewService.chartCopy(id, newId,panelId);
}
@DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANEL_LEVEL_MANAGE, paramIndex = 1)
@ApiOperation("批量复制")
@PostMapping("chartBatchCopy/{panelId}")

View File

@ -613,7 +613,7 @@
<delete id="deleteNoUseView">
delete from chart_view
where scene_id = #{panelId}
where scene_id = #{panelId} and create_time &lt; ( unix_timestamp()- 30 ) * 1000
<if test="viewIds != null and viewIds.size() > 0">
and id not in
<foreach collection="viewIds" item="viewId" open='(' separator=',' close=')'>

View File

@ -131,8 +131,12 @@ public class PanelViewService {
//将视图从cache表中更新到正式表中
viewIds = panelViewInsertDTOList.stream().map(panelView -> panelView.getChartViewId()).collect(Collectors.toList());
}
extChartViewMapper.deleteCacheWithPanel(viewIds, panelId);
extChartViewMapper.deleteNoUseView(viewIds, panelId);
// viewIds 不存在时 不执行删除缓存防止误删情况
if(CollectionUtils.isNotEmpty(viewIds)){
extChartViewMapper.deleteCacheWithPanel(viewIds, panelId);
extChartViewMapper.deleteNoUseView(viewIds, panelId);
}
}
panelGroup.setMobileLayout(mobileLayout);
return viewIds;