提交 c0682bcd authored 作者: wangjiahao's avatar wangjiahao

refactor: 复制视图名称不重复

上级 4f30b4e4
...@@ -187,11 +187,11 @@ ...@@ -187,11 +187,11 @@
`senior`, `senior`,
`data_from`) `data_from`)
SELECT #{newChartId}, SELECT #{newChartId},
`name`, GET_CHART_VIEW_COPY_NAME(#{oldChartId},#{panelId}) as `name`,
#{panelId}, #{panelId},
`table_id`, `table_id`,
`type`, `type`,
`title`, GET_CHART_VIEW_COPY_NAME(#{oldChartId},#{panelId}) as `title`,
`x_axis`, `x_axis`,
`x_axis_ext`, `x_axis_ext`,
`y_axis`, `y_axis`,
......
...@@ -116,6 +116,13 @@ public class ChartViewService { ...@@ -116,6 +116,13 @@ public class ChartViewService {
public ChartViewWithBLOBs newOne(ChartViewWithBLOBs chartView) { public ChartViewWithBLOBs newOne(ChartViewWithBLOBs chartView) {
long timestamp = System.currentTimeMillis(); long timestamp = System.currentTimeMillis();
// 校验名称
ChartViewExample queryExample = new ChartViewExample();
queryExample.createCriteria().andSceneIdEqualTo(chartView.getSceneId()).andNameEqualTo(chartView.getName());
List<ChartView> result = chartViewMapper.selectByExample(queryExample);
if(CollectionUtils.isNotEmpty(result)){
DEException.throwException(Translator.get("theme_name_repeat"));
}
chartView.setUpdateTime(timestamp); chartView.setUpdateTime(timestamp);
chartView.setId(UUID.randomUUID().toString()); chartView.setId(UUID.randomUUID().toString());
chartView.setCreateBy(AuthUtils.getUser().getUsername()); chartView.setCreateBy(AuthUtils.getUser().getUsername());
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论