forked from github/dataease
refactor: 复制视图名称不重复
This commit is contained in:
parent
4f30b4e40f
commit
c0682bcdc8
@ -187,11 +187,11 @@
|
||||
`senior`,
|
||||
`data_from`)
|
||||
SELECT #{newChartId},
|
||||
`name`,
|
||||
GET_CHART_VIEW_COPY_NAME(#{oldChartId},#{panelId}) as `name`,
|
||||
#{panelId},
|
||||
`table_id`,
|
||||
`type`,
|
||||
`title`,
|
||||
GET_CHART_VIEW_COPY_NAME(#{oldChartId},#{panelId}) as `title`,
|
||||
`x_axis`,
|
||||
`x_axis_ext`,
|
||||
`y_axis`,
|
||||
|
@ -116,6 +116,13 @@ public class ChartViewService {
|
||||
|
||||
public ChartViewWithBLOBs newOne(ChartViewWithBLOBs chartView) {
|
||||
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.setId(UUID.randomUUID().toString());
|
||||
chartView.setCreateBy(AuthUtils.getUser().getUsername());
|
||||
|
Loading…
Reference in New Issue
Block a user