Merge pull request #2990 from dataease/pr@dev@refactor_panel-copy

refactor(仪表板): 仪表板复制时同时复制视图字段
This commit is contained in:
王嘉豪 2022-08-30 16:18:11 +08:00 committed by GitHub
commit 404842ba7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 51 additions and 0 deletions

View File

@ -28,6 +28,8 @@ public interface ExtChartViewMapper {
void chartCopyWithPanel(@Param("copyId") String copyId);
void chartFiledCopyWithPanel(@Param("copyId") String copyId);
void deleteCircleView(@Param("pid") String pid);
void deleteCircleGroup(@Param("pid") String pid);

View File

@ -592,4 +592,51 @@
<select id="chartOptions" resultType="io.dataease.dto.chart.ViewOption">
select id, title as name from chart_view where scene_id = #{panelId}
</select>
<insert id='chartFiledCopyWithPanel'>
INSERT INTO chart_view_field (
id,
table_id,
chart_id,
`name`,
dataease_name,
group_type,
`type`,
`size`,
de_type,
de_type_format,
de_extract_type,
ext_field,
`checked`,
column_index,
last_sync_time
) SELECT
uuid() AS id,
chart_view_field.table_id,
chart_view_field.pv_copy.chart_view_id AS chart_id,
chart_view_field.`name`,
chart_view_field.dataease_name,
chart_view_field.group_type,
chart_view_field.`type`,
chart_view_field.`size`,
chart_view_field.de_type,
chart_view_field.de_type_format,
chart_view_field.de_extract_type,
chart_view_field.ext_field,
chart_view_field.`checked`,
chart_view_field.column_index,
chart_view_field.last_sync_time
FROM
(
SELECT
panel_id,
copy_from_view,
chart_view_id
FROM
panel_view
WHERE
copy_id = #{copyId}
) pv_copy
INNER JOIN chart_view_field ON chart_view_field.chart_id = pv_copy.copy_from_view
</insert>
</mapper>

View File

@ -352,6 +352,8 @@ public class PanelGroupService {
extPanelViewMapper.copyFromPanel(newPanelId, sourcePanelId, copyId);
//TODO 复制视图 chart_view
extChartViewMapper.chartCopyWithPanel(copyId);
//TODO 复制视图字段 chart_view_field
extChartViewMapper.chartFiledCopyWithPanel(copyId);
//TODO 替换panel_data viewId 数据
List<PanelView> panelViewList = panelViewService.findPanelViews(copyId);
//TODO 复制模板缓存数据