From 993101e6530e0e14f4d07750a42de764e2a8aba9 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Wed, 21 Aug 2024 18:25:13 +0800 Subject: [PATCH] =?UTF-8?q?refactor(=E4=BB=AA=E8=A1=A8=E6=9D=BF=E3=80=81?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=A4=A7=E5=B1=8F):=20=E4=BC=98=E5=8C=96?= =?UTF-8?q?=E5=A4=96=E9=83=A8=E5=8F=82=E6=95=B0=E8=AE=BE=E7=BD=AE=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=95=B0=E6=8D=AE=E9=9B=86=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExtVisualizationOuterParamsMapper.java | 3 + .../VisualizationOuterParamsService.java | 6 + .../ExtVisualizationOuterParamsMapper.xml | 25 ++++ .../api/visualization/dataVisualization.ts | 8 ++ .../visualization/OuterParamsSet.vue | 10 +- .../api/dataset/vo/CoreDatasetGroupVO.java | 91 +++++++++++++ .../dataset/vo/CoreDatasetTableFieldVO.java | 124 ++++++++++++++++++ .../VisualizationOuterParamsApi.java | 8 +- 8 files changed, 271 insertions(+), 4 deletions(-) create mode 100644 sdk/api/api-base/src/main/java/io/dataease/api/dataset/vo/CoreDatasetGroupVO.java create mode 100644 sdk/api/api-base/src/main/java/io/dataease/api/dataset/vo/CoreDatasetTableFieldVO.java diff --git a/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtVisualizationOuterParamsMapper.java b/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtVisualizationOuterParamsMapper.java index 89555ad4d9..abe21e2657 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtVisualizationOuterParamsMapper.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/dao/ext/mapper/ExtVisualizationOuterParamsMapper.java @@ -1,6 +1,7 @@ package io.dataease.visualization.dao.ext.mapper; +import io.dataease.api.dataset.vo.CoreDatasetGroupVO; import io.dataease.api.visualization.dto.VisualizationOuterParamsDTO; import io.dataease.api.visualization.dto.VisualizationOuterParamsInfoDTO; import org.apache.ibatis.annotations.Mapper; @@ -20,4 +21,6 @@ public interface ExtVisualizationOuterParamsMapper { void deleteOuterParamsWithVisualizationId(@Param("visualizationId") String visualizationId); List getVisualizationOuterParamsInfo(@Param("visualizationId") String visualizationId); + + List queryDsWithVisualizationId(@Param("visualizationId") String visualizationId); } diff --git a/core/core-backend/src/main/java/io/dataease/visualization/server/VisualizationOuterParamsService.java b/core/core-backend/src/main/java/io/dataease/visualization/server/VisualizationOuterParamsService.java index d022fe1854..426eb7687d 100644 --- a/core/core-backend/src/main/java/io/dataease/visualization/server/VisualizationOuterParamsService.java +++ b/core/core-backend/src/main/java/io/dataease/visualization/server/VisualizationOuterParamsService.java @@ -1,6 +1,7 @@ package io.dataease.visualization.server; import com.fasterxml.jackson.core.type.TypeReference; +import io.dataease.api.dataset.vo.CoreDatasetGroupVO; import io.dataease.api.visualization.VisualizationOuterParamsApi; import io.dataease.api.visualization.dto.VisualizationOuterParamsDTO; import io.dataease.api.visualization.dto.VisualizationOuterParamsInfoDTO; @@ -93,4 +94,9 @@ public class VisualizationOuterParamsService implements VisualizationOuterParams List result = extOuterParamsMapper.getVisualizationOuterParamsInfo(visualizationId); return new VisualizationOuterParamsBaseResponse(Optional.ofNullable(result).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(VisualizationOuterParamsInfoDTO::getSourceInfo, VisualizationOuterParamsInfoDTO::getTargetInfoList))); } + + @Override + public List queryDsWithVisualizationId(String visualizationId) { + return extOuterParamsMapper.queryDsWithVisualizationId(visualizationId); + } } diff --git a/core/core-backend/src/main/resources/mybatis/ExtVisualizationOuterParamsMapper.xml b/core/core-backend/src/main/resources/mybatis/ExtVisualizationOuterParamsMapper.xml index 8f68002f96..1e7a75463e 100644 --- a/core/core-backend/src/main/resources/mybatis/ExtVisualizationOuterParamsMapper.xml +++ b/core/core-backend/src/main/resources/mybatis/ExtVisualizationOuterParamsMapper.xml @@ -28,6 +28,13 @@ + + + + + @@ -115,5 +122,23 @@ and popi.checked=1 + + + diff --git a/core/core-frontend/src/api/visualization/dataVisualization.ts b/core/core-frontend/src/api/visualization/dataVisualization.ts index d35c8db3ce..6df17c54a5 100644 --- a/core/core-frontend/src/api/visualization/dataVisualization.ts +++ b/core/core-frontend/src/api/visualization/dataVisualization.ts @@ -107,3 +107,11 @@ export const export2AppCheck = params => { loading: true }) } + +export const queryOuterParamsDsInfo = async dvId => { + return request.get({ + url: '/dataVisualization/queryDsWithVisualizationId/' + dvId, + method: 'get', + loading: false + }) +} diff --git a/core/core-frontend/src/components/visualization/OuterParamsSet.vue b/core/core-frontend/src/components/visualization/OuterParamsSet.vue index 08cc0444ba..42f3b43086 100644 --- a/core/core-frontend/src/components/visualization/OuterParamsSet.vue +++ b/core/core-frontend/src/components/visualization/OuterParamsSet.vue @@ -13,7 +13,7 @@ - 参数列表DS + 参数列表 @@ -182,7 +182,7 @@ import { useI18n } from '@/hooks/web/useI18n' import { deepCopy } from '@/utils/utils' import generateID from '@/utils/generateID' import { queryWithVisualizationId, updateOuterParamsSet } from '@/api/visualization/outerParams' -import { viewDetailList } from '@/api/visualization/dataVisualization' +import { queryOuterParamsDsInfo, viewDetailList } from '@/api/visualization/dataVisualization' import checkArrayRepeat from '@/utils/check' import HandleMore from '@/components/handle-more/src/HandleMore.vue' import { fieldType } from '@/utils/attr' @@ -219,6 +219,7 @@ const state = reactive({ checked: false, outerParamsInfoArray: [] }, + baseDatasetInfo: [], outerParamsInfoArray: [], mapOuterParamsInfoArray: {}, panelList: [], @@ -284,7 +285,7 @@ const getFieldArray = id => { return state.viewIdFieldArrayMap[id] } -const initParams = () => { +const initParams = async () => { // 获取当前仪表板外部跳转信息 queryWithVisualizationId(dvInfo.value.id).then(rsp => { state.outerParams = rsp.data @@ -300,6 +301,9 @@ const initParams = () => { }) } }) + await queryOuterParamsDsInfo(dvInfo.value.id).then(rsp => { + state.baseDatasetInfo = rsp.data + }) getPanelViewList(dvInfo.value.id) } diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/dataset/vo/CoreDatasetGroupVO.java b/sdk/api/api-base/src/main/java/io/dataease/api/dataset/vo/CoreDatasetGroupVO.java new file mode 100644 index 0000000000..30e3abea5a --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/dataset/vo/CoreDatasetGroupVO.java @@ -0,0 +1,91 @@ +package io.dataease.api.dataset.vo; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import java.io.Serializable; +import java.util.ArrayList; +import java.util.List; + +@Data +public class CoreDatasetGroupVO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 名称 + */ + private String name; + + /** + * 父级ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long pid; + + /** + * 当前分组处于第几级 + */ + private Integer level; + + /** + * node类型:folder or dataset + */ + private String nodeType; + + /** + * sql,union + */ + private String type; + + /** + * 连接模式:0-直连,1-同步(包括excel、api等数据存在de中的表) + */ + private Integer mode; + + /** + * 关联关系树 + */ + private String info; + + /** + * 创建人ID + */ + private String createBy; + + /** + * 创建时间 + */ + private Long createTime; + + private String qrtzInstance; + + /** + * 同步状态 + */ + private String syncStatus; + + /** + * 更新人ID + */ + private String updateBy; + + /** + * 最后同步时间 + */ + private Long lastUpdateTime; + + /** + * 关联sql + */ + private String unionSql; + + private List datasetFields = new ArrayList<>(); +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/dataset/vo/CoreDatasetTableFieldVO.java b/sdk/api/api-base/src/main/java/io/dataease/api/dataset/vo/CoreDatasetTableFieldVO.java new file mode 100644 index 0000000000..f8b0f615a1 --- /dev/null +++ b/sdk/api/api-base/src/main/java/io/dataease/api/dataset/vo/CoreDatasetTableFieldVO.java @@ -0,0 +1,124 @@ +package io.dataease.api.dataset.vo; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; +import lombok.Data; + +import java.io.Serializable; + +@Data +public class CoreDatasetTableFieldVO implements Serializable { + private static final long serialVersionUID = 1L; + + /** + * ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long id; + + /** + * 数据源ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long datasourceId; + + /** + * 数据表ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long datasetTableId; + + /** + * 数据集ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long datasetGroupId; + + /** + * 图表ID + */ + @JsonSerialize(using = ToStringSerializer.class) + private Long chartId; + + /** + * 原始字段名 + */ + private String originName; + + /** + * 字段名用于展示 + */ + private String name; + + /** + * 描述 + */ + private String description; + + /** + * de字段名用作唯一标识 + */ + private String dataeaseName; + + /** + * de字段别名 + */ + private String fieldShortName; + + /** + * 维度/指标标识 d:维度,q:指标 + */ + private String groupType; + + /** + * 原始字段类型 + */ + private String type; + + private Integer size; + + /** + * dataease字段类型:0-文本,1-时间,2-整型数值,3-浮点数值,4-布尔,5-地理位置,6-二进制 + */ + private Integer deType; + + /** + * de记录的原始类型 + */ + private Integer deExtractType; + + /** + * 是否扩展字段 0原始 1复制 2计算字段... + */ + private Integer extField; + + /** + * 是否选中 + */ + private Boolean checked; + + /** + * 列位置 + */ + private Integer columnIndex; + + /** + * 同步时间 + */ + private Long lastSyncTime; + + /** + * 精度 + */ + private Integer accuracy; + + private String dateFormat; + + /** + * 时间格式类型 + */ + private String dateFormatType; + + // 附加ID 兼容自定义参数ID + private String attachId; +} diff --git a/sdk/api/api-base/src/main/java/io/dataease/api/visualization/VisualizationOuterParamsApi.java b/sdk/api/api-base/src/main/java/io/dataease/api/visualization/VisualizationOuterParamsApi.java index 12cfaf8c0c..f16ea4e439 100644 --- a/sdk/api/api-base/src/main/java/io/dataease/api/visualization/VisualizationOuterParamsApi.java +++ b/sdk/api/api-base/src/main/java/io/dataease/api/visualization/VisualizationOuterParamsApi.java @@ -1,16 +1,19 @@ package io.dataease.api.visualization; +import io.dataease.api.dataset.vo.CoreDatasetGroupVO; import io.dataease.api.visualization.dto.VisualizationOuterParamsDTO; import io.dataease.api.visualization.response.VisualizationOuterParamsBaseResponse; import org.springframework.web.bind.annotation.*; +import java.util.List; + public interface VisualizationOuterParamsApi { @GetMapping("/queryWithVisualizationId/{dvId}") VisualizationOuterParamsDTO queryWithVisualizationId(@PathVariable("dvId") String dvId); - @GetMapping("/queryWithVisualizationId/{dvId}") + @GetMapping("/queryWithVisualizationIdDS/{dvId}") VisualizationOuterParamsDTO queryWithVisualizationIdDS(@PathVariable("dvId") String dvId); @PostMapping("/updateOuterParamsSet") @@ -18,4 +21,7 @@ public interface VisualizationOuterParamsApi { @GetMapping("/getOuterParamsInfo/{dvId}") VisualizationOuterParamsBaseResponse getOuterParamsInfo(@PathVariable("dvId") String dvId); + + @GetMapping("/queryDsWithVisualizationId/{dvId}") + List queryDsWithVisualizationId(@PathVariable("dvId") String dvId); }