From 54275459624780ddddcd014a68d3f90a98fd0d56 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Thu, 25 Feb 2021 15:33:42 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=86=E5=9B=BE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../io/dataease/base/domain/ChartGroup.java | 23 + .../base/domain/ChartGroupExample.java | 670 ++++++++++++++++++ .../base/mapper/ChartGroupMapper.java | 30 + .../dataease/base/mapper/ChartGroupMapper.xml | 243 +++++++ .../controller/chart/ChartController.java | 26 + .../chart/ChartGroupController.java | 32 + .../request/chart/ChartGroupRequest.java | 11 + .../io/dataease/dto/chart/ChartGroupDTO.java | 13 + .../service/chart/ChartGroupService.java | 111 +++ .../resources/db/migration/V10__chart.sql | 12 + .../src/main/resources/generatorConfig.xml | 2 +- .../src/business/components/chart/Chart.vue | 45 ++ .../business/components/chart/data/AddDB.vue | 148 ++++ .../components/chart/data/ChartHome.vue | 25 + .../components/chart/data/TabDataPreview.vue | 62 ++ .../components/chart/data/ViewTable.vue | 122 ++++ .../business/components/chart/group/Group.vue | 517 ++++++++++++++ .../src/business/components/chart/router.js | 18 + .../components/common/head/HeaderTopMenus.vue | 2 +- .../components/common/router/router.js | 5 +- frontend/src/business/store.js | 18 +- frontend/src/i18n/zh-CN.js | 31 + 22 files changed, 2161 insertions(+), 5 deletions(-) create mode 100644 backend/src/main/java/io/dataease/base/domain/ChartGroup.java create mode 100644 backend/src/main/java/io/dataease/base/domain/ChartGroupExample.java create mode 100644 backend/src/main/java/io/dataease/base/mapper/ChartGroupMapper.java create mode 100644 backend/src/main/java/io/dataease/base/mapper/ChartGroupMapper.xml create mode 100644 backend/src/main/java/io/dataease/controller/chart/ChartController.java create mode 100644 backend/src/main/java/io/dataease/controller/chart/ChartGroupController.java create mode 100644 backend/src/main/java/io/dataease/controller/request/chart/ChartGroupRequest.java create mode 100644 backend/src/main/java/io/dataease/dto/chart/ChartGroupDTO.java create mode 100644 backend/src/main/java/io/dataease/service/chart/ChartGroupService.java create mode 100644 backend/src/main/resources/db/migration/V10__chart.sql create mode 100644 frontend/src/business/components/chart/Chart.vue create mode 100644 frontend/src/business/components/chart/data/AddDB.vue create mode 100644 frontend/src/business/components/chart/data/ChartHome.vue create mode 100644 frontend/src/business/components/chart/data/TabDataPreview.vue create mode 100644 frontend/src/business/components/chart/data/ViewTable.vue create mode 100644 frontend/src/business/components/chart/group/Group.vue create mode 100644 frontend/src/business/components/chart/router.js diff --git a/backend/src/main/java/io/dataease/base/domain/ChartGroup.java b/backend/src/main/java/io/dataease/base/domain/ChartGroup.java new file mode 100644 index 0000000000..4d2128a4b6 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/domain/ChartGroup.java @@ -0,0 +1,23 @@ +package io.dataease.base.domain; + +import java.io.Serializable; +import lombok.Data; + +@Data +public class ChartGroup implements Serializable { + private String id; + + private String name; + + private String pid; + + private Integer level; + + private String type; + + 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/ChartGroupExample.java b/backend/src/main/java/io/dataease/base/domain/ChartGroupExample.java new file mode 100644 index 0000000000..c3bf4973e6 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/domain/ChartGroupExample.java @@ -0,0 +1,670 @@ +package io.dataease.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class ChartGroupExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public ChartGroupExample() { + 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 andNameIsNull() { + addCriterion("`name` is null"); + return (Criteria) this; + } + + public Criteria andNameIsNotNull() { + addCriterion("`name` is not null"); + return (Criteria) this; + } + + public Criteria andNameEqualTo(String value) { + addCriterion("`name` =", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotEqualTo(String value) { + addCriterion("`name` <>", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThan(String value) { + addCriterion("`name` >", value, "name"); + return (Criteria) this; + } + + public Criteria andNameGreaterThanOrEqualTo(String value) { + addCriterion("`name` >=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThan(String value) { + addCriterion("`name` <", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLessThanOrEqualTo(String value) { + addCriterion("`name` <=", value, "name"); + return (Criteria) this; + } + + public Criteria andNameLike(String value) { + addCriterion("`name` like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameNotLike(String value) { + addCriterion("`name` not like", value, "name"); + return (Criteria) this; + } + + public Criteria andNameIn(List values) { + addCriterion("`name` in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameNotIn(List values) { + addCriterion("`name` not in", values, "name"); + return (Criteria) this; + } + + public Criteria andNameBetween(String value1, String value2) { + addCriterion("`name` between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andNameNotBetween(String value1, String value2) { + addCriterion("`name` not between", value1, value2, "name"); + return (Criteria) this; + } + + public Criteria andPidIsNull() { + addCriterion("pid is null"); + return (Criteria) this; + } + + public Criteria andPidIsNotNull() { + addCriterion("pid is not null"); + return (Criteria) this; + } + + public Criteria andPidEqualTo(String value) { + addCriterion("pid =", value, "pid"); + return (Criteria) this; + } + + public Criteria andPidNotEqualTo(String value) { + addCriterion("pid <>", value, "pid"); + return (Criteria) this; + } + + public Criteria andPidGreaterThan(String value) { + addCriterion("pid >", value, "pid"); + return (Criteria) this; + } + + public Criteria andPidGreaterThanOrEqualTo(String value) { + addCriterion("pid >=", value, "pid"); + return (Criteria) this; + } + + public Criteria andPidLessThan(String value) { + addCriterion("pid <", value, "pid"); + return (Criteria) this; + } + + public Criteria andPidLessThanOrEqualTo(String value) { + addCriterion("pid <=", value, "pid"); + return (Criteria) this; + } + + public Criteria andPidLike(String value) { + addCriterion("pid like", value, "pid"); + return (Criteria) this; + } + + public Criteria andPidNotLike(String value) { + addCriterion("pid not like", value, "pid"); + return (Criteria) this; + } + + public Criteria andPidIn(List values) { + addCriterion("pid in", values, "pid"); + return (Criteria) this; + } + + public Criteria andPidNotIn(List values) { + addCriterion("pid not in", values, "pid"); + return (Criteria) this; + } + + public Criteria andPidBetween(String value1, String value2) { + addCriterion("pid between", value1, value2, "pid"); + return (Criteria) this; + } + + public Criteria andPidNotBetween(String value1, String value2) { + addCriterion("pid not between", value1, value2, "pid"); + return (Criteria) this; + } + + public Criteria andLevelIsNull() { + addCriterion("`level` is null"); + return (Criteria) this; + } + + public Criteria andLevelIsNotNull() { + addCriterion("`level` is not null"); + return (Criteria) this; + } + + public Criteria andLevelEqualTo(Integer value) { + addCriterion("`level` =", value, "level"); + return (Criteria) this; + } + + public Criteria andLevelNotEqualTo(Integer value) { + addCriterion("`level` <>", value, "level"); + return (Criteria) this; + } + + public Criteria andLevelGreaterThan(Integer value) { + addCriterion("`level` >", value, "level"); + return (Criteria) this; + } + + public Criteria andLevelGreaterThanOrEqualTo(Integer value) { + addCriterion("`level` >=", value, "level"); + return (Criteria) this; + } + + public Criteria andLevelLessThan(Integer value) { + addCriterion("`level` <", value, "level"); + return (Criteria) this; + } + + public Criteria andLevelLessThanOrEqualTo(Integer value) { + addCriterion("`level` <=", value, "level"); + return (Criteria) this; + } + + public Criteria andLevelIn(List values) { + addCriterion("`level` in", values, "level"); + return (Criteria) this; + } + + public Criteria andLevelNotIn(List values) { + addCriterion("`level` not in", values, "level"); + return (Criteria) this; + } + + public Criteria andLevelBetween(Integer value1, Integer value2) { + addCriterion("`level` between", value1, value2, "level"); + return (Criteria) this; + } + + public Criteria andLevelNotBetween(Integer value1, Integer value2) { + addCriterion("`level` not between", value1, value2, "level"); + return (Criteria) this; + } + + public Criteria andTypeIsNull() { + addCriterion("`type` is null"); + return (Criteria) this; + } + + public Criteria andTypeIsNotNull() { + addCriterion("`type` is not null"); + return (Criteria) this; + } + + public Criteria andTypeEqualTo(String value) { + addCriterion("`type` =", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotEqualTo(String value) { + addCriterion("`type` <>", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThan(String value) { + addCriterion("`type` >", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeGreaterThanOrEqualTo(String value) { + addCriterion("`type` >=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThan(String value) { + addCriterion("`type` <", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLessThanOrEqualTo(String value) { + addCriterion("`type` <=", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeLike(String value) { + addCriterion("`type` like", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotLike(String value) { + addCriterion("`type` not like", value, "type"); + return (Criteria) this; + } + + public Criteria andTypeIn(List values) { + addCriterion("`type` in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotIn(List values) { + addCriterion("`type` not in", values, "type"); + return (Criteria) this; + } + + public Criteria andTypeBetween(String value1, String value2) { + addCriterion("`type` between", value1, value2, "type"); + return (Criteria) this; + } + + public Criteria andTypeNotBetween(String value1, String value2) { + addCriterion("`type` not between", value1, value2, "type"); + 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/ChartGroupMapper.java b/backend/src/main/java/io/dataease/base/mapper/ChartGroupMapper.java new file mode 100644 index 0000000000..92e6264833 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/ChartGroupMapper.java @@ -0,0 +1,30 @@ +package io.dataease.base.mapper; + +import io.dataease.base.domain.ChartGroup; +import io.dataease.base.domain.ChartGroupExample; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface ChartGroupMapper { + long countByExample(ChartGroupExample example); + + int deleteByExample(ChartGroupExample example); + + int deleteByPrimaryKey(String id); + + int insert(ChartGroup record); + + int insertSelective(ChartGroup record); + + List selectByExample(ChartGroupExample example); + + ChartGroup selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") ChartGroup record, @Param("example") ChartGroupExample example); + + int updateByExample(@Param("record") ChartGroup record, @Param("example") ChartGroupExample example); + + int updateByPrimaryKeySelective(ChartGroup record); + + int updateByPrimaryKey(ChartGroup record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/mapper/ChartGroupMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ChartGroupMapper.xml new file mode 100644 index 0000000000..58f37d6da4 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/ChartGroupMapper.xml @@ -0,0 +1,243 @@ + + + + + + + + + + + + + + + + + + + + + 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, `name`, pid, `level`, `type`, create_by, create_time + + + + + delete from chart_group + where id = #{id,jdbcType=VARCHAR} + + + delete from chart_group + + + + + + insert into chart_group (id, `name`, pid, + `level`, `type`, create_by, + create_time) + values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{pid,jdbcType=VARCHAR}, + #{level,jdbcType=INTEGER}, #{type,jdbcType=VARCHAR}, #{createBy,jdbcType=VARCHAR}, + #{createTime,jdbcType=BIGINT}) + + + insert into chart_group + + + id, + + + `name`, + + + pid, + + + `level`, + + + `type`, + + + create_by, + + + create_time, + + + + + #{id,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{pid,jdbcType=VARCHAR}, + + + #{level,jdbcType=INTEGER}, + + + #{type,jdbcType=VARCHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + + + + update chart_group + + + id = #{record.id,jdbcType=VARCHAR}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + pid = #{record.pid,jdbcType=VARCHAR}, + + + `level` = #{record.level,jdbcType=INTEGER}, + + + `type` = #{record.type,jdbcType=VARCHAR}, + + + create_by = #{record.createBy,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + + + + + + update chart_group + set id = #{record.id,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + pid = #{record.pid,jdbcType=VARCHAR}, + `level` = #{record.level,jdbcType=INTEGER}, + `type` = #{record.type,jdbcType=VARCHAR}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT} + + + + + + update chart_group + + + `name` = #{name,jdbcType=VARCHAR}, + + + pid = #{pid,jdbcType=VARCHAR}, + + + `level` = #{level,jdbcType=INTEGER}, + + + `type` = #{type,jdbcType=VARCHAR}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + where id = #{id,jdbcType=VARCHAR} + + + update chart_group + set `name` = #{name,jdbcType=VARCHAR}, + pid = #{pid,jdbcType=VARCHAR}, + `level` = #{level,jdbcType=INTEGER}, + `type` = #{type,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/controller/chart/ChartController.java b/backend/src/main/java/io/dataease/controller/chart/ChartController.java new file mode 100644 index 0000000000..8c752f76dd --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/chart/ChartController.java @@ -0,0 +1,26 @@ +package io.dataease.controller.chart; + +import com.alibaba.fastjson.JSON; +import io.dataease.base.domain.DatasetTable; +import io.dataease.controller.request.dataset.DataSetTableRequest; +import io.dataease.datasource.dto.TableFiled; +import io.dataease.service.dataset.DataSetTableService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +@RestController +@RequestMapping("chart/table") +public class ChartController { + + + + @PostMapping("list") + public List list(@RequestBody DataSetTableRequest dataSetTableRequest) { + return new ArrayList<>(); + } + +} diff --git a/backend/src/main/java/io/dataease/controller/chart/ChartGroupController.java b/backend/src/main/java/io/dataease/controller/chart/ChartGroupController.java new file mode 100644 index 0000000000..2c642886c5 --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/chart/ChartGroupController.java @@ -0,0 +1,32 @@ +package io.dataease.controller.chart; + +import io.dataease.base.domain.ChartGroup; +import io.dataease.controller.request.chart.ChartGroupRequest; +import io.dataease.dto.chart.ChartGroupDTO; +import io.dataease.service.chart.ChartGroupService; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +@RestController +@RequestMapping("chart/group") +public class ChartGroupController { + @Resource + private ChartGroupService chartGroupService; + + @PostMapping("/save") + public ChartGroupDTO save(@RequestBody ChartGroup ChartGroup) { + return chartGroupService.save(ChartGroup); + } + + @PostMapping("/tree") + public List tree(@RequestBody ChartGroupRequest ChartGroup) { + return chartGroupService.tree(ChartGroup); + } + + @PostMapping("/delete/{id}") + public void tree(@PathVariable String id) { + chartGroupService.delete(id); + } +} diff --git a/backend/src/main/java/io/dataease/controller/request/chart/ChartGroupRequest.java b/backend/src/main/java/io/dataease/controller/request/chart/ChartGroupRequest.java new file mode 100644 index 0000000000..27b0d12b9a --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/request/chart/ChartGroupRequest.java @@ -0,0 +1,11 @@ +package io.dataease.controller.request.chart; + +import io.dataease.base.domain.ChartGroup; +import io.dataease.base.domain.DatasetGroup; +import lombok.Data; + + +@Data +public class ChartGroupRequest extends ChartGroup { + private String sort; +} diff --git a/backend/src/main/java/io/dataease/dto/chart/ChartGroupDTO.java b/backend/src/main/java/io/dataease/dto/chart/ChartGroupDTO.java new file mode 100644 index 0000000000..1542759994 --- /dev/null +++ b/backend/src/main/java/io/dataease/dto/chart/ChartGroupDTO.java @@ -0,0 +1,13 @@ +package io.dataease.dto.chart; + +import io.dataease.base.domain.DatasetGroup; +import lombok.Data; + +import java.util.List; + + +@Data +public class ChartGroupDTO extends DatasetGroup { + private String label; + private List children; +} diff --git a/backend/src/main/java/io/dataease/service/chart/ChartGroupService.java b/backend/src/main/java/io/dataease/service/chart/ChartGroupService.java new file mode 100644 index 0000000000..2f2b858c2a --- /dev/null +++ b/backend/src/main/java/io/dataease/service/chart/ChartGroupService.java @@ -0,0 +1,111 @@ +package io.dataease.service.chart; + +import com.alibaba.nacos.common.util.UuidUtils; +import io.dataease.base.domain.ChartGroup; +import io.dataease.base.domain.ChartGroupExample; +import io.dataease.base.mapper.ChartGroupMapper; +import io.dataease.commons.utils.BeanUtils; +import io.dataease.controller.request.chart.ChartGroupRequest; +import io.dataease.dto.chart.ChartGroupDTO; +import org.apache.commons.collections.CollectionUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + + +@Service +public class ChartGroupService { + @Resource + private ChartGroupMapper chartGroupMapper; + + public ChartGroupDTO save(ChartGroup chartGroup) { + if (StringUtils.isEmpty(chartGroup.getId())) { + chartGroup.setId(UuidUtils.generateUuid()); + chartGroup.setCreateTime(System.currentTimeMillis()); + chartGroupMapper.insert(chartGroup); + } else { + chartGroupMapper.updateByPrimaryKey(chartGroup); + } + ChartGroupDTO ChartGroupDTO = new ChartGroupDTO(); + BeanUtils.copyBean(ChartGroupDTO, chartGroup); + ChartGroupDTO.setLabel(ChartGroupDTO.getName()); + return ChartGroupDTO; + } + + public void delete(String id) { + ChartGroupRequest ChartGroup = new ChartGroupRequest(); + ChartGroup.setId(id); + List tree = tree(ChartGroup); + List ids = new ArrayList<>(); + getAllId(tree, ids); + ChartGroupExample ChartGroupExample = new ChartGroupExample(); + ChartGroupExample.createCriteria().andIdIn(ids); + chartGroupMapper.deleteByExample(ChartGroupExample); + } + + public List tree(ChartGroupRequest ChartGroup) { + ChartGroupExample ChartGroupExample = new ChartGroupExample(); + ChartGroupExample.Criteria criteria = ChartGroupExample.createCriteria(); + if (StringUtils.isNotEmpty(ChartGroup.getName())) { + criteria.andNameLike("%" + ChartGroup.getName() + "%"); + } + if (StringUtils.isNotEmpty(ChartGroup.getType())) { + criteria.andTypeEqualTo(ChartGroup.getType()); + } + if (StringUtils.isNotEmpty(ChartGroup.getId())) { + criteria.andIdEqualTo(ChartGroup.getId()); + } else { + criteria.andLevelEqualTo(0); + } + ChartGroupExample.setOrderByClause(ChartGroup.getSort()); + List ChartGroups = chartGroupMapper.selectByExample(ChartGroupExample); + List DTOs = ChartGroups.stream().map(ele -> { + ChartGroupDTO dto = new ChartGroupDTO(); + BeanUtils.copyBean(dto, ele); + dto.setLabel(ele.getName()); + return dto; + }).collect(Collectors.toList()); + getAll(DTOs, ChartGroup); + return DTOs; + } + + public void getAll(List list, ChartGroupRequest ChartGroup) { + for (ChartGroupDTO obj : list) { + ChartGroupExample ChartGroupExample = new ChartGroupExample(); + ChartGroupExample.Criteria criteria = ChartGroupExample.createCriteria(); + if (StringUtils.isNotEmpty(ChartGroup.getName())) { + criteria.andNameLike("%" + ChartGroup.getName() + "%"); + } + if (StringUtils.isNotEmpty(ChartGroup.getType())) { + criteria.andTypeEqualTo(ChartGroup.getType()); + } + criteria.andPidEqualTo(obj.getId()); + ChartGroupExample.setOrderByClause(ChartGroup.getSort()); + List ChartGroups = chartGroupMapper.selectByExample(ChartGroupExample); + List DTOs = ChartGroups.stream().map(ele -> { + ChartGroupDTO dto = new ChartGroupDTO(); + BeanUtils.copyBean(dto, ele); + dto.setLabel(ele.getName()); + return dto; + }).collect(Collectors.toList()); + obj.setChildren(DTOs); + if (CollectionUtils.isNotEmpty(DTOs)) { + getAll(DTOs, ChartGroup); + } + } + } + + public List getAllId(List list, List ids) { + for (ChartGroupDTO dto : list) { + ids.add(dto.getId()); + if (CollectionUtils.isNotEmpty(dto.getChildren())) { + getAllId(dto.getChildren(), ids); + } + } + return ids; + } +} diff --git a/backend/src/main/resources/db/migration/V10__chart.sql b/backend/src/main/resources/db/migration/V10__chart.sql new file mode 100644 index 0000000000..3d4e563eb4 --- /dev/null +++ b/backend/src/main/resources/db/migration/V10__chart.sql @@ -0,0 +1,12 @@ +-- chart start +CREATE TABLE IF NOT EXISTS `chart_group` ( + `id` varchar(50) NOT NULL COMMENT 'ID', + `name` varchar(64) NOT NULL COMMENT '名称', + `pid` varchar(50) COMMENT '父级ID', + `level` int(10) COMMENT '当前分组处于第几级', + `type` varchar(50) COMMENT 'group or scene', + `create_by` varchar(50) COMMENT '创建人ID', + `create_time` bigint(13) COMMENT '创建时间', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; +-- chart end diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index 7335b04159..11e0f4bcd3 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -64,7 +64,7 @@ - +
diff --git a/frontend/src/business/components/chart/Chart.vue b/frontend/src/business/components/chart/Chart.vue new file mode 100644 index 0000000000..bc27092c0b --- /dev/null +++ b/frontend/src/business/components/chart/Chart.vue @@ -0,0 +1,45 @@ + + + + + diff --git a/frontend/src/business/components/chart/data/AddDB.vue b/frontend/src/business/components/chart/data/AddDB.vue new file mode 100644 index 0000000000..bdc47a0553 --- /dev/null +++ b/frontend/src/business/components/chart/data/AddDB.vue @@ -0,0 +1,148 @@ + + + + + diff --git a/frontend/src/business/components/chart/data/ChartHome.vue b/frontend/src/business/components/chart/data/ChartHome.vue new file mode 100644 index 0000000000..a3e454d98f --- /dev/null +++ b/frontend/src/business/components/chart/data/ChartHome.vue @@ -0,0 +1,25 @@ + + + + + diff --git a/frontend/src/business/components/chart/data/TabDataPreview.vue b/frontend/src/business/components/chart/data/TabDataPreview.vue new file mode 100644 index 0000000000..8a8e52eb13 --- /dev/null +++ b/frontend/src/business/components/chart/data/TabDataPreview.vue @@ -0,0 +1,62 @@ + + + + + diff --git a/frontend/src/business/components/chart/data/ViewTable.vue b/frontend/src/business/components/chart/data/ViewTable.vue new file mode 100644 index 0000000000..38a9ad1408 --- /dev/null +++ b/frontend/src/business/components/chart/data/ViewTable.vue @@ -0,0 +1,122 @@ + + + + + diff --git a/frontend/src/business/components/chart/group/Group.vue b/frontend/src/business/components/chart/group/Group.vue new file mode 100644 index 0000000000..e587bd51e2 --- /dev/null +++ b/frontend/src/business/components/chart/group/Group.vue @@ -0,0 +1,517 @@ + + + + + diff --git a/frontend/src/business/components/chart/router.js b/frontend/src/business/components/chart/router.js new file mode 100644 index 0000000000..579847c8fb --- /dev/null +++ b/frontend/src/business/components/chart/router.js @@ -0,0 +1,18 @@ +const Chart = () => import('@/business/components/chart/Chart'); +const ChartHome = () => import('@/business/components/chart/data/ChartHome'); + +export default { + path: "/chart", + name: "ChartGroup", + redirect: "/chart/home", + components: { + content: Chart, + }, + children: [ + { + path: 'home', + name: 'home', + component: ChartHome, + } + ] +} diff --git a/frontend/src/business/components/common/head/HeaderTopMenus.vue b/frontend/src/business/components/common/head/HeaderTopMenus.vue index aab3357a99..8ddc5ca9b0 100644 --- a/frontend/src/business/components/common/head/HeaderTopMenus.vue +++ b/frontend/src/business/components/common/head/HeaderTopMenus.vue @@ -11,7 +11,7 @@ {{ $t('test_track.test_track') }} - + {{ $t('commons.api') }}