mirror of
https://github.com/dataease/dataease.git
synced 2026-06-17 13:01:44 +08:00
feat: 仪表板编辑时可以进行视图的复制,复制后的视图样式等改变不影响原有视图
This commit is contained in:
@@ -12,6 +12,8 @@ import java.util.List;
|
||||
public interface ExtChartViewMapper {
|
||||
List<ChartViewDTO> search(ChartViewRequest request);
|
||||
|
||||
void chartCopy(@Param("newChartId")String newChartId,@Param("oldChartId")String oldChartId);
|
||||
|
||||
@Select("select id from chart_view where table_id = #{tableId}")
|
||||
List<String> allViewIds(@Param("tableId") String tableId);
|
||||
}
|
||||
|
||||
@@ -27,4 +27,45 @@
|
||||
|
||||
|
||||
</select>
|
||||
|
||||
<insert id="chartCopy">
|
||||
INSERT INTO chart_view (
|
||||
`id`,
|
||||
`name`,
|
||||
`scene_id`,
|
||||
`table_id`,
|
||||
`type`,
|
||||
`title`,
|
||||
`x_axis`,
|
||||
`y_axis`,
|
||||
`custom_attr`,
|
||||
`custom_style`,
|
||||
`custom_filter`,
|
||||
`create_by`,
|
||||
`create_time`,
|
||||
`update_time`,
|
||||
`snapshot`,
|
||||
`style_priority`
|
||||
) SELECT
|
||||
#{newChartId},
|
||||
GET_CHART_VIEW_COPY_NAME ( #{oldChartId} ),
|
||||
`scene_id`,
|
||||
`table_id`,
|
||||
`type`,
|
||||
`title`,
|
||||
`x_axis`,
|
||||
`y_axis`,
|
||||
`custom_attr`,
|
||||
`custom_style`,
|
||||
`custom_filter`,
|
||||
`create_by`,
|
||||
`create_time`,
|
||||
`update_time`,
|
||||
`snapshot`,
|
||||
`style_priority`
|
||||
FROM
|
||||
chart_view
|
||||
WHERE
|
||||
id = #{oldChartId}
|
||||
</insert>
|
||||
</mapper>
|
||||
|
||||
@@ -55,4 +55,9 @@ public class ChartViewController {
|
||||
public Map<String, Object> chartDetail(@PathVariable String id) {
|
||||
return chartViewService.getChartDetail(id);
|
||||
}
|
||||
|
||||
@PostMapping("chartCopy/{id}")
|
||||
public String chartCopy(@PathVariable String id) {
|
||||
return chartViewService.chartCopy(id);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -342,4 +342,10 @@ public class ChartViewService {
|
||||
public ChartViewWithBLOBs findOne(String id) {
|
||||
return chartViewMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public String chartCopy(String id) {
|
||||
String newChartId = UUID.randomUUID().toString();
|
||||
extChartViewMapper.chartCopy(newChartId,id);
|
||||
return newChartId;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user