forked from github/dataease
Merge pull request #8757 from dataease/pr@dev@fix_copy
fix(仪表板): 修复复制操作后快速保存可能出现未复制的视图被删除情况
This commit is contained in:
commit
514a6d9e23
@ -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}")
|
||||
|
@ -613,7 +613,7 @@
|
||||
|
||||
<delete id="deleteNoUseView">
|
||||
delete from chart_view
|
||||
where scene_id = #{panelId}
|
||||
where scene_id = #{panelId} and create_time < ( unix_timestamp()- 30 ) * 1000
|
||||
<if test="viewIds != null and viewIds.size() > 0">
|
||||
and id not in
|
||||
<foreach collection="viewIds" item="viewId" open='(' separator=',' close=')'>
|
||||
|
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user