Merge remote-tracking branch 'origin/main' into main

This commit is contained in:
fit2cloud-chenyw 2021-03-31 16:35:58 +08:00
commit 79d37827a4
3 changed files with 45 additions and 5 deletions

View File

@ -1,9 +1,6 @@
package io.dataease.service.chart;
import io.dataease.base.domain.ChartGroup;
import io.dataease.base.domain.ChartGroupExample;
import io.dataease.base.domain.DatasetGroup;
import io.dataease.base.domain.DatasetTable;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.ChartGroupMapper;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.controller.request.chart.ChartGroupRequest;
@ -28,6 +25,7 @@ public class ChartGroupService {
private ChartViewService chartViewService;
public ChartGroupDTO save(ChartGroup chartGroup) {
checkName(chartGroup);
if (StringUtils.isEmpty(chartGroup.getId())) {
chartGroup.setId(UUID.randomUUID().toString());
chartGroup.setCreateTime(System.currentTimeMillis());
@ -125,4 +123,25 @@ public class ChartGroupService {
}
return ids;
}
private void checkName(ChartGroup chartGroup) {
ChartGroupExample chartGroupExample = new ChartGroupExample();
ChartGroupExample.Criteria criteria = chartGroupExample.createCriteria();
if (StringUtils.isNotEmpty(chartGroup.getPid())) {
criteria.andPidEqualTo(chartGroup.getPid());
}
if (StringUtils.isNotEmpty(chartGroup.getType())) {
criteria.andTypeEqualTo(chartGroup.getType());
}
if (StringUtils.isNotEmpty(chartGroup.getName())) {
criteria.andNameEqualTo(chartGroup.getName());
}
if (StringUtils.isNotEmpty(chartGroup.getId())) {
criteria.andIdNotEqualTo(chartGroup.getId());
}
List<ChartGroup> list = chartGroupMapper.selectByExample(chartGroupExample);
if (list.size() > 0) {
throw new RuntimeException("Name can't repeat in same group.");
}
}
}

View File

@ -30,6 +30,7 @@ public class DataSetGroupService {
private DataSetTableService dataSetTableService;
public DataSetGroupDTO save(DatasetGroup datasetGroup) {
checkName(datasetGroup);
if (StringUtils.isEmpty(datasetGroup.getId())) {
datasetGroup.setId(UUID.randomUUID().toString());
datasetGroup.setCreateTime(System.currentTimeMillis());
@ -132,4 +133,25 @@ public class DataSetGroupService {
}
return ids;
}
private void checkName(DatasetGroup datasetGroup) {
DatasetGroupExample datasetGroupExample = new DatasetGroupExample();
DatasetGroupExample.Criteria criteria = datasetGroupExample.createCriteria();
if (StringUtils.isNotEmpty(datasetGroup.getPid())) {
criteria.andPidEqualTo(datasetGroup.getPid());
}
if (StringUtils.isNotEmpty(datasetGroup.getType())) {
criteria.andTypeEqualTo(datasetGroup.getType());
}
if (StringUtils.isNotEmpty(datasetGroup.getName())) {
criteria.andNameEqualTo(datasetGroup.getName());
}
if (StringUtils.isNotEmpty(datasetGroup.getId())) {
criteria.andIdNotEqualTo(datasetGroup.getId());
}
List<DatasetGroup> list = datasetGroupMapper.selectByExample(datasetGroupExample);
if (list.size() > 0) {
throw new RuntimeException("Name can't repeat in same group.");
}
}
}

View File

@ -16,7 +16,6 @@ import org.apache.spark.api.java.JavaPairRDD;
import org.apache.spark.api.java.JavaRDD;
import org.apache.spark.api.java.JavaSparkContext;
import org.apache.spark.api.java.function.FlatMapFunction;
import org.apache.spark.api.java.function.Function;
import org.apache.spark.sql.Dataset;
import org.apache.spark.sql.Row;
import org.apache.spark.sql.RowFactory;