forked from github/dataease
refactor(仪表板、数据大屏): 优化外部参数设置初始化数据集方式
This commit is contained in:
parent
bb55461fce
commit
993101e653
@ -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<VisualizationOuterParamsInfoDTO> getVisualizationOuterParamsInfo(@Param("visualizationId") String visualizationId);
|
||||
|
||||
List<CoreDatasetGroupVO> queryDsWithVisualizationId(@Param("visualizationId") String visualizationId);
|
||||
}
|
||||
|
@ -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<VisualizationOuterParamsInfoDTO> result = extOuterParamsMapper.getVisualizationOuterParamsInfo(visualizationId);
|
||||
return new VisualizationOuterParamsBaseResponse(Optional.ofNullable(result).orElse(new ArrayList<>()).stream().collect(Collectors.toMap(VisualizationOuterParamsInfoDTO::getSourceInfo, VisualizationOuterParamsInfoDTO::getTargetInfoList)));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CoreDatasetGroupVO> queryDsWithVisualizationId(String visualizationId) {
|
||||
return extOuterParamsMapper.queryDsWithVisualizationId(visualizationId);
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,13 @@
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="BaseDsResultMapDTO" type="io.dataease.api.dataset.vo.CoreDatasetGroupVO">
|
||||
<collection property="datasetFields" ofType="io.dataease.api.dataset.vo.CoreDatasetTableFieldVO"
|
||||
column="{dataset_group_id=id}"
|
||||
select="getDsFieldInfo">
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="OuterParamsInfoMap" type="io.dataease.api.visualization.dto.VisualizationOuterParamsInfoDTO" extends="BaseResultMapParamsInfo">
|
||||
<collection property="targetViewInfoList" ofType="io.dataease.visualization.dao.auto.entity.VisualizationOuterParamsTargetViewInfo">
|
||||
<result column="target_view_id" jdbcType="VARCHAR" property="targetViewId"/>
|
||||
@ -115,5 +122,23 @@
|
||||
and popi.checked=1
|
||||
</select>
|
||||
|
||||
<select id="queryDsWithVisualizationId" resultMap="BaseDsResultMapDTO">
|
||||
SELECT DISTINCT
|
||||
cdg.*
|
||||
FROM
|
||||
core_dataset_group cdg
|
||||
INNER JOIN core_chart_view ccv ON cdg.id = ccv.table_id
|
||||
INNER JOIN data_visualization_info dvi ON ccv.scene_id = dvi.id
|
||||
WHERE
|
||||
ccv.scene_id = #{visualizationId}
|
||||
AND dvi.id = #{visualizationId}
|
||||
AND FIND_IN_SET(
|
||||
ccv.id,
|
||||
dvi.component_data)
|
||||
</select>
|
||||
|
||||
<select id="getDsFieldInfo" resultType="io.dataease.api.dataset.vo.CoreDatasetTableFieldVO">
|
||||
select cdtf.*,cdtf.id as attachId from core_dataset_table_field cdtf where cdtf.dataset_group_id = #{dataset_group_id}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -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
|
||||
})
|
||||
}
|
||||
|
@ -13,7 +13,7 @@
|
||||
<el-row class="preview">
|
||||
<el-col :span="8" style="height: 100%; overflow-y: hidden">
|
||||
<el-row class="tree-head">
|
||||
<span class="head-text">参数列表DS</span>
|
||||
<span class="head-text">参数列表</span>
|
||||
<span class="head-filter">
|
||||
<el-button type="primary" icon="Plus" text @click="addOuterParamsInfo"> </el-button>
|
||||
</span>
|
||||
@ -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)
|
||||
}
|
||||
|
||||
|
@ -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<CoreDatasetTableFieldVO> datasetFields = new ArrayList<>();
|
||||
}
|
@ -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;
|
||||
}
|
@ -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<CoreDatasetGroupVO> queryDsWithVisualizationId(@PathVariable("dvId") String dvId);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user