mirror of
https://github.com/dataease/dataease.git
synced 2025-02-25 20:42:55 +08:00
Merge pull request #549 from dataease/pr@dev@feat_panel-linkage-set
feat:仪表板联动设置浮层
This commit is contained in:
commit
f87ac3cabc
@ -2,11 +2,15 @@ package io.dataease.base.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
@Data
|
||||
@Builder
|
||||
@AllArgsConstructor //全参构造函数
|
||||
@NoArgsConstructor //无参构造函数
|
||||
public class DatasetTableField implements Serializable {
|
||||
private String id;
|
||||
|
||||
@ -39,4 +43,4 @@ public class DatasetTableField implements Serializable {
|
||||
private Long lastSyncTime;
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
}
|
||||
}
|
||||
|
@ -9,9 +9,9 @@ public class PanelViewLinkageField implements Serializable {
|
||||
|
||||
private String linkageId;
|
||||
|
||||
private String sourceFiled;
|
||||
private String sourceField;
|
||||
|
||||
private String targetFiled;
|
||||
private String targetField;
|
||||
|
||||
private Long updateTime;
|
||||
|
||||
|
@ -244,143 +244,143 @@ public class PanelViewLinkageFieldExample {
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledIsNull() {
|
||||
addCriterion("source_filed is null");
|
||||
public Criteria andSourceFieldIsNull() {
|
||||
addCriterion("source_field is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledIsNotNull() {
|
||||
addCriterion("source_filed is not null");
|
||||
public Criteria andSourceFieldIsNotNull() {
|
||||
addCriterion("source_field is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledEqualTo(String value) {
|
||||
addCriterion("source_filed =", value, "sourceFiled");
|
||||
public Criteria andSourceFieldEqualTo(String value) {
|
||||
addCriterion("source_field =", value, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledNotEqualTo(String value) {
|
||||
addCriterion("source_filed <>", value, "sourceFiled");
|
||||
public Criteria andSourceFieldNotEqualTo(String value) {
|
||||
addCriterion("source_field <>", value, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledGreaterThan(String value) {
|
||||
addCriterion("source_filed >", value, "sourceFiled");
|
||||
public Criteria andSourceFieldGreaterThan(String value) {
|
||||
addCriterion("source_field >", value, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("source_filed >=", value, "sourceFiled");
|
||||
public Criteria andSourceFieldGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("source_field >=", value, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledLessThan(String value) {
|
||||
addCriterion("source_filed <", value, "sourceFiled");
|
||||
public Criteria andSourceFieldLessThan(String value) {
|
||||
addCriterion("source_field <", value, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledLessThanOrEqualTo(String value) {
|
||||
addCriterion("source_filed <=", value, "sourceFiled");
|
||||
public Criteria andSourceFieldLessThanOrEqualTo(String value) {
|
||||
addCriterion("source_field <=", value, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledLike(String value) {
|
||||
addCriterion("source_filed like", value, "sourceFiled");
|
||||
public Criteria andSourceFieldLike(String value) {
|
||||
addCriterion("source_field like", value, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledNotLike(String value) {
|
||||
addCriterion("source_filed not like", value, "sourceFiled");
|
||||
public Criteria andSourceFieldNotLike(String value) {
|
||||
addCriterion("source_field not like", value, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledIn(List<String> values) {
|
||||
addCriterion("source_filed in", values, "sourceFiled");
|
||||
public Criteria andSourceFieldIn(List<String> values) {
|
||||
addCriterion("source_field in", values, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledNotIn(List<String> values) {
|
||||
addCriterion("source_filed not in", values, "sourceFiled");
|
||||
public Criteria andSourceFieldNotIn(List<String> values) {
|
||||
addCriterion("source_field not in", values, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledBetween(String value1, String value2) {
|
||||
addCriterion("source_filed between", value1, value2, "sourceFiled");
|
||||
public Criteria andSourceFieldBetween(String value1, String value2) {
|
||||
addCriterion("source_field between", value1, value2, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andSourceFiledNotBetween(String value1, String value2) {
|
||||
addCriterion("source_filed not between", value1, value2, "sourceFiled");
|
||||
public Criteria andSourceFieldNotBetween(String value1, String value2) {
|
||||
addCriterion("source_field not between", value1, value2, "sourceField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledIsNull() {
|
||||
addCriterion("target_filed is null");
|
||||
public Criteria andTargetFieldIsNull() {
|
||||
addCriterion("target_field is null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledIsNotNull() {
|
||||
addCriterion("target_filed is not null");
|
||||
public Criteria andTargetFieldIsNotNull() {
|
||||
addCriterion("target_field is not null");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledEqualTo(String value) {
|
||||
addCriterion("target_filed =", value, "targetFiled");
|
||||
public Criteria andTargetFieldEqualTo(String value) {
|
||||
addCriterion("target_field =", value, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledNotEqualTo(String value) {
|
||||
addCriterion("target_filed <>", value, "targetFiled");
|
||||
public Criteria andTargetFieldNotEqualTo(String value) {
|
||||
addCriterion("target_field <>", value, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledGreaterThan(String value) {
|
||||
addCriterion("target_filed >", value, "targetFiled");
|
||||
public Criteria andTargetFieldGreaterThan(String value) {
|
||||
addCriterion("target_field >", value, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("target_filed >=", value, "targetFiled");
|
||||
public Criteria andTargetFieldGreaterThanOrEqualTo(String value) {
|
||||
addCriterion("target_field >=", value, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledLessThan(String value) {
|
||||
addCriterion("target_filed <", value, "targetFiled");
|
||||
public Criteria andTargetFieldLessThan(String value) {
|
||||
addCriterion("target_field <", value, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledLessThanOrEqualTo(String value) {
|
||||
addCriterion("target_filed <=", value, "targetFiled");
|
||||
public Criteria andTargetFieldLessThanOrEqualTo(String value) {
|
||||
addCriterion("target_field <=", value, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledLike(String value) {
|
||||
addCriterion("target_filed like", value, "targetFiled");
|
||||
public Criteria andTargetFieldLike(String value) {
|
||||
addCriterion("target_field like", value, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledNotLike(String value) {
|
||||
addCriterion("target_filed not like", value, "targetFiled");
|
||||
public Criteria andTargetFieldNotLike(String value) {
|
||||
addCriterion("target_field not like", value, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledIn(List<String> values) {
|
||||
addCriterion("target_filed in", values, "targetFiled");
|
||||
public Criteria andTargetFieldIn(List<String> values) {
|
||||
addCriterion("target_field in", values, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledNotIn(List<String> values) {
|
||||
addCriterion("target_filed not in", values, "targetFiled");
|
||||
public Criteria andTargetFieldNotIn(List<String> values) {
|
||||
addCriterion("target_field not in", values, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledBetween(String value1, String value2) {
|
||||
addCriterion("target_filed between", value1, value2, "targetFiled");
|
||||
public Criteria andTargetFieldBetween(String value1, String value2) {
|
||||
addCriterion("target_field between", value1, value2, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
public Criteria andTargetFiledNotBetween(String value1, String value2) {
|
||||
addCriterion("target_filed not between", value1, value2, "targetFiled");
|
||||
public Criteria andTargetFieldNotBetween(String value1, String value2) {
|
||||
addCriterion("target_field not between", value1, value2, "targetField");
|
||||
return (Criteria) this;
|
||||
}
|
||||
|
||||
|
@ -4,8 +4,8 @@
|
||||
<resultMap id="BaseResultMap" type="io.dataease.base.domain.PanelViewLinkageField">
|
||||
<id column="id" jdbcType="VARCHAR" property="id" />
|
||||
<result column="linkage_id" jdbcType="VARCHAR" property="linkageId" />
|
||||
<result column="source_filed" jdbcType="VARCHAR" property="sourceFiled" />
|
||||
<result column="target_filed" jdbcType="VARCHAR" property="targetFiled" />
|
||||
<result column="source_field" jdbcType="VARCHAR" property="sourceField" />
|
||||
<result column="target_field" jdbcType="VARCHAR" property="targetField" />
|
||||
<result column="update_time" jdbcType="BIGINT" property="updateTime" />
|
||||
</resultMap>
|
||||
<sql id="Example_Where_Clause">
|
||||
@ -67,7 +67,7 @@
|
||||
</where>
|
||||
</sql>
|
||||
<sql id="Base_Column_List">
|
||||
id, linkage_id, source_filed, target_filed, update_time
|
||||
id, linkage_id, source_field, target_field, update_time
|
||||
</sql>
|
||||
<select id="selectByExample" parameterType="io.dataease.base.domain.PanelViewLinkageFieldExample" resultMap="BaseResultMap">
|
||||
select
|
||||
@ -100,10 +100,10 @@
|
||||
</if>
|
||||
</delete>
|
||||
<insert id="insert" parameterType="io.dataease.base.domain.PanelViewLinkageField">
|
||||
insert into panel_view_linkage_field (id, linkage_id, source_filed,
|
||||
target_filed, update_time)
|
||||
values (#{id,jdbcType=VARCHAR}, #{linkageId,jdbcType=VARCHAR}, #{sourceFiled,jdbcType=VARCHAR},
|
||||
#{targetFiled,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT})
|
||||
insert into panel_view_linkage_field (id, linkage_id, source_field,
|
||||
target_field, update_time)
|
||||
values (#{id,jdbcType=VARCHAR}, #{linkageId,jdbcType=VARCHAR}, #{sourceField,jdbcType=VARCHAR},
|
||||
#{targetField,jdbcType=VARCHAR}, #{updateTime,jdbcType=BIGINT})
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelViewLinkageField">
|
||||
insert into panel_view_linkage_field
|
||||
@ -114,11 +114,11 @@
|
||||
<if test="linkageId != null">
|
||||
linkage_id,
|
||||
</if>
|
||||
<if test="sourceFiled != null">
|
||||
source_filed,
|
||||
<if test="sourceField != null">
|
||||
source_field,
|
||||
</if>
|
||||
<if test="targetFiled != null">
|
||||
target_filed,
|
||||
<if test="targetField != null">
|
||||
target_field,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
@ -131,11 +131,11 @@
|
||||
<if test="linkageId != null">
|
||||
#{linkageId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sourceFiled != null">
|
||||
#{sourceFiled,jdbcType=VARCHAR},
|
||||
<if test="sourceField != null">
|
||||
#{sourceField,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="targetFiled != null">
|
||||
#{targetFiled,jdbcType=VARCHAR},
|
||||
<if test="targetField != null">
|
||||
#{targetField,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime,jdbcType=BIGINT},
|
||||
@ -157,11 +157,11 @@
|
||||
<if test="record.linkageId != null">
|
||||
linkage_id = #{record.linkageId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.sourceFiled != null">
|
||||
source_filed = #{record.sourceFiled,jdbcType=VARCHAR},
|
||||
<if test="record.sourceField != null">
|
||||
source_field = #{record.sourceField,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.targetFiled != null">
|
||||
target_filed = #{record.targetFiled,jdbcType=VARCHAR},
|
||||
<if test="record.targetField != null">
|
||||
target_field = #{record.targetField,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="record.updateTime != null">
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT},
|
||||
@ -175,8 +175,8 @@
|
||||
update panel_view_linkage_field
|
||||
set id = #{record.id,jdbcType=VARCHAR},
|
||||
linkage_id = #{record.linkageId,jdbcType=VARCHAR},
|
||||
source_filed = #{record.sourceFiled,jdbcType=VARCHAR},
|
||||
target_filed = #{record.targetFiled,jdbcType=VARCHAR},
|
||||
source_field = #{record.sourceField,jdbcType=VARCHAR},
|
||||
target_field = #{record.targetField,jdbcType=VARCHAR},
|
||||
update_time = #{record.updateTime,jdbcType=BIGINT}
|
||||
<if test="_parameter != null">
|
||||
<include refid="Update_By_Example_Where_Clause" />
|
||||
@ -188,11 +188,11 @@
|
||||
<if test="linkageId != null">
|
||||
linkage_id = #{linkageId,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="sourceFiled != null">
|
||||
source_filed = #{sourceFiled,jdbcType=VARCHAR},
|
||||
<if test="sourceField != null">
|
||||
source_field = #{sourceField,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="targetFiled != null">
|
||||
target_filed = #{targetFiled,jdbcType=VARCHAR},
|
||||
<if test="targetField != null">
|
||||
target_field = #{targetField,jdbcType=VARCHAR},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime,jdbcType=BIGINT},
|
||||
@ -203,8 +203,8 @@
|
||||
<update id="updateByPrimaryKey" parameterType="io.dataease.base.domain.PanelViewLinkageField">
|
||||
update panel_view_linkage_field
|
||||
set linkage_id = #{linkageId,jdbcType=VARCHAR},
|
||||
source_filed = #{sourceFiled,jdbcType=VARCHAR},
|
||||
target_filed = #{targetFiled,jdbcType=VARCHAR},
|
||||
source_field = #{sourceField,jdbcType=VARCHAR},
|
||||
target_field = #{targetField,jdbcType=VARCHAR},
|
||||
update_time = #{updateTime,jdbcType=BIGINT}
|
||||
where id = #{id,jdbcType=VARCHAR}
|
||||
</update>
|
||||
|
@ -9,6 +9,11 @@ import java.util.List;
|
||||
public interface ExtPanelViewLinkageMapper {
|
||||
|
||||
List<PanelViewLinkageDTO> getViewLinkageGather(@Param("panelId") String panelId,@Param("sourceViewId") String sourceViewId,@Param("targetViewIds") List<String> targetViewIds);
|
||||
List<DatasetTableField> queryTableField(@Param("tableId") String tableId);
|
||||
|
||||
List<DatasetTableField> queryTableField(@Param("table_id") String tableId);
|
||||
|
||||
void deleteViewLinkage(@Param("panelId") String panelId,@Param("sourceViewId") String sourceViewId);
|
||||
|
||||
void deleteViewLinkageField(@Param("panelId") String panelId,@Param("sourceViewId") String sourceViewId);
|
||||
|
||||
}
|
||||
|
@ -3,7 +3,7 @@
|
||||
<mapper namespace="io.dataease.base.mapper.ext.ExtPanelViewLinkageMapper">
|
||||
|
||||
<resultMap id="TableFieldMap" type="io.dataease.base.domain.DatasetTableField">
|
||||
<id column="id" jdbcType="VARCHAR" property="id"/>
|
||||
<result column="id" jdbcType="VARCHAR" property="id"/>
|
||||
<result column="table_id" jdbcType="VARCHAR" property="tableId"/>
|
||||
<result column="origin_name" jdbcType="VARCHAR" property="originName"/>
|
||||
<result column="name" jdbcType="VARCHAR" property="name"/>
|
||||
@ -15,12 +15,12 @@
|
||||
<result column="table_id" jdbcType="VARCHAR" property="tableId"/>
|
||||
<result column="targetViewName" jdbcType="VARCHAR" property="targetViewName"/>
|
||||
<result column="linkageActive" property="linkageActive"/>
|
||||
<!-- <collection property="targetViewFields" ofType="io.dataease.base.domain.DatasetTableField" column="table_id"-->
|
||||
<!-- select="queryTableField">-->
|
||||
<!-- </collection>-->
|
||||
<collection property="linkageFields" ofType="io.dataease.dto.PanelViewLinkageFieldDTO">
|
||||
<result column="source_filed" jdbcType="VARCHAR" property="sourceFiled"/>
|
||||
<result column="target_filed" jdbcType="VARCHAR" property="targetFiled"/>
|
||||
<collection property="targetViewFields" ofType="io.dataease.base.domain.DatasetTableField" column="table_id"
|
||||
select="queryTableField">
|
||||
</collection>
|
||||
<collection property="linkageFields" ofType="io.dataease.base.domain.PanelViewLinkageField">
|
||||
<result column="source_field" jdbcType="VARCHAR" property="sourceField"/>
|
||||
<result column="target_field" jdbcType="VARCHAR" property="targetField"/>
|
||||
</collection>
|
||||
</resultMap>
|
||||
|
||||
@ -30,14 +30,14 @@
|
||||
chart_view.id as 'target_view_id',
|
||||
chart_view.table_id,
|
||||
(case when panel_view_linkage.target_view_id is null then 0 else 1 end) as 'linkageActive',
|
||||
panel_view_linkage_field.source_filed,
|
||||
panel_view_linkage_field.target_filed
|
||||
panel_view_linkage_field.source_field,
|
||||
panel_view_linkage_field.target_field
|
||||
FROM
|
||||
chart_view
|
||||
LEFT JOIN panel_view_linkage ON chart_view.id = panel_view_linkage.target_view_id
|
||||
LEFT JOIN panel_view_linkage_field ON panel_view_linkage.id = panel_view_linkage_field.linkage_id
|
||||
AND panel_view_linkage.panel_id = #{panelId}
|
||||
AND panel_view_linkage.source_view_id = #{sourceViewId}
|
||||
LEFT JOIN panel_view_linkage_field ON panel_view_linkage.id = panel_view_linkage_field.linkage_id
|
||||
where chart_view.id in
|
||||
<foreach collection="targetViewIds" item="targetViewId" index="index" open="(" close=")" separator=",">
|
||||
#{targetViewId}
|
||||
@ -49,9 +49,33 @@
|
||||
dataset_table_field.id,
|
||||
dataset_table_field.table_id,
|
||||
dataset_table_field.origin_name,
|
||||
dataset_table_field.name,
|
||||
dataset_table_field.`name`,
|
||||
dataset_table_field.de_type
|
||||
from dataset_table_field where table_id = #{tableId}
|
||||
from dataset_table_field where table_id = #{table_id}
|
||||
</select>
|
||||
|
||||
|
||||
<delete id="deleteViewLinkage">
|
||||
delete from panel_view_linkage where panel_view_linkage.panel_id = #{panelId}
|
||||
AND panel_view_linkage.source_view_id = #{sourceViewId}
|
||||
</delete>
|
||||
|
||||
|
||||
<delete id="deleteViewLinkageField">
|
||||
DELETE pvl
|
||||
FROM
|
||||
panel_view_linkage pvl,
|
||||
panel_view_linkage_field pvlf
|
||||
WHERE
|
||||
pvl.id = pvlf.linkage_id
|
||||
AND pvl.source_view_id = #{panelId}
|
||||
AND pvl.panel_id = #{panelId}
|
||||
</delete>
|
||||
|
||||
<insert id="savePluginMenu">
|
||||
INSERT INTO `panel_view_linkage` ( menu_id, title, pid, sub_count, permission, hidden,i_frame ) VALUES
|
||||
<foreach collection="menuList" item="menu" index="index" separator=",">
|
||||
(#{menu.menuId},#{menu.title},#{menu.pid},#{menu.subCount},#{menu.permission},#{menu.hidden},ifnull(#{menu.hidden},0))
|
||||
</foreach>
|
||||
</insert>
|
||||
</mapper>
|
||||
|
@ -2,6 +2,7 @@ package io.dataease.controller.panel;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
|
||||
import io.dataease.controller.request.panel.PanelLinkageRequest;
|
||||
import io.dataease.dto.PanelViewLinkageDTO;
|
||||
import io.dataease.service.panel.PanelViewLinkageService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@ -30,4 +31,13 @@ public class PanelViewLinkageController {
|
||||
return panelViewLinkageService.getViewLinkageGather(request);
|
||||
}
|
||||
|
||||
|
||||
@ApiOperation("获取仪表板视图联动信息")
|
||||
@PostMapping("/saveLinkage")
|
||||
public void saveLinkage(@RequestBody PanelLinkageRequest request){
|
||||
panelViewLinkageService.saveLinkage(request);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
package io.dataease.controller.request.panel;
|
||||
|
||||
import io.dataease.dto.PanelViewLinkageDTO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Author: wangjiahao
|
||||
@ -15,6 +18,16 @@ public class PanelLinkageRequest {
|
||||
|
||||
private List<String> targetViewIds;
|
||||
|
||||
private Map<String, PanelViewLinkageDTO> linkageInfo;
|
||||
|
||||
public Map<String, PanelViewLinkageDTO> getLinkageInfo() {
|
||||
return linkageInfo;
|
||||
}
|
||||
|
||||
public void setLinkageInfo(Map<String, PanelViewLinkageDTO> linkageInfo) {
|
||||
this.linkageInfo = linkageInfo;
|
||||
}
|
||||
|
||||
public String getPanelId() {
|
||||
return panelId;
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package io.dataease.dto;
|
||||
|
||||
import io.dataease.base.domain.DatasetTableField;
|
||||
import io.dataease.base.domain.PanelViewLinkage;
|
||||
import io.dataease.base.domain.PanelViewLinkageField;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@ -19,7 +20,7 @@ public class PanelViewLinkageDTO extends PanelViewLinkage {
|
||||
//关联状态
|
||||
private boolean linkageActive = false;
|
||||
|
||||
private List<PanelViewLinkageFieldDTO> linkageFields = new ArrayList<>();
|
||||
private List<PanelViewLinkageField> linkageFields = new ArrayList<>();
|
||||
|
||||
|
||||
private List<DatasetTableField> targetViewFields = new ArrayList<>();
|
||||
@ -68,11 +69,11 @@ public class PanelViewLinkageDTO extends PanelViewLinkage {
|
||||
this.linkageActive = linkageActive;
|
||||
}
|
||||
|
||||
public List<PanelViewLinkageFieldDTO> getLinkageFields() {
|
||||
public List<PanelViewLinkageField> getLinkageFields() {
|
||||
return linkageFields;
|
||||
}
|
||||
|
||||
public void setLinkageFields(List<PanelViewLinkageFieldDTO> linkageFields) {
|
||||
public void setLinkageFields(List<PanelViewLinkageField> linkageFields) {
|
||||
this.linkageFields = linkageFields;
|
||||
}
|
||||
}
|
||||
|
@ -1,11 +1,19 @@
|
||||
package io.dataease.service.panel;
|
||||
|
||||
import io.dataease.base.domain.PanelViewLinkage;
|
||||
import io.dataease.base.domain.PanelViewLinkageExample;
|
||||
import io.dataease.base.domain.PanelViewLinkageField;
|
||||
import io.dataease.base.mapper.PanelViewLinkageFieldMapper;
|
||||
import io.dataease.base.mapper.PanelViewLinkageMapper;
|
||||
import io.dataease.base.mapper.ext.ExtPanelViewLinkageMapper;
|
||||
import io.dataease.commons.utils.AuthUtils;
|
||||
import io.dataease.controller.request.panel.PanelLinkageRequest;
|
||||
import io.dataease.dto.PanelViewLinkageDTO;
|
||||
import io.dataease.dto.PanelViewLinkageFieldDTO;
|
||||
import org.apache.commons.collections4.CollectionUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.*;
|
||||
@ -22,6 +30,9 @@ public class PanelViewLinkageService {
|
||||
@Resource
|
||||
private PanelViewLinkageMapper panelViewLinkageMapper;
|
||||
|
||||
@Resource
|
||||
private PanelViewLinkageFieldMapper panelViewLinkageFieldMapper;
|
||||
|
||||
@Resource
|
||||
private ExtPanelViewLinkageMapper extPanelViewLinkageMapper;
|
||||
|
||||
@ -29,9 +40,6 @@ public class PanelViewLinkageService {
|
||||
public Map<String, PanelViewLinkageDTO> getViewLinkageGather(PanelLinkageRequest request) {
|
||||
if(CollectionUtils.isNotEmpty(request.getTargetViewIds())){
|
||||
List<PanelViewLinkageDTO> linkageDTOList = extPanelViewLinkageMapper.getViewLinkageGather(request.getPanelId(),request.getSourceViewId(),request.getTargetViewIds());
|
||||
linkageDTOList.stream().forEach(linkage ->{
|
||||
linkage.setTargetViewFields(extPanelViewLinkageMapper.queryTableField(linkage.getTableId()));
|
||||
});
|
||||
Map<String, PanelViewLinkageDTO> result = linkageDTOList.stream()
|
||||
.collect(Collectors.toMap(PanelViewLinkageDTO::getTargetViewId,PanelViewLinkageDTO->PanelViewLinkageDTO));
|
||||
return result;
|
||||
@ -39,5 +47,61 @@ public class PanelViewLinkageService {
|
||||
return new HashMap<>();
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void saveLinkage(PanelLinkageRequest request){
|
||||
Long updateTime = System.currentTimeMillis();
|
||||
Map<String, PanelViewLinkageDTO> linkageInfo = request.getLinkageInfo();
|
||||
String sourceViewId = request.getSourceViewId();
|
||||
String panelId = request.getPanelId();
|
||||
|
||||
Assert.notNull(sourceViewId,"source View ID can not be null");
|
||||
Assert.notNull(panelId,"panelId can not be null");
|
||||
|
||||
//去掉source view 的信息
|
||||
linkageInfo.remove(sourceViewId);
|
||||
|
||||
// 清理原有关系
|
||||
extPanelViewLinkageMapper.deleteViewLinkageField(panelId,sourceViewId);
|
||||
extPanelViewLinkageMapper.deleteViewLinkage(panelId,sourceViewId);
|
||||
|
||||
//重新建立关系
|
||||
for(Map.Entry<String, PanelViewLinkageDTO> entry : linkageInfo.entrySet()){
|
||||
String targetViewId = entry.getKey();
|
||||
PanelViewLinkageDTO linkageDTO = entry.getValue();
|
||||
List<PanelViewLinkageField> linkageFields = linkageDTO.getLinkageFields();
|
||||
|
||||
if(CollectionUtils.isNotEmpty(linkageFields)&&linkageDTO.isLinkageActive()){
|
||||
String linkageId = UUID.randomUUID().toString();
|
||||
PanelViewLinkage linkage = new PanelViewLinkage();
|
||||
linkage.setId(linkageId);
|
||||
linkage.setPanelId(panelId);
|
||||
linkage.setSourceViewId(sourceViewId);
|
||||
linkage.setTargetViewId(targetViewId);
|
||||
linkage.setUpdatePeople(AuthUtils.getUser().getUsername());
|
||||
linkage.setUpdateTime(updateTime);
|
||||
panelViewLinkageMapper.insert(linkage);
|
||||
|
||||
linkageFields.stream().forEach(linkageField->{
|
||||
linkageField.setId(UUID.randomUUID().toString());
|
||||
linkageField.setLinkageId(linkageId);
|
||||
linkageField.setUpdateTime(updateTime);
|
||||
panelViewLinkageFieldMapper.insert(linkageField);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -0,0 +1,33 @@
|
||||
SET NAMES utf8mb4;
|
||||
SET FOREIGN_KEY_CHECKS = 0;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for panel_view_linkage
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `panel_view_linkage`;
|
||||
CREATE TABLE `panel_view_linkage` (
|
||||
`id` varchar(50) NOT NULL,
|
||||
`panel_id` varchar(50) DEFAULT NULL,
|
||||
`source_view_id` varchar(50) DEFAULT NULL COMMENT '源视图id',
|
||||
`target_view_id` varchar(50) DEFAULT NULL COMMENT '联动视图id',
|
||||
`update_time` bigint(13) DEFAULT NULL COMMENT '更新时间',
|
||||
`update_people` varchar(255) DEFAULT NULL COMMENT '更新人',
|
||||
`ext1` varchar(2000) DEFAULT NULL,
|
||||
`ext2` varchar(2000) DEFAULT NULL,
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
-- ----------------------------
|
||||
-- Table structure for panel_view_linkage_field
|
||||
-- ----------------------------
|
||||
DROP TABLE IF EXISTS `panel_view_linkage_field`;
|
||||
CREATE TABLE `panel_view_linkage_field` (
|
||||
`id` varchar(50) NOT NULL,
|
||||
`linkage_id` varchar(50) DEFAULT NULL COMMENT '联动ID',
|
||||
`source_field` varchar(255) DEFAULT NULL COMMENT '源视图字段',
|
||||
`target_field` varchar(255) DEFAULT NULL COMMENT '目标视图字段',
|
||||
`update_time` bigint(13) DEFAULT NULL COMMENT '更新时间',
|
||||
PRIMARY KEY (`id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8;
|
||||
|
||||
SET FOREIGN_KEY_CHECKS = 1;
|
@ -9,3 +9,12 @@ export function getViewLinkageGather(requestInfo) {
|
||||
})
|
||||
}
|
||||
|
||||
export function saveLinkage(requestInfo) {
|
||||
return request({
|
||||
url: '/linkage/saveLinkage',
|
||||
method: 'post',
|
||||
data: requestInfo,
|
||||
loading: true
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -1,22 +1,68 @@
|
||||
<template>
|
||||
|
||||
<el-popover
|
||||
width="300"
|
||||
width="400"
|
||||
trigger="click"
|
||||
>
|
||||
<el-row>
|
||||
<el-col :span="10">
|
||||
<div class="ellip">联动视图</div>
|
||||
<el-col :span="11">
|
||||
<div class="ellip">{{ sourceLinkageInfo.targetViewName }}</div>
|
||||
</el-col>
|
||||
<el-col :span="10">
|
||||
<el-col :span="11">
|
||||
<div class="ellip">{{ linkageInfo.targetViewName }}</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
linkageInfo{{ linkageInfo }}
|
||||
<el-row v-for="(item, index) in linkageInfo.linkageFields" :key="index">
|
||||
<el-col :span="11">
|
||||
<div class="select-filed">
|
||||
<el-select v-model="item.sourceField" size="mini" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in sourceLinkageInfo.targetViewFields"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
<span style="float: left">
|
||||
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
|
||||
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
|
||||
<svg-icon v-if="item.deType === 2 || item.value === 3" icon-class="field_value" class="field-icon-value" />
|
||||
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
|
||||
</span>
|
||||
<span style="float: left; color: #8492a6; font-size: 12px">{{ item.name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="11">
|
||||
<div class="select-filed">
|
||||
<el-select v-model="item.targetField" size="mini" placeholder="请选择">
|
||||
<el-option
|
||||
v-for="item in linkageInfo.targetViewFields"
|
||||
:key="item.id"
|
||||
:label="item.name"
|
||||
:value="item.id"
|
||||
>
|
||||
<span style="float: left">
|
||||
<svg-icon v-if="item.deType === 0" icon-class="field_text" class="field-icon-text" />
|
||||
<svg-icon v-if="item.deType === 1" icon-class="field_time" class="field-icon-time" />
|
||||
<svg-icon v-if="item.deType === 2 || item.value === 3" icon-class="field_value" class="field-icon-value" />
|
||||
<svg-icon v-if="item.deType === 5" icon-class="field_location" class="field-icon-location" />
|
||||
</span>
|
||||
<span style="float: left; color: #8492a6; font-size: 12px">{{ item.name }}</span>
|
||||
</el-option>
|
||||
</el-select>
|
||||
</div>
|
||||
</el-col>
|
||||
<el-col :span="2">
|
||||
<div>
|
||||
<el-button icon="el-icon-delete" type="text" size="small" style="float: left" @click="deleteLinkageField(index)" />
|
||||
</div>
|
||||
</el-col>
|
||||
</el-row>
|
||||
|
||||
<el-row class="bottom">
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" round>追加联动依赖字段</el-button>
|
||||
<el-button size="mini" type="success" icon="el-icon-plus" round @click="addLinkageField">追加联动依赖字段</el-button>
|
||||
</el-row>
|
||||
|
||||
<!-- <el-button slot="reference">T</el-button>-->
|
||||
@ -60,6 +106,9 @@ export default {
|
||||
linkageInfo() {
|
||||
return this.targetLinkageInfo[this.element.propValue.viewId]
|
||||
},
|
||||
sourceLinkageInfo() {
|
||||
return this.targetLinkageInfo[this.curLinkageView.propValue.viewId]
|
||||
},
|
||||
...mapState([
|
||||
'menuTop',
|
||||
'menuLeft',
|
||||
@ -81,6 +130,16 @@ export default {
|
||||
},
|
||||
linkageEdit() {
|
||||
|
||||
},
|
||||
deleteLinkageField(index) {
|
||||
this.linkageInfo.linkageFields.splice(index, 1)
|
||||
},
|
||||
addLinkageField() {
|
||||
const linkageFieldItem = {
|
||||
sourceViewId: null,
|
||||
targetViewId: null
|
||||
}
|
||||
this.linkageInfo.linkageFields.push(linkageFieldItem)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -92,6 +151,7 @@ export default {
|
||||
}
|
||||
|
||||
.bottom {
|
||||
margin-top: 20px;
|
||||
text-align: center;
|
||||
|
||||
}
|
||||
@ -110,4 +170,18 @@ export default {
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.select-filed{
|
||||
/*width: 100%;*/
|
||||
margin-left: 10px;
|
||||
margin-right: 10px;
|
||||
overflow: hidden;/*超出部分隐藏*/
|
||||
white-space: nowrap;/*不换行*/
|
||||
text-overflow:ellipsis;/*超出部分文字以...显示*/
|
||||
color: #3d4d66;
|
||||
font-size: 12px;
|
||||
line-height: 35px;
|
||||
height: 35px;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
@ -124,7 +124,8 @@ export default {
|
||||
},
|
||||
linkageSetting() {
|
||||
debugger
|
||||
const targetViewIds = this.componentData.filter(item => item.type === 'view' && item.propValue && item.propValue.viewId && item !== this.curComponent)
|
||||
// sourceViewId 也加入查询
|
||||
const targetViewIds = this.componentData.filter(item => item.type === 'view' && item.propValue && item.propValue.viewId)
|
||||
.map(item => item.propValue.viewId)
|
||||
|
||||
// 获取当前仪表板当前视图联动信息
|
||||
|
@ -101,6 +101,7 @@ import { commonStyle, commonAttr } from '@/components/canvas/custom-component/co
|
||||
import eventBus from '@/components/canvas/utils/eventBus'
|
||||
import { deepCopy } from '@/components/canvas/utils/utils'
|
||||
import { panelSave } from '@/api/panel/panel'
|
||||
import { saveLinkage } from '@/api/panel/linkage'
|
||||
import bus from '@/utils/bus'
|
||||
import {
|
||||
DEFAULT_COMMON_CANVAS_STYLE_STRING
|
||||
@ -137,7 +138,9 @@ export default {
|
||||
'changeTimes',
|
||||
'snapshotIndex',
|
||||
'lastSaveSnapshotIndex',
|
||||
'linkageSettingStatus'
|
||||
'linkageSettingStatus',
|
||||
'curLinkageView',
|
||||
'targetLinkageInfo'
|
||||
]),
|
||||
|
||||
created() {
|
||||
@ -316,7 +319,14 @@ export default {
|
||||
this.close()
|
||||
},
|
||||
saveLinkage() {
|
||||
this.cancelLinkageSettingStatus()
|
||||
const request = {
|
||||
panelId: this.$store.state.panel.panelInfo.id,
|
||||
sourceViewId: this.curLinkageView.propValue.viewId,
|
||||
linkageInfo: this.targetLinkageInfo
|
||||
}
|
||||
saveLinkage(request).then(rsp => {
|
||||
this.cancelLinkageSettingStatus()
|
||||
})
|
||||
},
|
||||
cancelLinkage() {
|
||||
this.cancelLinkageSettingStatus()
|
||||
|
Loading…
Reference in New Issue
Block a user