mirror of
https://github.com/dataease/dataease.git
synced 2026-05-23 22:08:34 +08:00
feat(数据集): 1.删除分组,场景将同时删除dataset和chart;2.数据集SQL模式可以重新编辑SQL
This commit is contained in:
@@ -2,9 +2,12 @@ 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.mapper.ChartGroupMapper;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.controller.request.chart.ChartGroupRequest;
|
||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||
import io.dataease.dto.chart.ChartGroupDTO;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -21,6 +24,8 @@ import java.util.stream.Collectors;
|
||||
public class ChartGroupService {
|
||||
@Resource
|
||||
private ChartGroupMapper chartGroupMapper;
|
||||
@Resource
|
||||
private ChartViewService chartViewService;
|
||||
|
||||
public ChartGroupDTO save(ChartGroup chartGroup) {
|
||||
if (StringUtils.isEmpty(chartGroup.getId())) {
|
||||
@@ -45,6 +50,14 @@ public class ChartGroupService {
|
||||
ChartGroupExample ChartGroupExample = new ChartGroupExample();
|
||||
ChartGroupExample.createCriteria().andIdIn(ids);
|
||||
chartGroupMapper.deleteByExample(ChartGroupExample);
|
||||
// 删除所有chart
|
||||
deleteChart(ids);
|
||||
}
|
||||
|
||||
public void deleteChart(List<String> sceneIds) {
|
||||
for (String sceneId : sceneIds) {
|
||||
chartViewService.deleteBySceneId(sceneId);
|
||||
}
|
||||
}
|
||||
|
||||
public ChartGroup getScene(String id) {
|
||||
|
||||
@@ -75,6 +75,12 @@ public class ChartViewService {
|
||||
chartViewMapper.deleteByPrimaryKey(id);
|
||||
}
|
||||
|
||||
public void deleteBySceneId(String sceneId) {
|
||||
ChartViewExample chartViewExample = new ChartViewExample();
|
||||
chartViewExample.createCriteria().andSceneIdEqualTo(sceneId);
|
||||
chartViewMapper.deleteByExample(chartViewExample);
|
||||
}
|
||||
|
||||
public ChartViewDTO getData(String id) throws Exception {
|
||||
ChartViewWithBLOBs view = chartViewMapper.selectByPrimaryKey(id);
|
||||
List<ChartViewFieldDTO> xAxis = new Gson().fromJson(view.getXAxis(), new TypeToken<List<ChartViewFieldDTO>>() {
|
||||
|
||||
@@ -52,10 +52,8 @@ public class DataSetGroupService {
|
||||
DatasetGroupExample datasetGroupExample = new DatasetGroupExample();
|
||||
datasetGroupExample.createCriteria().andIdIn(ids);
|
||||
datasetGroupMapper.deleteByExample(datasetGroupExample);
|
||||
// 获取type为scene的id,删除场景下的表和字段
|
||||
deleteTableAndField(tree.stream().filter(ele -> {
|
||||
return StringUtils.equalsIgnoreCase(ele.getType(), "scene");
|
||||
}).map(DatasetGroup::getId).collect(Collectors.toList()));
|
||||
// 删除场景下的表和字段
|
||||
deleteTableAndField(ids);
|
||||
}
|
||||
|
||||
public DatasetGroup getScene(String id) {
|
||||
|
||||
Reference in New Issue
Block a user