mirror of
https://github.com/dataease/dataease.git
synced 2026-05-22 13:30:19 +08:00
feat(feat):数据集,视图分组树优化,去除场景
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package io.dataease.base.mapper.ext;
|
||||
|
||||
import io.dataease.controller.request.BaseTreeRequest;
|
||||
import io.dataease.controller.request.chart.ChartGroupRequest;
|
||||
import io.dataease.dto.chart.ChartGroupDTO;
|
||||
|
||||
|
||||
@@ -26,6 +26,11 @@ public class ChartGroupController {
|
||||
return chartGroupService.tree(ChartGroup);
|
||||
}
|
||||
|
||||
@PostMapping("/treeNode")
|
||||
public List<ChartGroupDTO> treeNode(@RequestBody ChartGroupRequest ChartGroup) {
|
||||
return chartGroupService.tree(ChartGroup);
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{id}")
|
||||
public void tree(@PathVariable String id) {
|
||||
chartGroupService.delete(id);
|
||||
|
||||
@@ -32,6 +32,11 @@ public class ChartViewController {
|
||||
return chartViewService.list(chartViewRequest);
|
||||
}
|
||||
|
||||
@PostMapping("/listAndGroup")
|
||||
public List<ChartViewDTO> listAndGroup(@RequestBody ChartViewRequest chartViewRequest) {
|
||||
return chartViewService.listAndGroup(chartViewRequest);
|
||||
}
|
||||
|
||||
@PostMapping("/get/{id}")
|
||||
public ChartViewWithBLOBs get(@PathVariable String id) {
|
||||
return chartViewService.get(id);
|
||||
|
||||
@@ -21,6 +21,7 @@ public class DataSetGroupController {
|
||||
private DataSetGroupService dataSetGroupService;
|
||||
@Resource
|
||||
private ExtractDataService extractDataService;
|
||||
|
||||
@PostMapping("/save")
|
||||
public DataSetGroupDTO save(@RequestBody DatasetGroup datasetGroup) {
|
||||
return dataSetGroupService.save(datasetGroup);
|
||||
@@ -31,8 +32,13 @@ public class DataSetGroupController {
|
||||
return dataSetGroupService.tree(datasetGroup);
|
||||
}
|
||||
|
||||
@PostMapping("/treeNode")
|
||||
public List<DataSetGroupDTO> treeNode(@RequestBody DataSetGroupRequest datasetGroup) {
|
||||
return dataSetGroupService.treeNode(datasetGroup);
|
||||
}
|
||||
|
||||
@PostMapping("/delete/{id}")
|
||||
public void tree(@PathVariable String id) throws Exception{
|
||||
public void tree(@PathVariable String id) throws Exception {
|
||||
dataSetGroupService.delete(id);
|
||||
}
|
||||
|
||||
@@ -42,7 +48,7 @@ public class DataSetGroupController {
|
||||
}
|
||||
|
||||
@PostMapping("/isKettleRunning")
|
||||
public boolean isKettleRunning(){
|
||||
public boolean isKettleRunning() {
|
||||
return extractDataService.isKettleRunning();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,11 @@ public class DataSetTableController {
|
||||
return dataSetTableService.list(dataSetTableRequest);
|
||||
}
|
||||
|
||||
@PostMapping("listAndGroup")
|
||||
public List<DataSetTableDTO> listAndGroup(@RequestBody DataSetTableRequest dataSetTableRequest) {
|
||||
return dataSetTableService.listAndGroup(dataSetTableRequest);
|
||||
}
|
||||
|
||||
@PostMapping("get/{id}")
|
||||
public DatasetTable get(@PathVariable String id) {
|
||||
return dataSetTableService.get(id);
|
||||
|
||||
@@ -16,4 +16,7 @@ public class ChartViewDTO extends ChartViewWithBLOBs {
|
||||
private Map<String, Object> data;
|
||||
|
||||
private String privileges;
|
||||
|
||||
private Boolean isLeaf;
|
||||
private String pid;
|
||||
}
|
||||
|
||||
@@ -15,4 +15,7 @@ import java.util.List;
|
||||
public class DataSetTableDTO extends DatasetTable {
|
||||
private List<DataSetTableDTO> children;
|
||||
private String privileges;
|
||||
|
||||
private Boolean isLeaf;
|
||||
private String pid;
|
||||
}
|
||||
|
||||
@@ -81,6 +81,16 @@ public class ChartGroupService {
|
||||
}
|
||||
|
||||
public List<ChartGroupDTO> tree(ChartGroupRequest chartGroup) {
|
||||
chartGroup.setLevel(null);
|
||||
chartGroup.setPid("0");
|
||||
chartGroup.setType("group");
|
||||
chartGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
List<ChartGroupDTO> treeInfo = extChartGroupMapper.search(chartGroup);
|
||||
List<ChartGroupDTO> result = TreeUtils.mergeTree(treeInfo);
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<ChartGroupDTO> treeNode(ChartGroupRequest chartGroup) {
|
||||
chartGroup.setLevel(null);
|
||||
chartGroup.setPid(null);
|
||||
chartGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
|
||||
@@ -4,21 +4,23 @@ import com.google.gson.Gson;
|
||||
import com.google.gson.reflect.TypeToken;
|
||||
import io.dataease.base.domain.*;
|
||||
import io.dataease.base.mapper.ChartViewMapper;
|
||||
import io.dataease.base.mapper.ext.ExtChartGroupMapper;
|
||||
import io.dataease.base.mapper.ext.ExtChartViewMapper;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.commons.utils.BeanUtils;
|
||||
import io.dataease.commons.utils.CommonBeanFactory;
|
||||
import io.dataease.controller.request.chart.ChartExtFilterRequest;
|
||||
import io.dataease.controller.request.chart.ChartExtRequest;
|
||||
import io.dataease.controller.request.chart.ChartGroupRequest;
|
||||
import io.dataease.controller.request.chart.ChartViewRequest;
|
||||
import io.dataease.controller.request.dataset.DataSetGroupRequest;
|
||||
import io.dataease.datasource.provider.DatasourceProvider;
|
||||
import io.dataease.datasource.provider.ProviderFactory;
|
||||
import io.dataease.datasource.request.DatasourceRequest;
|
||||
import io.dataease.datasource.service.DatasourceService;
|
||||
import io.dataease.dto.chart.ChartCustomFilterDTO;
|
||||
import io.dataease.dto.chart.ChartViewDTO;
|
||||
import io.dataease.dto.chart.ChartViewFieldDTO;
|
||||
import io.dataease.dto.chart.Series;
|
||||
import io.dataease.dto.chart.*;
|
||||
import io.dataease.dto.dataset.DataSetGroupDTO;
|
||||
import io.dataease.dto.dataset.DataSetTableDTO;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
@@ -51,6 +53,8 @@ public class ChartViewService {
|
||||
private DatasourceService datasourceService;
|
||||
@Resource
|
||||
private DataSetTableFieldsService dataSetTableFieldsService;
|
||||
@Resource
|
||||
private ExtChartGroupMapper extChartGroupMapper;
|
||||
|
||||
public ChartViewWithBLOBs save(ChartViewWithBLOBs chartView) {
|
||||
checkName(chartView);
|
||||
@@ -72,6 +76,30 @@ public class ChartViewService {
|
||||
return extChartViewMapper.search(chartViewRequest);
|
||||
}
|
||||
|
||||
public List<ChartViewDTO> listAndGroup(ChartViewRequest chartViewRequest) {
|
||||
chartViewRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
List<ChartViewDTO> charts = extChartViewMapper.search(chartViewRequest);
|
||||
charts.forEach(ele -> ele.setIsLeaf(true));
|
||||
// 获取group下的子group
|
||||
ChartGroupRequest chartGroupRequest = new ChartGroupRequest();
|
||||
chartGroupRequest.setLevel(null);
|
||||
chartGroupRequest.setType("group");
|
||||
chartGroupRequest.setPid(chartViewRequest.getSceneId());
|
||||
chartGroupRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
List<ChartGroupDTO> groups = extChartGroupMapper.search(chartGroupRequest);
|
||||
List<ChartViewDTO> group = groups.stream().map(ele -> {
|
||||
ChartViewDTO dto = new ChartViewDTO();
|
||||
dto.setId(ele.getId());
|
||||
dto.setName(ele.getName());
|
||||
dto.setIsLeaf(false);
|
||||
dto.setType("group");
|
||||
dto.setPid(ele.getPid());
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
group.addAll(charts);
|
||||
return group;
|
||||
}
|
||||
|
||||
public ChartViewWithBLOBs get(String id) {
|
||||
return chartViewMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
@@ -87,6 +87,16 @@ public class DataSetGroupService {
|
||||
}
|
||||
}
|
||||
|
||||
public List<DataSetGroupDTO> treeNode(DataSetGroupRequest datasetGroup) {
|
||||
datasetGroup.setLevel(null);
|
||||
datasetGroup.setPid("0");
|
||||
datasetGroup.setType("group");
|
||||
datasetGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
List<DataSetGroupDTO> treeInfo = extDataSetGroupMapper.search(datasetGroup);
|
||||
List<DataSetGroupDTO> result = TreeUtils.mergeTree(treeInfo);
|
||||
return result;
|
||||
}
|
||||
|
||||
public List<DataSetGroupDTO> tree(DataSetGroupRequest datasetGroup) {
|
||||
datasetGroup.setLevel(null);
|
||||
datasetGroup.setPid(null);
|
||||
|
||||
@@ -5,21 +5,19 @@ import com.fit2cloud.quartz.anno.QuartzScheduled;
|
||||
import com.google.gson.Gson;
|
||||
import io.dataease.base.domain.*;
|
||||
import io.dataease.base.mapper.*;
|
||||
import io.dataease.base.mapper.ext.ExtDataSetGroupMapper;
|
||||
import io.dataease.base.mapper.ext.ExtDataSetTableMapper;
|
||||
import io.dataease.base.mapper.ext.UtilMapper;
|
||||
import io.dataease.commons.constants.JobStatus;
|
||||
import io.dataease.commons.utils.*;
|
||||
import io.dataease.controller.request.dataset.DataSetGroupRequest;
|
||||
import io.dataease.controller.request.dataset.DataSetTableRequest;
|
||||
import io.dataease.datasource.dto.TableFiled;
|
||||
import io.dataease.datasource.provider.DatasourceProvider;
|
||||
import io.dataease.datasource.provider.JdbcProvider;
|
||||
import io.dataease.datasource.provider.ProviderFactory;
|
||||
import io.dataease.datasource.request.DatasourceRequest;
|
||||
import io.dataease.dto.dataset.DataSetPreviewPage;
|
||||
import io.dataease.dto.dataset.DataSetTableDTO;
|
||||
import io.dataease.dto.dataset.DataSetTableUnionDTO;
|
||||
import io.dataease.dto.dataset.DataTableInfoCustomUnion;
|
||||
import io.dataease.dto.dataset.DataTableInfoDTO;
|
||||
import io.dataease.dto.dataset.*;
|
||||
import io.dataease.i18n.Translator;
|
||||
import io.dataease.provider.DDLProvider;
|
||||
import io.dataease.provider.QueryProvider;
|
||||
@@ -81,6 +79,8 @@ public class DataSetTableService {
|
||||
private QrtzSchedulerStateMapper qrtzSchedulerStateMapper;
|
||||
@Resource
|
||||
private DatasetTableTaskLogMapper datasetTableTaskLogMapper;
|
||||
@Resource
|
||||
private ExtDataSetGroupMapper extDataSetGroupMapper;
|
||||
private static String lastUpdateTime = "${__last_update_time__}";
|
||||
private static String currentUpdateTime = "${__current_update_time__}";
|
||||
|
||||
@@ -186,6 +186,31 @@ public class DataSetTableService {
|
||||
return extDataSetTableMapper.search(dataSetTableRequest);
|
||||
}
|
||||
|
||||
public List<DataSetTableDTO> listAndGroup(DataSetTableRequest dataSetTableRequest) {
|
||||
dataSetTableRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
dataSetTableRequest.setTypeFilter(dataSetTableRequest.getTypeFilter());
|
||||
List<DataSetTableDTO> ds = extDataSetTableMapper.search(dataSetTableRequest);
|
||||
ds.forEach(ele -> ele.setIsLeaf(true));
|
||||
// 获取group下的子group
|
||||
DataSetGroupRequest datasetGroup = new DataSetGroupRequest();
|
||||
datasetGroup.setLevel(null);
|
||||
datasetGroup.setType("group");
|
||||
datasetGroup.setPid(dataSetTableRequest.getSceneId());
|
||||
datasetGroup.setUserId(String.valueOf(AuthUtils.getUser().getUserId()));
|
||||
List<DataSetGroupDTO> groups = extDataSetGroupMapper.search(datasetGroup);
|
||||
List<DataSetTableDTO> group = groups.stream().map(ele -> {
|
||||
DataSetTableDTO dto = new DataSetTableDTO();
|
||||
dto.setId(ele.getId());
|
||||
dto.setName(ele.getName());
|
||||
dto.setIsLeaf(false);
|
||||
dto.setType("group");
|
||||
dto.setPid(ele.getPid());
|
||||
return dto;
|
||||
}).collect(Collectors.toList());
|
||||
group.addAll(ds);
|
||||
return group;
|
||||
}
|
||||
|
||||
public DatasetTable get(String id) {
|
||||
return datasetTableMapper.selectByPrimaryKey(id);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user