From ac938c281bbe8eccd5c21c2ede9e755d4e0cdfae Mon Sep 17 00:00:00 2001 From: junjie Date: Fri, 7 May 2021 14:51:40 +0800 Subject: [PATCH] =?UTF-8?q?feat(=E6=95=B0=E6=8D=AE=E9=9B=86):=E8=8D=89?= =?UTF-8?q?=E7=A8=BF=EF=BC=8C=E6=95=B0=E6=8D=AE=E9=9B=86=20=E5=85=B3?= =?UTF-8?q?=E8=81=94=E8=A7=86=E5=9B=BE=20=E5=8A=9F=E8=83=BD=E3=80=82?= =?UTF-8?q?=E8=87=AA=E5=8A=A9=E6=95=B0=E6=8D=AE=E9=9B=86=E9=9C=80=E8=A6=81?= =?UTF-8?q?=E5=85=B3=E8=81=94=E8=A7=86=E5=9B=BE=E5=81=9A=E6=94=AF=E6=92=91?= =?UTF-8?q?=EF=BC=8C=E5=85=88=E7=AE=80=E5=8D=95=E5=81=9A=E4=B8=AA=20?= =?UTF-8?q?=E6=95=B0=E6=8D=AE=E9=9B=86=20=E5=85=B3=E8=81=94=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=20=E7=9A=84=E5=8A=9F=E8=83=BD=EF=BC=8C=E5=90=8E?= =?UTF-8?q?=E8=BE=B9=E5=86=8D=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/domain/DatasetTableUnion.java | 27 + .../base/domain/DatasetTableUnionExample.java | 820 ++++++++++++++++++ .../base/mapper/DatasetTableUnionMapper.java | 30 + .../base/mapper/DatasetTableUnionMapper.xml | 276 ++++++ .../ext/ExtDatasetTableUnionMapper.java | 11 + .../mapper/ext/ExtDatasetTableUnionMapper.xml | 42 + .../dataset/DataSetTableUnionController.java | 35 + .../dto/dataset/DataSetTableUnionDTO.java | 18 + .../dataset/DataSetTableUnionService.java | 74 ++ .../db/migration/V15__dataset_union.sql | 15 + frontend/src/lang/zh.js | 12 +- .../dataset/common/DatasetGroupSelector.vue | 1 + frontend/src/views/dataset/data/UnionView.vue | 273 ++++++ frontend/src/views/dataset/data/ViewTable.vue | 5 +- 14 files changed, 1636 insertions(+), 3 deletions(-) create mode 100644 backend/src/main/java/io/dataease/base/domain/DatasetTableUnion.java create mode 100644 backend/src/main/java/io/dataease/base/domain/DatasetTableUnionExample.java create mode 100644 backend/src/main/java/io/dataease/base/mapper/DatasetTableUnionMapper.java create mode 100644 backend/src/main/java/io/dataease/base/mapper/DatasetTableUnionMapper.xml create mode 100644 backend/src/main/java/io/dataease/base/mapper/ext/ExtDatasetTableUnionMapper.java create mode 100644 backend/src/main/java/io/dataease/base/mapper/ext/ExtDatasetTableUnionMapper.xml create mode 100644 backend/src/main/java/io/dataease/controller/dataset/DataSetTableUnionController.java create mode 100644 backend/src/main/java/io/dataease/dto/dataset/DataSetTableUnionDTO.java create mode 100644 backend/src/main/java/io/dataease/service/dataset/DataSetTableUnionService.java create mode 100644 backend/src/main/resources/db/migration/V15__dataset_union.sql create mode 100644 frontend/src/views/dataset/data/UnionView.vue diff --git a/backend/src/main/java/io/dataease/base/domain/DatasetTableUnion.java b/backend/src/main/java/io/dataease/base/domain/DatasetTableUnion.java new file mode 100644 index 0000000000..18b7dda831 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/domain/DatasetTableUnion.java @@ -0,0 +1,27 @@ +package io.dataease.base.domain; + +import java.io.Serializable; +import lombok.Data; + +@Data +public class DatasetTableUnion implements Serializable { + private String id; + + private String sourceTableId; + + private String sourceTableFieldId; + + private String sourceUnionRelation; + + private String targetTableId; + + private String targetTableFieldId; + + private String targetUnionRelation; + + private String createBy; + + private Long createTime; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/domain/DatasetTableUnionExample.java b/backend/src/main/java/io/dataease/base/domain/DatasetTableUnionExample.java new file mode 100644 index 0000000000..b6292e348e --- /dev/null +++ b/backend/src/main/java/io/dataease/base/domain/DatasetTableUnionExample.java @@ -0,0 +1,820 @@ +package io.dataease.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class DatasetTableUnionExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public DatasetTableUnionExample() { + oredCriteria = new ArrayList(); + } + + public void setOrderByClause(String orderByClause) { + this.orderByClause = orderByClause; + } + + public String getOrderByClause() { + return orderByClause; + } + + public void setDistinct(boolean distinct) { + this.distinct = distinct; + } + + public boolean isDistinct() { + return distinct; + } + + public List getOredCriteria() { + return oredCriteria; + } + + public void or(Criteria criteria) { + oredCriteria.add(criteria); + } + + public Criteria or() { + Criteria criteria = createCriteriaInternal(); + oredCriteria.add(criteria); + return criteria; + } + + public Criteria createCriteria() { + Criteria criteria = createCriteriaInternal(); + if (oredCriteria.size() == 0) { + oredCriteria.add(criteria); + } + return criteria; + } + + protected Criteria createCriteriaInternal() { + Criteria criteria = new Criteria(); + return criteria; + } + + public void clear() { + oredCriteria.clear(); + orderByClause = null; + distinct = false; + } + + protected abstract static class GeneratedCriteria { + protected List criteria; + + protected GeneratedCriteria() { + super(); + criteria = new ArrayList(); + } + + public boolean isValid() { + return criteria.size() > 0; + } + + public List getAllCriteria() { + return criteria; + } + + public List getCriteria() { + return criteria; + } + + protected void addCriterion(String condition) { + if (condition == null) { + throw new RuntimeException("Value for condition cannot be null"); + } + criteria.add(new Criterion(condition)); + } + + protected void addCriterion(String condition, Object value, String property) { + if (value == null) { + throw new RuntimeException("Value for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value)); + } + + protected void addCriterion(String condition, Object value1, Object value2, String property) { + if (value1 == null || value2 == null) { + throw new RuntimeException("Between values for " + property + " cannot be null"); + } + criteria.add(new Criterion(condition, value1, value2)); + } + + public Criteria andIdIsNull() { + addCriterion("id is null"); + return (Criteria) this; + } + + public Criteria andIdIsNotNull() { + addCriterion("id is not null"); + return (Criteria) this; + } + + public Criteria andIdEqualTo(String value) { + addCriterion("id =", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotEqualTo(String value) { + addCriterion("id <>", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThan(String value) { + addCriterion("id >", value, "id"); + return (Criteria) this; + } + + public Criteria andIdGreaterThanOrEqualTo(String value) { + addCriterion("id >=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThan(String value) { + addCriterion("id <", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLessThanOrEqualTo(String value) { + addCriterion("id <=", value, "id"); + return (Criteria) this; + } + + public Criteria andIdLike(String value) { + addCriterion("id like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdNotLike(String value) { + addCriterion("id not like", value, "id"); + return (Criteria) this; + } + + public Criteria andIdIn(List values) { + addCriterion("id in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdNotIn(List values) { + addCriterion("id not in", values, "id"); + return (Criteria) this; + } + + public Criteria andIdBetween(String value1, String value2) { + addCriterion("id between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andIdNotBetween(String value1, String value2) { + addCriterion("id not between", value1, value2, "id"); + return (Criteria) this; + } + + public Criteria andSourceTableIdIsNull() { + addCriterion("source_table_id is null"); + return (Criteria) this; + } + + public Criteria andSourceTableIdIsNotNull() { + addCriterion("source_table_id is not null"); + return (Criteria) this; + } + + public Criteria andSourceTableIdEqualTo(String value) { + addCriterion("source_table_id =", value, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdNotEqualTo(String value) { + addCriterion("source_table_id <>", value, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdGreaterThan(String value) { + addCriterion("source_table_id >", value, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdGreaterThanOrEqualTo(String value) { + addCriterion("source_table_id >=", value, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdLessThan(String value) { + addCriterion("source_table_id <", value, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdLessThanOrEqualTo(String value) { + addCriterion("source_table_id <=", value, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdLike(String value) { + addCriterion("source_table_id like", value, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdNotLike(String value) { + addCriterion("source_table_id not like", value, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdIn(List values) { + addCriterion("source_table_id in", values, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdNotIn(List values) { + addCriterion("source_table_id not in", values, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdBetween(String value1, String value2) { + addCriterion("source_table_id between", value1, value2, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableIdNotBetween(String value1, String value2) { + addCriterion("source_table_id not between", value1, value2, "sourceTableId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdIsNull() { + addCriterion("source_table_field_id is null"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdIsNotNull() { + addCriterion("source_table_field_id is not null"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdEqualTo(String value) { + addCriterion("source_table_field_id =", value, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdNotEqualTo(String value) { + addCriterion("source_table_field_id <>", value, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdGreaterThan(String value) { + addCriterion("source_table_field_id >", value, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdGreaterThanOrEqualTo(String value) { + addCriterion("source_table_field_id >=", value, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdLessThan(String value) { + addCriterion("source_table_field_id <", value, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdLessThanOrEqualTo(String value) { + addCriterion("source_table_field_id <=", value, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdLike(String value) { + addCriterion("source_table_field_id like", value, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdNotLike(String value) { + addCriterion("source_table_field_id not like", value, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdIn(List values) { + addCriterion("source_table_field_id in", values, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdNotIn(List values) { + addCriterion("source_table_field_id not in", values, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdBetween(String value1, String value2) { + addCriterion("source_table_field_id between", value1, value2, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceTableFieldIdNotBetween(String value1, String value2) { + addCriterion("source_table_field_id not between", value1, value2, "sourceTableFieldId"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationIsNull() { + addCriterion("source_union_relation is null"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationIsNotNull() { + addCriterion("source_union_relation is not null"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationEqualTo(String value) { + addCriterion("source_union_relation =", value, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationNotEqualTo(String value) { + addCriterion("source_union_relation <>", value, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationGreaterThan(String value) { + addCriterion("source_union_relation >", value, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationGreaterThanOrEqualTo(String value) { + addCriterion("source_union_relation >=", value, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationLessThan(String value) { + addCriterion("source_union_relation <", value, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationLessThanOrEqualTo(String value) { + addCriterion("source_union_relation <=", value, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationLike(String value) { + addCriterion("source_union_relation like", value, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationNotLike(String value) { + addCriterion("source_union_relation not like", value, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationIn(List values) { + addCriterion("source_union_relation in", values, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationNotIn(List values) { + addCriterion("source_union_relation not in", values, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationBetween(String value1, String value2) { + addCriterion("source_union_relation between", value1, value2, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andSourceUnionRelationNotBetween(String value1, String value2) { + addCriterion("source_union_relation not between", value1, value2, "sourceUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetTableIdIsNull() { + addCriterion("target_table_id is null"); + return (Criteria) this; + } + + public Criteria andTargetTableIdIsNotNull() { + addCriterion("target_table_id is not null"); + return (Criteria) this; + } + + public Criteria andTargetTableIdEqualTo(String value) { + addCriterion("target_table_id =", value, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdNotEqualTo(String value) { + addCriterion("target_table_id <>", value, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdGreaterThan(String value) { + addCriterion("target_table_id >", value, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdGreaterThanOrEqualTo(String value) { + addCriterion("target_table_id >=", value, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdLessThan(String value) { + addCriterion("target_table_id <", value, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdLessThanOrEqualTo(String value) { + addCriterion("target_table_id <=", value, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdLike(String value) { + addCriterion("target_table_id like", value, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdNotLike(String value) { + addCriterion("target_table_id not like", value, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdIn(List values) { + addCriterion("target_table_id in", values, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdNotIn(List values) { + addCriterion("target_table_id not in", values, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdBetween(String value1, String value2) { + addCriterion("target_table_id between", value1, value2, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableIdNotBetween(String value1, String value2) { + addCriterion("target_table_id not between", value1, value2, "targetTableId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdIsNull() { + addCriterion("target_table_field_id is null"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdIsNotNull() { + addCriterion("target_table_field_id is not null"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdEqualTo(String value) { + addCriterion("target_table_field_id =", value, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdNotEqualTo(String value) { + addCriterion("target_table_field_id <>", value, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdGreaterThan(String value) { + addCriterion("target_table_field_id >", value, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdGreaterThanOrEqualTo(String value) { + addCriterion("target_table_field_id >=", value, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdLessThan(String value) { + addCriterion("target_table_field_id <", value, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdLessThanOrEqualTo(String value) { + addCriterion("target_table_field_id <=", value, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdLike(String value) { + addCriterion("target_table_field_id like", value, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdNotLike(String value) { + addCriterion("target_table_field_id not like", value, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdIn(List values) { + addCriterion("target_table_field_id in", values, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdNotIn(List values) { + addCriterion("target_table_field_id not in", values, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdBetween(String value1, String value2) { + addCriterion("target_table_field_id between", value1, value2, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetTableFieldIdNotBetween(String value1, String value2) { + addCriterion("target_table_field_id not between", value1, value2, "targetTableFieldId"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationIsNull() { + addCriterion("target_union_relation is null"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationIsNotNull() { + addCriterion("target_union_relation is not null"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationEqualTo(String value) { + addCriterion("target_union_relation =", value, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationNotEqualTo(String value) { + addCriterion("target_union_relation <>", value, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationGreaterThan(String value) { + addCriterion("target_union_relation >", value, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationGreaterThanOrEqualTo(String value) { + addCriterion("target_union_relation >=", value, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationLessThan(String value) { + addCriterion("target_union_relation <", value, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationLessThanOrEqualTo(String value) { + addCriterion("target_union_relation <=", value, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationLike(String value) { + addCriterion("target_union_relation like", value, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationNotLike(String value) { + addCriterion("target_union_relation not like", value, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationIn(List values) { + addCriterion("target_union_relation in", values, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationNotIn(List values) { + addCriterion("target_union_relation not in", values, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationBetween(String value1, String value2) { + addCriterion("target_union_relation between", value1, value2, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andTargetUnionRelationNotBetween(String value1, String value2) { + addCriterion("target_union_relation not between", value1, value2, "targetUnionRelation"); + return (Criteria) this; + } + + public Criteria andCreateByIsNull() { + addCriterion("create_by is null"); + return (Criteria) this; + } + + public Criteria andCreateByIsNotNull() { + addCriterion("create_by is not null"); + return (Criteria) this; + } + + public Criteria andCreateByEqualTo(String value) { + addCriterion("create_by =", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotEqualTo(String value) { + addCriterion("create_by <>", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThan(String value) { + addCriterion("create_by >", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByGreaterThanOrEqualTo(String value) { + addCriterion("create_by >=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThan(String value) { + addCriterion("create_by <", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLessThanOrEqualTo(String value) { + addCriterion("create_by <=", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByLike(String value) { + addCriterion("create_by like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotLike(String value) { + addCriterion("create_by not like", value, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByIn(List values) { + addCriterion("create_by in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotIn(List values) { + addCriterion("create_by not in", values, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByBetween(String value1, String value2) { + addCriterion("create_by between", value1, value2, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateByNotBetween(String value1, String value2) { + addCriterion("create_by not between", value1, value2, "createBy"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNull() { + addCriterion("create_time is null"); + return (Criteria) this; + } + + public Criteria andCreateTimeIsNotNull() { + addCriterion("create_time is not null"); + return (Criteria) this; + } + + public Criteria andCreateTimeEqualTo(Long value) { + addCriterion("create_time =", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotEqualTo(Long value) { + addCriterion("create_time <>", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThan(Long value) { + addCriterion("create_time >", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("create_time >=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThan(Long value) { + addCriterion("create_time <", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeLessThanOrEqualTo(Long value) { + addCriterion("create_time <=", value, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeIn(List values) { + addCriterion("create_time in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotIn(List values) { + addCriterion("create_time not in", values, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeBetween(Long value1, Long value2) { + addCriterion("create_time between", value1, value2, "createTime"); + return (Criteria) this; + } + + public Criteria andCreateTimeNotBetween(Long value1, Long value2) { + addCriterion("create_time not between", value1, value2, "createTime"); + return (Criteria) this; + } + } + + public static class Criteria extends GeneratedCriteria { + + protected Criteria() { + super(); + } + } + + public static class Criterion { + private String condition; + + private Object value; + + private Object secondValue; + + private boolean noValue; + + private boolean singleValue; + + private boolean betweenValue; + + private boolean listValue; + + private String typeHandler; + + public String getCondition() { + return condition; + } + + public Object getValue() { + return value; + } + + public Object getSecondValue() { + return secondValue; + } + + public boolean isNoValue() { + return noValue; + } + + public boolean isSingleValue() { + return singleValue; + } + + public boolean isBetweenValue() { + return betweenValue; + } + + public boolean isListValue() { + return listValue; + } + + public String getTypeHandler() { + return typeHandler; + } + + protected Criterion(String condition) { + super(); + this.condition = condition; + this.typeHandler = null; + this.noValue = true; + } + + protected Criterion(String condition, Object value, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.typeHandler = typeHandler; + if (value instanceof List) { + this.listValue = true; + } else { + this.singleValue = true; + } + } + + protected Criterion(String condition, Object value) { + this(condition, value, null); + } + + protected Criterion(String condition, Object value, Object secondValue, String typeHandler) { + super(); + this.condition = condition; + this.value = value; + this.secondValue = secondValue; + this.typeHandler = typeHandler; + this.betweenValue = true; + } + + protected Criterion(String condition, Object value, Object secondValue) { + this(condition, value, secondValue, null); + } + } +} \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/mapper/DatasetTableUnionMapper.java b/backend/src/main/java/io/dataease/base/mapper/DatasetTableUnionMapper.java new file mode 100644 index 0000000000..5a8a153a71 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/DatasetTableUnionMapper.java @@ -0,0 +1,30 @@ +package io.dataease.base.mapper; + +import io.dataease.base.domain.DatasetTableUnion; +import io.dataease.base.domain.DatasetTableUnionExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface DatasetTableUnionMapper { + long countByExample(DatasetTableUnionExample example); + + int deleteByExample(DatasetTableUnionExample example); + + int deleteByPrimaryKey(String id); + + int insert(DatasetTableUnion record); + + int insertSelective(DatasetTableUnion record); + + List selectByExample(DatasetTableUnionExample example); + + DatasetTableUnion selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") DatasetTableUnion record, @Param("example") DatasetTableUnionExample example); + + int updateByExample(@Param("record") DatasetTableUnion record, @Param("example") DatasetTableUnionExample example); + + int updateByPrimaryKeySelective(DatasetTableUnion record); + + int updateByPrimaryKey(DatasetTableUnion record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/mapper/DatasetTableUnionMapper.xml b/backend/src/main/java/io/dataease/base/mapper/DatasetTableUnionMapper.xml new file mode 100644 index 0000000000..a0492827f5 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/DatasetTableUnionMapper.xml @@ -0,0 +1,276 @@ + + + + + + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + + + + + + + + and ${criterion.condition} + + + and ${criterion.condition} #{criterion.value} + + + and ${criterion.condition} #{criterion.value} and #{criterion.secondValue} + + + and ${criterion.condition} + + #{listItem} + + + + + + + + + + + id, source_table_id, source_table_field_id, source_union_relation, target_table_id, + target_table_field_id, target_union_relation, create_by, create_time + + + + + delete from dataset_table_union + where id = #{id,jdbcType=VARCHAR} + + + delete from dataset_table_union + + + + + + insert into dataset_table_union (id, source_table_id, source_table_field_id, + source_union_relation, target_table_id, target_table_field_id, + target_union_relation, create_by, create_time + ) + values (#{id,jdbcType=VARCHAR}, #{sourceTableId,jdbcType=VARCHAR}, #{sourceTableFieldId,jdbcType=VARCHAR}, + #{sourceUnionRelation,jdbcType=VARCHAR}, #{targetTableId,jdbcType=VARCHAR}, #{targetTableFieldId,jdbcType=VARCHAR}, + #{targetUnionRelation,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT} + ) + + + insert into dataset_table_union + + + id, + + + source_table_id, + + + source_table_field_id, + + + source_union_relation, + + + target_table_id, + + + target_table_field_id, + + + target_union_relation, + + + create_by, + + + create_time, + + + + + #{id,jdbcType=VARCHAR}, + + + #{sourceTableId,jdbcType=VARCHAR}, + + + #{sourceTableFieldId,jdbcType=VARCHAR}, + + + #{sourceUnionRelation,jdbcType=VARCHAR}, + + + #{targetTableId,jdbcType=VARCHAR}, + + + #{targetTableFieldId,jdbcType=VARCHAR}, + + + #{targetUnionRelation,jdbcType=VARCHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + + + + update dataset_table_union + + + id = #{record.id,jdbcType=VARCHAR}, + + + source_table_id = #{record.sourceTableId,jdbcType=VARCHAR}, + + + source_table_field_id = #{record.sourceTableFieldId,jdbcType=VARCHAR}, + + + source_union_relation = #{record.sourceUnionRelation,jdbcType=VARCHAR}, + + + target_table_id = #{record.targetTableId,jdbcType=VARCHAR}, + + + target_table_field_id = #{record.targetTableFieldId,jdbcType=VARCHAR}, + + + target_union_relation = #{record.targetUnionRelation,jdbcType=VARCHAR}, + + + create_by = #{record.createBy,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + + + + + + update dataset_table_union + set id = #{record.id,jdbcType=VARCHAR}, + source_table_id = #{record.sourceTableId,jdbcType=VARCHAR}, + source_table_field_id = #{record.sourceTableFieldId,jdbcType=VARCHAR}, + source_union_relation = #{record.sourceUnionRelation,jdbcType=VARCHAR}, + target_table_id = #{record.targetTableId,jdbcType=VARCHAR}, + target_table_field_id = #{record.targetTableFieldId,jdbcType=VARCHAR}, + target_union_relation = #{record.targetUnionRelation,jdbcType=VARCHAR}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT} + + + + + + update dataset_table_union + + + source_table_id = #{sourceTableId,jdbcType=VARCHAR}, + + + source_table_field_id = #{sourceTableFieldId,jdbcType=VARCHAR}, + + + source_union_relation = #{sourceUnionRelation,jdbcType=VARCHAR}, + + + target_table_id = #{targetTableId,jdbcType=VARCHAR}, + + + target_table_field_id = #{targetTableFieldId,jdbcType=VARCHAR}, + + + target_union_relation = #{targetUnionRelation,jdbcType=VARCHAR}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=VARCHAR} + + + update dataset_table_union + set source_table_id = #{sourceTableId,jdbcType=VARCHAR}, + source_table_field_id = #{sourceTableFieldId,jdbcType=VARCHAR}, + source_union_relation = #{sourceUnionRelation,jdbcType=VARCHAR}, + target_table_id = #{targetTableId,jdbcType=VARCHAR}, + target_table_field_id = #{targetTableFieldId,jdbcType=VARCHAR}, + target_union_relation = #{targetUnionRelation,jdbcType=VARCHAR}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtDatasetTableUnionMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtDatasetTableUnionMapper.java new file mode 100644 index 0000000000..afb8988f4e --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtDatasetTableUnionMapper.java @@ -0,0 +1,11 @@ +package io.dataease.base.mapper.ext; + +import io.dataease.dto.dataset.DataSetTableUnionDTO; + +import java.util.List; + +public interface ExtDatasetTableUnionMapper { + List selectBySourceTableId(String tableId); + + List selectByTargetTableId(String tableId); +} \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtDatasetTableUnionMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtDatasetTableUnionMapper.xml new file mode 100644 index 0000000000..d824e9227e --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtDatasetTableUnionMapper.xml @@ -0,0 +1,42 @@ + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/controller/dataset/DataSetTableUnionController.java b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableUnionController.java new file mode 100644 index 0000000000..73d6e11b4d --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/dataset/DataSetTableUnionController.java @@ -0,0 +1,35 @@ +package io.dataease.controller.dataset; + +import io.dataease.base.domain.DatasetTableUnion; +import io.dataease.dto.dataset.DataSetTableUnionDTO; +import io.dataease.service.dataset.DataSetTableUnionService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @Author gin + * @Date 2021/5/7 10:30 上午 + */ +@RestController +@RequestMapping("dataset/union") +public class DataSetTableUnionController { + @Resource + private DataSetTableUnionService dataSetTableUnionService; + + @PostMapping("save") + public DatasetTableUnion save(@RequestBody DatasetTableUnion datasetTableUnion) { + return dataSetTableUnionService.save(datasetTableUnion); + } + + @PostMapping("delete/{id}") + public void delete(@PathVariable String id) { + dataSetTableUnionService.delete(id); + } + + @PostMapping("listByTableId/{tableId}") + public List listByTableId(@PathVariable String tableId) { + return dataSetTableUnionService.listByTableId(tableId); + } +} diff --git a/backend/src/main/java/io/dataease/dto/dataset/DataSetTableUnionDTO.java b/backend/src/main/java/io/dataease/dto/dataset/DataSetTableUnionDTO.java new file mode 100644 index 0000000000..b1096c3b7a --- /dev/null +++ b/backend/src/main/java/io/dataease/dto/dataset/DataSetTableUnionDTO.java @@ -0,0 +1,18 @@ +package io.dataease.dto.dataset; + +import io.dataease.base.domain.DatasetTableUnion; +import lombok.Getter; +import lombok.Setter; + +/** + * @Author gin + * @Date 2021/5/6 6:08 下午 + */ +@Getter +@Setter +public class DataSetTableUnionDTO extends DatasetTableUnion { + private String sourceTableName; + private String sourceTableFieldName; + private String targetTableName; + private String targetTableFieldName; +} diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableUnionService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableUnionService.java new file mode 100644 index 0000000000..0c27d50439 --- /dev/null +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableUnionService.java @@ -0,0 +1,74 @@ +package io.dataease.service.dataset; + +import io.dataease.base.domain.DatasetTableUnion; +import io.dataease.base.mapper.DatasetTableUnionMapper; +import io.dataease.base.mapper.ext.ExtDatasetTableUnionMapper; +import io.dataease.commons.utils.AuthUtils; +import io.dataease.dto.dataset.DataSetTableUnionDTO; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; +import java.util.Comparator; +import java.util.List; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @Author gin + * @Date 2021/5/6 6:03 下午 + */ +@Service +@Transactional +public class DataSetTableUnionService { + @Resource + private DatasetTableUnionMapper datasetTableUnionMapper; + @Resource + private ExtDatasetTableUnionMapper extDatasetTableUnionMapper; + + public DatasetTableUnion save(DatasetTableUnion datasetTableUnion) { + if (StringUtils.isEmpty(datasetTableUnion.getId())) { + datasetTableUnion.setId(UUID.randomUUID().toString()); + datasetTableUnion.setCreateBy(AuthUtils.getUser().getUsername()); + datasetTableUnion.setCreateTime(System.currentTimeMillis()); + datasetTableUnionMapper.insert(datasetTableUnion); + } else { + datasetTableUnionMapper.updateByPrimaryKeySelective(datasetTableUnion); + } + return datasetTableUnion; + } + + public void delete(String id) { + datasetTableUnionMapper.deleteByPrimaryKey(id); + } + + public List listByTableId(String tableId) { + List sourceList = extDatasetTableUnionMapper.selectBySourceTableId(tableId); + List targetList = extDatasetTableUnionMapper.selectByTargetTableId(tableId); + sourceList.addAll(targetList.stream().map(ele -> { + DataSetTableUnionDTO dto = new DataSetTableUnionDTO(); + dto.setId(ele.getId()); + + dto.setSourceTableId(ele.getTargetTableId()); + dto.setSourceTableFieldId(ele.getTargetTableFieldId()); + dto.setSourceTableName(ele.getTargetTableName()); + dto.setSourceTableFieldName(ele.getTargetTableFieldName()); + + dto.setTargetTableId(ele.getSourceTableId()); + dto.setTargetTableFieldId(ele.getSourceTableFieldId()); + dto.setTargetTableName(ele.getSourceTableName()); + dto.setTargetTableFieldName(ele.getSourceTableFieldName()); + + dto.setSourceUnionRelation(ele.getTargetUnionRelation()); + dto.setTargetUnionRelation(ele.getSourceUnionRelation()); + + dto.setCreateBy(ele.getCreateBy()); + dto.setCreateTime(ele.getCreateTime()); + return dto; + }).collect(Collectors.toList())); + + sourceList.sort(Comparator.comparing(DatasetTableUnion::getCreateTime)); + return sourceList; + } +} diff --git a/backend/src/main/resources/db/migration/V15__dataset_union.sql b/backend/src/main/resources/db/migration/V15__dataset_union.sql new file mode 100644 index 0000000000..582390305a --- /dev/null +++ b/backend/src/main/resources/db/migration/V15__dataset_union.sql @@ -0,0 +1,15 @@ +DROP TABLE IF EXISTS `dataset_table_union`; +CREATE TABLE IF NOT EXISTS `dataset_table_union` +( + `id` varchar(50) NOT NULL COMMENT 'ID', + `source_table_id` varchar(50) COMMENT '关联表ID', + `source_table_field_id` varchar(50) COMMENT '关联字段ID', + `source_union_relation` varchar(50) COMMENT '关联关系,1:1、1:N、N:1', + `target_table_id` varchar(50) COMMENT '被关联表ID', + `target_table_field_id` varchar(50) COMMENT '被关联字段ID', + `target_union_relation` varchar(50) COMMENT '被关联关系,1:1、1:N、N:1', + `create_by` varchar(50) COMMENT '创建人ID', + `create_time` bigint(13) COMMENT '创建时间', + PRIMARY KEY (`id`) +) ENGINE = InnoDB + DEFAULT CHARSET = utf8mb4; \ No newline at end of file diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 277dfd4516..6eb609dba3 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -798,7 +798,17 @@ export default { pls_input_less_9: '请输入9位以内的正整数', field_edit: '编辑字段', table_already_add_to: '该表已添加至', - uploading: '上传中...' + uploading: '上传中...', + add_union: '添加关联', + union_setting: '关联设置', + pls_slc_union_field: '请选择关联字段', + pls_slc_union_table: '请选择关联表', + source_table: '关联表', + source_field: '关联字段', + target_table: '被关联表', + target_field: '被关联字段', + union_relation: '关联关系', + pls_setting_union_success: '请正确设置关联关系' }, datasource: { datasource: '数据源', diff --git a/frontend/src/views/dataset/common/DatasetGroupSelector.vue b/frontend/src/views/dataset/common/DatasetGroupSelector.vue index 9eacdf3f6c..959b188eac 100644 --- a/frontend/src/views/dataset/common/DatasetGroupSelector.vue +++ b/frontend/src/views/dataset/common/DatasetGroupSelector.vue @@ -79,6 +79,7 @@ node-key="id" :expand-on-click-node="true" class="tree-list" + highlight-current @node-click="sceneClick" > diff --git a/frontend/src/views/dataset/data/UnionView.vue b/frontend/src/views/dataset/data/UnionView.vue new file mode 100644 index 0000000000..b820fc3208 --- /dev/null +++ b/frontend/src/views/dataset/data/UnionView.vue @@ -0,0 +1,273 @@ + + + + + diff --git a/frontend/src/views/dataset/data/ViewTable.vue b/frontend/src/views/dataset/data/ViewTable.vue index b007a848ff..3addbf1236 100644 --- a/frontend/src/views/dataset/data/ViewTable.vue +++ b/frontend/src/views/dataset/data/ViewTable.vue @@ -32,7 +32,7 @@ - 关联视图 TODO + @@ -46,10 +46,11 @@ import { getTable, post } from '@/api/dataset/dataset' import TabDataPreview from './TabDataPreview' import UpdateInfo from './UpdateInfo' import DatasetChartDetail from '../common/DatasetChartDetail' +import UnionView from './UnionView' export default { name: 'ViewTable', - components: { DatasetChartDetail, UpdateInfo, TabDataPreview }, + components: { UnionView, DatasetChartDetail, UpdateInfo, TabDataPreview }, props: { param: { type: String,