diff --git a/backend/pom.xml b/backend/pom.xml index 748cb95a83..ed76e48968 100644 --- a/backend/pom.xml +++ b/backend/pom.xml @@ -5,7 +5,7 @@ dataease-server io.dataease - 1.8.0 + 1.9.0 4.0.0 @@ -106,6 +106,7 @@ mysql mysql-connector-java + 8.0.28 runtime @@ -214,12 +215,12 @@ io.dataease dataease-plugin-interface - 1.8.0 + 1.9.0 io.dataease dataease-plugin-view - 1.8.0 + 1.9.0 cn.hutool @@ -279,6 +280,16 @@ json-path 2.4.0 + + + org.springframework.boot + spring-boot-starter-data-redis + + + + org.apache.commons + commons-pool2 + diff --git a/backend/src/main/java/io/dataease/base/domain/ChartViewCache.java b/backend/src/main/java/io/dataease/base/domain/ChartViewCache.java new file mode 100644 index 0000000000..1cb34116b3 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/domain/ChartViewCache.java @@ -0,0 +1,39 @@ +package io.dataease.base.domain; + +import java.io.Serializable; +import lombok.Data; + +@Data +public class ChartViewCache implements Serializable { + private String id; + + private String name; + + private String title; + + private String sceneId; + + private String tableId; + + private String type; + + private String render; + + private Integer resultCount; + + private String resultMode; + + private String createBy; + + private Long createTime; + + private Long updateTime; + + private String stylePriority; + + private String chartType; + + private Boolean isPlugin; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/domain/ChartViewCacheExample.java b/backend/src/main/java/io/dataease/base/domain/ChartViewCacheExample.java new file mode 100644 index 0000000000..aa5bb02aef --- /dev/null +++ b/backend/src/main/java/io/dataease/base/domain/ChartViewCacheExample.java @@ -0,0 +1,1210 @@ +package io.dataease.base.domain; + +import java.util.ArrayList; +import java.util.List; + +public class ChartViewCacheExample { + protected String orderByClause; + + protected boolean distinct; + + protected List oredCriteria; + + public ChartViewCacheExample() { + 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 andTitleIsNull() { + addCriterion("title is null"); + return (Criteria) this; + } + + public Criteria andTitleIsNotNull() { + addCriterion("title is not null"); + return (Criteria) this; + } + + public Criteria andTitleEqualTo(String value) { + addCriterion("title =", value, "title"); + return (Criteria) this; + } + + public Criteria andTitleNotEqualTo(String value) { + addCriterion("title <>", value, "title"); + return (Criteria) this; + } + + public Criteria andTitleGreaterThan(String value) { + addCriterion("title >", value, "title"); + return (Criteria) this; + } + + public Criteria andTitleGreaterThanOrEqualTo(String value) { + addCriterion("title >=", value, "title"); + return (Criteria) this; + } + + public Criteria andTitleLessThan(String value) { + addCriterion("title <", value, "title"); + return (Criteria) this; + } + + public Criteria andTitleLessThanOrEqualTo(String value) { + addCriterion("title <=", value, "title"); + return (Criteria) this; + } + + public Criteria andTitleLike(String value) { + addCriterion("title like", value, "title"); + return (Criteria) this; + } + + public Criteria andTitleNotLike(String value) { + addCriterion("title not like", value, "title"); + return (Criteria) this; + } + + public Criteria andTitleIn(List values) { + addCriterion("title in", values, "title"); + return (Criteria) this; + } + + public Criteria andTitleNotIn(List values) { + addCriterion("title not in", values, "title"); + return (Criteria) this; + } + + public Criteria andTitleBetween(String value1, String value2) { + addCriterion("title between", value1, value2, "title"); + return (Criteria) this; + } + + public Criteria andTitleNotBetween(String value1, String value2) { + addCriterion("title not between", value1, value2, "title"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNull() { + addCriterion("scene_id is null"); + return (Criteria) this; + } + + public Criteria andSceneIdIsNotNull() { + addCriterion("scene_id is not null"); + return (Criteria) this; + } + + public Criteria andSceneIdEqualTo(String value) { + addCriterion("scene_id =", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotEqualTo(String value) { + addCriterion("scene_id <>", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThan(String value) { + addCriterion("scene_id >", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdGreaterThanOrEqualTo(String value) { + addCriterion("scene_id >=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThan(String value) { + addCriterion("scene_id <", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLessThanOrEqualTo(String value) { + addCriterion("scene_id <=", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdLike(String value) { + addCriterion("scene_id like", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotLike(String value) { + addCriterion("scene_id not like", value, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdIn(List values) { + addCriterion("scene_id in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotIn(List values) { + addCriterion("scene_id not in", values, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdBetween(String value1, String value2) { + addCriterion("scene_id between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andSceneIdNotBetween(String value1, String value2) { + addCriterion("scene_id not between", value1, value2, "sceneId"); + return (Criteria) this; + } + + public Criteria andTableIdIsNull() { + addCriterion("table_id is null"); + return (Criteria) this; + } + + public Criteria andTableIdIsNotNull() { + addCriterion("table_id is not null"); + return (Criteria) this; + } + + public Criteria andTableIdEqualTo(String value) { + addCriterion("table_id =", value, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdNotEqualTo(String value) { + addCriterion("table_id <>", value, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdGreaterThan(String value) { + addCriterion("table_id >", value, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdGreaterThanOrEqualTo(String value) { + addCriterion("table_id >=", value, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdLessThan(String value) { + addCriterion("table_id <", value, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdLessThanOrEqualTo(String value) { + addCriterion("table_id <=", value, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdLike(String value) { + addCriterion("table_id like", value, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdNotLike(String value) { + addCriterion("table_id not like", value, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdIn(List values) { + addCriterion("table_id in", values, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdNotIn(List values) { + addCriterion("table_id not in", values, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdBetween(String value1, String value2) { + addCriterion("table_id between", value1, value2, "tableId"); + return (Criteria) this; + } + + public Criteria andTableIdNotBetween(String value1, String value2) { + addCriterion("table_id not between", value1, value2, "tableId"); + 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 andRenderIsNull() { + addCriterion("render is null"); + return (Criteria) this; + } + + public Criteria andRenderIsNotNull() { + addCriterion("render is not null"); + return (Criteria) this; + } + + public Criteria andRenderEqualTo(String value) { + addCriterion("render =", value, "render"); + return (Criteria) this; + } + + public Criteria andRenderNotEqualTo(String value) { + addCriterion("render <>", value, "render"); + return (Criteria) this; + } + + public Criteria andRenderGreaterThan(String value) { + addCriterion("render >", value, "render"); + return (Criteria) this; + } + + public Criteria andRenderGreaterThanOrEqualTo(String value) { + addCriterion("render >=", value, "render"); + return (Criteria) this; + } + + public Criteria andRenderLessThan(String value) { + addCriterion("render <", value, "render"); + return (Criteria) this; + } + + public Criteria andRenderLessThanOrEqualTo(String value) { + addCriterion("render <=", value, "render"); + return (Criteria) this; + } + + public Criteria andRenderLike(String value) { + addCriterion("render like", value, "render"); + return (Criteria) this; + } + + public Criteria andRenderNotLike(String value) { + addCriterion("render not like", value, "render"); + return (Criteria) this; + } + + public Criteria andRenderIn(List values) { + addCriterion("render in", values, "render"); + return (Criteria) this; + } + + public Criteria andRenderNotIn(List values) { + addCriterion("render not in", values, "render"); + return (Criteria) this; + } + + public Criteria andRenderBetween(String value1, String value2) { + addCriterion("render between", value1, value2, "render"); + return (Criteria) this; + } + + public Criteria andRenderNotBetween(String value1, String value2) { + addCriterion("render not between", value1, value2, "render"); + return (Criteria) this; + } + + public Criteria andResultCountIsNull() { + addCriterion("result_count is null"); + return (Criteria) this; + } + + public Criteria andResultCountIsNotNull() { + addCriterion("result_count is not null"); + return (Criteria) this; + } + + public Criteria andResultCountEqualTo(Integer value) { + addCriterion("result_count =", value, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultCountNotEqualTo(Integer value) { + addCriterion("result_count <>", value, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultCountGreaterThan(Integer value) { + addCriterion("result_count >", value, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultCountGreaterThanOrEqualTo(Integer value) { + addCriterion("result_count >=", value, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultCountLessThan(Integer value) { + addCriterion("result_count <", value, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultCountLessThanOrEqualTo(Integer value) { + addCriterion("result_count <=", value, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultCountIn(List values) { + addCriterion("result_count in", values, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultCountNotIn(List values) { + addCriterion("result_count not in", values, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultCountBetween(Integer value1, Integer value2) { + addCriterion("result_count between", value1, value2, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultCountNotBetween(Integer value1, Integer value2) { + addCriterion("result_count not between", value1, value2, "resultCount"); + return (Criteria) this; + } + + public Criteria andResultModeIsNull() { + addCriterion("result_mode is null"); + return (Criteria) this; + } + + public Criteria andResultModeIsNotNull() { + addCriterion("result_mode is not null"); + return (Criteria) this; + } + + public Criteria andResultModeEqualTo(String value) { + addCriterion("result_mode =", value, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeNotEqualTo(String value) { + addCriterion("result_mode <>", value, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeGreaterThan(String value) { + addCriterion("result_mode >", value, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeGreaterThanOrEqualTo(String value) { + addCriterion("result_mode >=", value, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeLessThan(String value) { + addCriterion("result_mode <", value, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeLessThanOrEqualTo(String value) { + addCriterion("result_mode <=", value, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeLike(String value) { + addCriterion("result_mode like", value, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeNotLike(String value) { + addCriterion("result_mode not like", value, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeIn(List values) { + addCriterion("result_mode in", values, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeNotIn(List values) { + addCriterion("result_mode not in", values, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeBetween(String value1, String value2) { + addCriterion("result_mode between", value1, value2, "resultMode"); + return (Criteria) this; + } + + public Criteria andResultModeNotBetween(String value1, String value2) { + addCriterion("result_mode not between", value1, value2, "resultMode"); + 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 Criteria andUpdateTimeIsNull() { + addCriterion("update_time is null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIsNotNull() { + addCriterion("update_time is not null"); + return (Criteria) this; + } + + public Criteria andUpdateTimeEqualTo(Long value) { + addCriterion("update_time =", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotEqualTo(Long value) { + addCriterion("update_time <>", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThan(Long value) { + addCriterion("update_time >", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeGreaterThanOrEqualTo(Long value) { + addCriterion("update_time >=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThan(Long value) { + addCriterion("update_time <", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeLessThanOrEqualTo(Long value) { + addCriterion("update_time <=", value, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeIn(List values) { + addCriterion("update_time in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotIn(List values) { + addCriterion("update_time not in", values, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeBetween(Long value1, Long value2) { + addCriterion("update_time between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andUpdateTimeNotBetween(Long value1, Long value2) { + addCriterion("update_time not between", value1, value2, "updateTime"); + return (Criteria) this; + } + + public Criteria andStylePriorityIsNull() { + addCriterion("style_priority is null"); + return (Criteria) this; + } + + public Criteria andStylePriorityIsNotNull() { + addCriterion("style_priority is not null"); + return (Criteria) this; + } + + public Criteria andStylePriorityEqualTo(String value) { + addCriterion("style_priority =", value, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityNotEqualTo(String value) { + addCriterion("style_priority <>", value, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityGreaterThan(String value) { + addCriterion("style_priority >", value, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityGreaterThanOrEqualTo(String value) { + addCriterion("style_priority >=", value, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityLessThan(String value) { + addCriterion("style_priority <", value, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityLessThanOrEqualTo(String value) { + addCriterion("style_priority <=", value, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityLike(String value) { + addCriterion("style_priority like", value, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityNotLike(String value) { + addCriterion("style_priority not like", value, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityIn(List values) { + addCriterion("style_priority in", values, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityNotIn(List values) { + addCriterion("style_priority not in", values, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityBetween(String value1, String value2) { + addCriterion("style_priority between", value1, value2, "stylePriority"); + return (Criteria) this; + } + + public Criteria andStylePriorityNotBetween(String value1, String value2) { + addCriterion("style_priority not between", value1, value2, "stylePriority"); + return (Criteria) this; + } + + public Criteria andChartTypeIsNull() { + addCriterion("chart_type is null"); + return (Criteria) this; + } + + public Criteria andChartTypeIsNotNull() { + addCriterion("chart_type is not null"); + return (Criteria) this; + } + + public Criteria andChartTypeEqualTo(String value) { + addCriterion("chart_type =", value, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeNotEqualTo(String value) { + addCriterion("chart_type <>", value, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeGreaterThan(String value) { + addCriterion("chart_type >", value, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeGreaterThanOrEqualTo(String value) { + addCriterion("chart_type >=", value, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeLessThan(String value) { + addCriterion("chart_type <", value, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeLessThanOrEqualTo(String value) { + addCriterion("chart_type <=", value, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeLike(String value) { + addCriterion("chart_type like", value, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeNotLike(String value) { + addCriterion("chart_type not like", value, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeIn(List values) { + addCriterion("chart_type in", values, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeNotIn(List values) { + addCriterion("chart_type not in", values, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeBetween(String value1, String value2) { + addCriterion("chart_type between", value1, value2, "chartType"); + return (Criteria) this; + } + + public Criteria andChartTypeNotBetween(String value1, String value2) { + addCriterion("chart_type not between", value1, value2, "chartType"); + return (Criteria) this; + } + + public Criteria andIsPluginIsNull() { + addCriterion("is_plugin is null"); + return (Criteria) this; + } + + public Criteria andIsPluginIsNotNull() { + addCriterion("is_plugin is not null"); + return (Criteria) this; + } + + public Criteria andIsPluginEqualTo(Boolean value) { + addCriterion("is_plugin =", value, "isPlugin"); + return (Criteria) this; + } + + public Criteria andIsPluginNotEqualTo(Boolean value) { + addCriterion("is_plugin <>", value, "isPlugin"); + return (Criteria) this; + } + + public Criteria andIsPluginGreaterThan(Boolean value) { + addCriterion("is_plugin >", value, "isPlugin"); + return (Criteria) this; + } + + public Criteria andIsPluginGreaterThanOrEqualTo(Boolean value) { + addCriterion("is_plugin >=", value, "isPlugin"); + return (Criteria) this; + } + + public Criteria andIsPluginLessThan(Boolean value) { + addCriterion("is_plugin <", value, "isPlugin"); + return (Criteria) this; + } + + public Criteria andIsPluginLessThanOrEqualTo(Boolean value) { + addCriterion("is_plugin <=", value, "isPlugin"); + return (Criteria) this; + } + + public Criteria andIsPluginIn(List values) { + addCriterion("is_plugin in", values, "isPlugin"); + return (Criteria) this; + } + + public Criteria andIsPluginNotIn(List values) { + addCriterion("is_plugin not in", values, "isPlugin"); + return (Criteria) this; + } + + public Criteria andIsPluginBetween(Boolean value1, Boolean value2) { + addCriterion("is_plugin between", value1, value2, "isPlugin"); + return (Criteria) this; + } + + public Criteria andIsPluginNotBetween(Boolean value1, Boolean value2) { + addCriterion("is_plugin not between", value1, value2, "isPlugin"); + 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/domain/ChartViewCacheWithBLOBs.java b/backend/src/main/java/io/dataease/base/domain/ChartViewCacheWithBLOBs.java new file mode 100644 index 0000000000..9e181a9dcb --- /dev/null +++ b/backend/src/main/java/io/dataease/base/domain/ChartViewCacheWithBLOBs.java @@ -0,0 +1,37 @@ +package io.dataease.base.domain; + +import java.io.Serializable; +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; + +@Data +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +public class ChartViewCacheWithBLOBs extends ChartViewCache implements Serializable { + private String xAxis; + + private String xAxisExt; + + private String yAxis; + + private String yAxisExt; + + private String extStack; + + private String extBubble; + + private String customAttr; + + private String customStyle; + + private String customFilter; + + private String drillFields; + + private String senior; + + private String snapshot; + + private static final long serialVersionUID = 1L; +} \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/mapper/ChartViewCacheMapper.java b/backend/src/main/java/io/dataease/base/mapper/ChartViewCacheMapper.java new file mode 100644 index 0000000000..aec7c7da16 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/ChartViewCacheMapper.java @@ -0,0 +1,37 @@ +package io.dataease.base.mapper; + +import io.dataease.base.domain.ChartViewCache; +import io.dataease.base.domain.ChartViewCacheExample; +import io.dataease.base.domain.ChartViewCacheWithBLOBs; +import java.util.List; +import org.apache.ibatis.annotations.Param; + +public interface ChartViewCacheMapper { + long countByExample(ChartViewCacheExample example); + + int deleteByExample(ChartViewCacheExample example); + + int deleteByPrimaryKey(String id); + + int insert(ChartViewCacheWithBLOBs record); + + int insertSelective(ChartViewCacheWithBLOBs record); + + List selectByExampleWithBLOBs(ChartViewCacheExample example); + + List selectByExample(ChartViewCacheExample example); + + ChartViewCacheWithBLOBs selectByPrimaryKey(String id); + + int updateByExampleSelective(@Param("record") ChartViewCacheWithBLOBs record, @Param("example") ChartViewCacheExample example); + + int updateByExampleWithBLOBs(@Param("record") ChartViewCacheWithBLOBs record, @Param("example") ChartViewCacheExample example); + + int updateByExample(@Param("record") ChartViewCache record, @Param("example") ChartViewCacheExample example); + + int updateByPrimaryKeySelective(ChartViewCacheWithBLOBs record); + + int updateByPrimaryKeyWithBLOBs(ChartViewCacheWithBLOBs record); + + int updateByPrimaryKey(ChartViewCache record); +} \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/mapper/ChartViewCacheMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ChartViewCacheMapper.xml new file mode 100644 index 0000000000..caa9ebfbb4 --- /dev/null +++ b/backend/src/main/java/io/dataease/base/mapper/ChartViewCacheMapper.xml @@ -0,0 +1,621 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 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`, title, scene_id, table_id, `type`, render, result_count, result_mode, + create_by, create_time, update_time, style_priority, chart_type, is_plugin + + + x_axis, x_axis_ext, y_axis, y_axis_ext, ext_stack, ext_bubble, custom_attr, custom_style, + custom_filter, drill_fields, senior, snapshot + + + select + + distinct + + + , + + from chart_view_cache + + + + + order by ${orderByClause} + + + + select + + distinct + + + from chart_view_cache + + + + + order by ${orderByClause} + + + + select + + , + + from chart_view_cache + where id = #{id,jdbcType=VARCHAR} + + + delete from chart_view_cache + where id = #{id,jdbcType=VARCHAR} + + + delete from chart_view_cache + + + + + + insert into chart_view_cache (id, `name`, title, + scene_id, table_id, `type`, + render, result_count, result_mode, + create_by, create_time, update_time, + style_priority, chart_type, is_plugin, + x_axis, x_axis_ext, y_axis, + y_axis_ext, ext_stack, ext_bubble, + custom_attr, custom_style, custom_filter, + drill_fields, senior, snapshot + ) + values (#{id,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, #{title,jdbcType=VARCHAR}, + #{sceneId,jdbcType=VARCHAR}, #{tableId,jdbcType=VARCHAR}, #{type,jdbcType=VARCHAR}, + #{render,jdbcType=VARCHAR}, #{resultCount,jdbcType=INTEGER}, #{resultMode,jdbcType=VARCHAR}, + #{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateTime,jdbcType=BIGINT}, + #{stylePriority,jdbcType=VARCHAR}, #{chartType,jdbcType=VARCHAR}, #{isPlugin,jdbcType=BIT}, + #{xAxis,jdbcType=LONGVARCHAR}, #{xAxisExt,jdbcType=LONGVARCHAR}, #{yAxis,jdbcType=LONGVARCHAR}, + #{yAxisExt,jdbcType=LONGVARCHAR}, #{extStack,jdbcType=LONGVARCHAR}, #{extBubble,jdbcType=LONGVARCHAR}, + #{customAttr,jdbcType=LONGVARCHAR}, #{customStyle,jdbcType=LONGVARCHAR}, #{customFilter,jdbcType=LONGVARCHAR}, + #{drillFields,jdbcType=LONGVARCHAR}, #{senior,jdbcType=LONGVARCHAR}, #{snapshot,jdbcType=LONGVARCHAR} + ) + + + insert into chart_view_cache + + + id, + + + `name`, + + + title, + + + scene_id, + + + table_id, + + + `type`, + + + render, + + + result_count, + + + result_mode, + + + create_by, + + + create_time, + + + update_time, + + + style_priority, + + + chart_type, + + + is_plugin, + + + x_axis, + + + x_axis_ext, + + + y_axis, + + + y_axis_ext, + + + ext_stack, + + + ext_bubble, + + + custom_attr, + + + custom_style, + + + custom_filter, + + + drill_fields, + + + senior, + + + snapshot, + + + + + #{id,jdbcType=VARCHAR}, + + + #{name,jdbcType=VARCHAR}, + + + #{title,jdbcType=VARCHAR}, + + + #{sceneId,jdbcType=VARCHAR}, + + + #{tableId,jdbcType=VARCHAR}, + + + #{type,jdbcType=VARCHAR}, + + + #{render,jdbcType=VARCHAR}, + + + #{resultCount,jdbcType=INTEGER}, + + + #{resultMode,jdbcType=VARCHAR}, + + + #{createBy,jdbcType=VARCHAR}, + + + #{createTime,jdbcType=BIGINT}, + + + #{updateTime,jdbcType=BIGINT}, + + + #{stylePriority,jdbcType=VARCHAR}, + + + #{chartType,jdbcType=VARCHAR}, + + + #{isPlugin,jdbcType=BIT}, + + + #{xAxis,jdbcType=LONGVARCHAR}, + + + #{xAxisExt,jdbcType=LONGVARCHAR}, + + + #{yAxis,jdbcType=LONGVARCHAR}, + + + #{yAxisExt,jdbcType=LONGVARCHAR}, + + + #{extStack,jdbcType=LONGVARCHAR}, + + + #{extBubble,jdbcType=LONGVARCHAR}, + + + #{customAttr,jdbcType=LONGVARCHAR}, + + + #{customStyle,jdbcType=LONGVARCHAR}, + + + #{customFilter,jdbcType=LONGVARCHAR}, + + + #{drillFields,jdbcType=LONGVARCHAR}, + + + #{senior,jdbcType=LONGVARCHAR}, + + + #{snapshot,jdbcType=LONGVARCHAR}, + + + + + select count(*) from chart_view_cache + + + + + + update chart_view_cache + + + id = #{record.id,jdbcType=VARCHAR}, + + + `name` = #{record.name,jdbcType=VARCHAR}, + + + title = #{record.title,jdbcType=VARCHAR}, + + + scene_id = #{record.sceneId,jdbcType=VARCHAR}, + + + table_id = #{record.tableId,jdbcType=VARCHAR}, + + + `type` = #{record.type,jdbcType=VARCHAR}, + + + render = #{record.render,jdbcType=VARCHAR}, + + + result_count = #{record.resultCount,jdbcType=INTEGER}, + + + result_mode = #{record.resultMode,jdbcType=VARCHAR}, + + + create_by = #{record.createBy,jdbcType=VARCHAR}, + + + create_time = #{record.createTime,jdbcType=BIGINT}, + + + update_time = #{record.updateTime,jdbcType=BIGINT}, + + + style_priority = #{record.stylePriority,jdbcType=VARCHAR}, + + + chart_type = #{record.chartType,jdbcType=VARCHAR}, + + + is_plugin = #{record.isPlugin,jdbcType=BIT}, + + + x_axis = #{record.xAxis,jdbcType=LONGVARCHAR}, + + + x_axis_ext = #{record.xAxisExt,jdbcType=LONGVARCHAR}, + + + y_axis = #{record.yAxis,jdbcType=LONGVARCHAR}, + + + y_axis_ext = #{record.yAxisExt,jdbcType=LONGVARCHAR}, + + + ext_stack = #{record.extStack,jdbcType=LONGVARCHAR}, + + + ext_bubble = #{record.extBubble,jdbcType=LONGVARCHAR}, + + + custom_attr = #{record.customAttr,jdbcType=LONGVARCHAR}, + + + custom_style = #{record.customStyle,jdbcType=LONGVARCHAR}, + + + custom_filter = #{record.customFilter,jdbcType=LONGVARCHAR}, + + + drill_fields = #{record.drillFields,jdbcType=LONGVARCHAR}, + + + senior = #{record.senior,jdbcType=LONGVARCHAR}, + + + snapshot = #{record.snapshot,jdbcType=LONGVARCHAR}, + + + + + + + + update chart_view_cache + set id = #{record.id,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + title = #{record.title,jdbcType=VARCHAR}, + scene_id = #{record.sceneId,jdbcType=VARCHAR}, + table_id = #{record.tableId,jdbcType=VARCHAR}, + `type` = #{record.type,jdbcType=VARCHAR}, + render = #{record.render,jdbcType=VARCHAR}, + result_count = #{record.resultCount,jdbcType=INTEGER}, + result_mode = #{record.resultMode,jdbcType=VARCHAR}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + style_priority = #{record.stylePriority,jdbcType=VARCHAR}, + chart_type = #{record.chartType,jdbcType=VARCHAR}, + is_plugin = #{record.isPlugin,jdbcType=BIT}, + x_axis = #{record.xAxis,jdbcType=LONGVARCHAR}, + x_axis_ext = #{record.xAxisExt,jdbcType=LONGVARCHAR}, + y_axis = #{record.yAxis,jdbcType=LONGVARCHAR}, + y_axis_ext = #{record.yAxisExt,jdbcType=LONGVARCHAR}, + ext_stack = #{record.extStack,jdbcType=LONGVARCHAR}, + ext_bubble = #{record.extBubble,jdbcType=LONGVARCHAR}, + custom_attr = #{record.customAttr,jdbcType=LONGVARCHAR}, + custom_style = #{record.customStyle,jdbcType=LONGVARCHAR}, + custom_filter = #{record.customFilter,jdbcType=LONGVARCHAR}, + drill_fields = #{record.drillFields,jdbcType=LONGVARCHAR}, + senior = #{record.senior,jdbcType=LONGVARCHAR}, + snapshot = #{record.snapshot,jdbcType=LONGVARCHAR} + + + + + + update chart_view_cache + set id = #{record.id,jdbcType=VARCHAR}, + `name` = #{record.name,jdbcType=VARCHAR}, + title = #{record.title,jdbcType=VARCHAR}, + scene_id = #{record.sceneId,jdbcType=VARCHAR}, + table_id = #{record.tableId,jdbcType=VARCHAR}, + `type` = #{record.type,jdbcType=VARCHAR}, + render = #{record.render,jdbcType=VARCHAR}, + result_count = #{record.resultCount,jdbcType=INTEGER}, + result_mode = #{record.resultMode,jdbcType=VARCHAR}, + create_by = #{record.createBy,jdbcType=VARCHAR}, + create_time = #{record.createTime,jdbcType=BIGINT}, + update_time = #{record.updateTime,jdbcType=BIGINT}, + style_priority = #{record.stylePriority,jdbcType=VARCHAR}, + chart_type = #{record.chartType,jdbcType=VARCHAR}, + is_plugin = #{record.isPlugin,jdbcType=BIT} + + + + + + update chart_view_cache + + + `name` = #{name,jdbcType=VARCHAR}, + + + title = #{title,jdbcType=VARCHAR}, + + + scene_id = #{sceneId,jdbcType=VARCHAR}, + + + table_id = #{tableId,jdbcType=VARCHAR}, + + + `type` = #{type,jdbcType=VARCHAR}, + + + render = #{render,jdbcType=VARCHAR}, + + + result_count = #{resultCount,jdbcType=INTEGER}, + + + result_mode = #{resultMode,jdbcType=VARCHAR}, + + + create_by = #{createBy,jdbcType=VARCHAR}, + + + create_time = #{createTime,jdbcType=BIGINT}, + + + update_time = #{updateTime,jdbcType=BIGINT}, + + + style_priority = #{stylePriority,jdbcType=VARCHAR}, + + + chart_type = #{chartType,jdbcType=VARCHAR}, + + + is_plugin = #{isPlugin,jdbcType=BIT}, + + + x_axis = #{xAxis,jdbcType=LONGVARCHAR}, + + + x_axis_ext = #{xAxisExt,jdbcType=LONGVARCHAR}, + + + y_axis = #{yAxis,jdbcType=LONGVARCHAR}, + + + y_axis_ext = #{yAxisExt,jdbcType=LONGVARCHAR}, + + + ext_stack = #{extStack,jdbcType=LONGVARCHAR}, + + + ext_bubble = #{extBubble,jdbcType=LONGVARCHAR}, + + + custom_attr = #{customAttr,jdbcType=LONGVARCHAR}, + + + custom_style = #{customStyle,jdbcType=LONGVARCHAR}, + + + custom_filter = #{customFilter,jdbcType=LONGVARCHAR}, + + + drill_fields = #{drillFields,jdbcType=LONGVARCHAR}, + + + senior = #{senior,jdbcType=LONGVARCHAR}, + + + snapshot = #{snapshot,jdbcType=LONGVARCHAR}, + + + where id = #{id,jdbcType=VARCHAR} + + + update chart_view_cache + set `name` = #{name,jdbcType=VARCHAR}, + title = #{title,jdbcType=VARCHAR}, + scene_id = #{sceneId,jdbcType=VARCHAR}, + table_id = #{tableId,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + render = #{render,jdbcType=VARCHAR}, + result_count = #{resultCount,jdbcType=INTEGER}, + result_mode = #{resultMode,jdbcType=VARCHAR}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + style_priority = #{stylePriority,jdbcType=VARCHAR}, + chart_type = #{chartType,jdbcType=VARCHAR}, + is_plugin = #{isPlugin,jdbcType=BIT}, + x_axis = #{xAxis,jdbcType=LONGVARCHAR}, + x_axis_ext = #{xAxisExt,jdbcType=LONGVARCHAR}, + y_axis = #{yAxis,jdbcType=LONGVARCHAR}, + y_axis_ext = #{yAxisExt,jdbcType=LONGVARCHAR}, + ext_stack = #{extStack,jdbcType=LONGVARCHAR}, + ext_bubble = #{extBubble,jdbcType=LONGVARCHAR}, + custom_attr = #{customAttr,jdbcType=LONGVARCHAR}, + custom_style = #{customStyle,jdbcType=LONGVARCHAR}, + custom_filter = #{customFilter,jdbcType=LONGVARCHAR}, + drill_fields = #{drillFields,jdbcType=LONGVARCHAR}, + senior = #{senior,jdbcType=LONGVARCHAR}, + snapshot = #{snapshot,jdbcType=LONGVARCHAR} + where id = #{id,jdbcType=VARCHAR} + + + update chart_view_cache + set `name` = #{name,jdbcType=VARCHAR}, + title = #{title,jdbcType=VARCHAR}, + scene_id = #{sceneId,jdbcType=VARCHAR}, + table_id = #{tableId,jdbcType=VARCHAR}, + `type` = #{type,jdbcType=VARCHAR}, + render = #{render,jdbcType=VARCHAR}, + result_count = #{resultCount,jdbcType=INTEGER}, + result_mode = #{resultMode,jdbcType=VARCHAR}, + create_by = #{createBy,jdbcType=VARCHAR}, + create_time = #{createTime,jdbcType=BIGINT}, + update_time = #{updateTime,jdbcType=BIGINT}, + style_priority = #{stylePriority,jdbcType=VARCHAR}, + chart_type = #{chartType,jdbcType=VARCHAR}, + is_plugin = #{isPlugin,jdbcType=BIT} + where id = #{id,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java index fd3e2cb602..82667c44a0 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.java @@ -12,7 +12,7 @@ import java.util.List; public interface ExtChartViewMapper { List search(ChartViewRequest request); - ChartViewDTO searchOne(ChartViewRequest request); +// ChartViewDTO searchOne(ChartViewRequest request); void chartCopy(@Param("newChartId")String newChartId,@Param("oldChartId")String oldChartId,@Param("panelId")String panelId); @@ -25,9 +25,24 @@ public interface ExtChartViewMapper { ChartViewDTO searchOneWithPrivileges(@Param("userId") String userId,@Param("id") String id ); + ChartViewDTO searchOne(@Param("id") String id ); + void chartCopyWithPanel(@Param("copyId") String copyId); void deleteCircleView(@Param("pid") String pid); void deleteCircleGroup(@Param("pid") String pid); + + List searchViewsWithPanelId(@Param("panelId") String panelId); + + ChartViewDTO searchOneFromCache(@Param("id") String id ); + + void copyToCache(@Param("id") String id ); + + void deleteCacheWithPanel(@Param("panelId") String panelId ); + + void deleteViewCache(@Param("viewId") String viewId ); + + void copyCacheToView(@Param("viewIds") List viewIds ); + } diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml index 5f6f9680ee..36dd69100e 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml @@ -16,22 +16,95 @@ select - id, `name`, scene_id, table_id, `type`, title, create_by, create_time, update_time, - style_priority,x_axis, y_axis, custom_attr, custom_style, custom_filter, snapshot - from chart_view - - - and scene_id = #{sceneId,jdbcType=VARCHAR} - - - and id = #{id,jdbcType=VARCHAR} - - - - order by ${sort} - + chart_view.* + from chart_view where id = #{id} + + select + chart_view_cache.* + from chart_view_cache where id = #{id} + + + + INSERT INTO chart_view_cache ( + id, + `name`, + title, + scene_id, + table_id, + `type`, + render, + result_count, + result_mode, + create_by, + create_time, + update_time, + style_priority, + chart_type, + is_plugin, + x_axis, + x_axis_ext, + y_axis, + y_axis_ext, + ext_stack, + ext_bubble, + custom_attr, + custom_style, + custom_filter, + drill_fields, + senior, + SNAPSHOT + ) SELECT + id, + `name`, + title, + scene_id, + table_id, + `type`, + render, + result_count, + result_mode, + create_by, + create_time, + update_time, + style_priority, + chart_type, + is_plugin, + x_axis, + x_axis_ext, + y_axis, + y_axis_ext, + ext_stack, + ext_bubble, + custom_attr, + custom_style, + custom_filter, + drill_fields, + senior, + SNAPSHOT from chart_view + WHERE + chart_view.id = #{id} + + + + + + + + + + + + + + + + + + + + select id, `name`, scene_id, table_id, `type`, title, create_by, create_time, update_time, @@ -110,11 +183,11 @@ `chart_type`, `senior`) SELECT #{newChartId}, - GET_CHART_VIEW_COPY_NAME(#{oldChartId}), + `name`, #{panelId}, `table_id`, `type`, - GET_CHART_VIEW_COPY_NAME(#{oldChartId}), + `title`, `x_axis`, `x_axis_ext`, `y_axis`, @@ -135,7 +208,7 @@ `result_mode`, 'private', `senior` - FROM chart_view + FROM chart_view_cache WHERE id = #{oldChartId} @@ -261,4 +334,64 @@ cids ) + + + + SELECT * FROM chart_view + WHERE + id IN ( + SELECT + chart_view_id + FROM + panel_view + WHERE + panel_id = #{panelId} + ) + + + + DELETE cvc + FROM + chart_view_cache cvc + INNER JOIN panel_view pv ON cvc.id = pv.chart_view_id + WHERE + pv.panel_id = #{panelId} + + + delete from chart_view_cache where id = #{viewId} + + + + UPDATE chart_view cv, + chart_view_cache cve + SET cv.`name` = cve.`name`, + cv.title = cve.title, + cv.scene_id = cve.scene_id, + cv.table_id = cve.table_id, + cv.`type` = cve.`type`, + cv.render = cve.render, + cv.result_count = cve.result_count, + cv.result_mode = cve.result_mode, + cv.create_by = cve.create_by, + cv.create_time = cve.create_time, + cv.update_time = cve.update_time, + cv.style_priority = cve.style_priority, + cv.chart_type = cve.chart_type, + cv.is_plugin = cve.is_plugin, + cv.x_axis = cve.x_axis, + cv.x_axis_ext = cve.x_axis_ext, + cv.y_axis = cve.y_axis, + cv.y_axis_ext = cve.y_axis_ext, + cv.ext_stack = cve.ext_stack, + cv.ext_bubble = cve.ext_bubble, + cv.custom_attr = cve.custom_attr, + cv.custom_style = cve.custom_style, + cv.custom_filter = cve.custom_filter, + cv.drill_fields = cve.drill_fields, + cv.senior = cve.senior, + cv.SNAPSHOT = cve.SNAPSHOT where cve.id = cv.id and cv.id in + + #{viewId} + + diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetTableMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetTableMapper.java index bca5c5202b..5110460776 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetTableMapper.java +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetTableMapper.java @@ -2,6 +2,7 @@ package io.dataease.base.mapper.ext; import io.dataease.controller.request.dataset.DataSetTableRequest; import io.dataease.dto.dataset.DataSetTableDTO; +import org.apache.ibatis.annotations.Param; import java.util.List; @@ -10,4 +11,6 @@ public interface ExtDataSetTableMapper { DataSetTableDTO searchOne(DataSetTableRequest request); + List searchDataSetTableWithPanelId(@Param("panelId") String panelId, @Param("userId") String userId); + } diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetTableMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetTableMapper.xml index 91abf6daea..fe1bd89034 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetTableMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtDataSetTableMapper.xml @@ -100,4 +100,27 @@ ORDER BY CONVERT(`name` using gbk) + + + select + id, `name`, scene_id, data_source_id, `type`, `mode`,`info`, create_by, create_time, + get_auths(id,'dataset',#{userId}) as `privileges` + from dataset_table + where id in ( + SELECT + table_id + FROM + chart_view + WHERE + id IN ( + SELECT + chart_view_id + FROM + panel_view + WHERE + panel_id = #{panelId} + ) + ) + + diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java index a0ea1417e8..000f0fe2a3 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.java @@ -15,12 +15,16 @@ public interface ExtPanelGroupMapper { //会级联删除pid 下的所有数据 int deleteCircle(@Param("pid") String pid); + int deleteCircleView(@Param("pid") String pid); + + int deleteCircleViewCache(@Param("pid") String pid); + PanelGroupDTO findOneWithPrivileges(@Param("panelId") String panelId,@Param("userId") String userId); void copyPanelView(@Param("pid") String panelId); //移除未使用的视图 - void removeUselessViews(@Param("panelId") String panelId); + void removeUselessViews(@Param("panelId") String panelId,@Param("viewIds") List viewIds); List panelGroupInit(); diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml index 07d97f2935..cf0db400c8 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtPanelGroupMapper.xml @@ -171,6 +171,14 @@ delete from panel_group where FIND_IN_SET(panel_group.id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid})) or FIND_IN_SET(panel_group.source,GET_PANEL_GROUP_WITH_CHILDREN(#{pid})) + + delete from chart_view where FIND_IN_SET(chart_view.scene_id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid})) + + + + delete from chart_view_cache where FIND_IN_SET(chart_view_cache.scene_id,GET_PANEL_GROUP_WITH_CHILDREN(#{pid})) + + INSERT INTO panel_view ( id, panel_id, chart_view_id ) SELECT uuid(), @@ -189,14 +197,13 @@ WHERE chart_view.chart_type = 'private' AND chart_view.scene_id = #{panelId} - AND id NOT IN ( - SELECT - panel_view.chart_view_id - FROM - panel_view - WHERE - panel_view.panel_id = #{panelId} - ) + + AND id NOT IN + + #{viewId} + + + diff --git a/backend/src/main/java/io/dataease/commons/condition/RedisStatusCondition.java b/backend/src/main/java/io/dataease/commons/condition/RedisStatusCondition.java new file mode 100644 index 0000000000..ad23200b57 --- /dev/null +++ b/backend/src/main/java/io/dataease/commons/condition/RedisStatusCondition.java @@ -0,0 +1,23 @@ +package io.dataease.commons.condition; + +import io.dataease.commons.utils.CommonBeanFactory; +import org.apache.commons.lang3.StringUtils; +import org.springframework.context.annotation.Condition; +import org.springframework.context.annotation.ConditionContext; +import org.springframework.core.env.Environment; +import org.springframework.core.type.AnnotatedTypeMetadata; + +public class RedisStatusCondition implements Condition { + + private static final String DEFAULT_TYPE = "ehcache"; + private static final String TARGET_TYPE = "redis"; + private static final String TYPE_KEY = "spring.cache.type"; + + @Override + public boolean matches(ConditionContext context, AnnotatedTypeMetadata metadata) { + Environment environment = context.getEnvironment(); + String ehcacheType = environment.getProperty(TYPE_KEY, String.class, DEFAULT_TYPE); + + return StringUtils.equals(TARGET_TYPE, ehcacheType); + } +} diff --git a/backend/src/main/java/io/dataease/commons/constants/CommonConstants.java b/backend/src/main/java/io/dataease/commons/constants/CommonConstants.java index 2c16a2b72e..88c87e6db5 100644 --- a/backend/src/main/java/io/dataease/commons/constants/CommonConstants.java +++ b/backend/src/main/java/io/dataease/commons/constants/CommonConstants.java @@ -43,6 +43,10 @@ public class CommonConstants { // 仪表板 public static final String PANEL = "panel"; + + // 仪表板编辑 + public static final String PANEL_EDIT = "panel_edit"; + } //视图数据查询模式 @@ -54,4 +58,15 @@ public class CommonConstants { // 自定义 public static final String CUSTOM = "custom"; } + + //视图数据查询来源 + public static final class VIEW_EDIT_FROM { + + // 仪表板 + public static final String PANEL = "panel"; + + // 仪表板编辑 + public static final String CACHE = "cache"; + + } } diff --git a/backend/src/main/java/io/dataease/config/RedisConfig.java b/backend/src/main/java/io/dataease/config/RedisConfig.java new file mode 100644 index 0000000000..c3778545bc --- /dev/null +++ b/backend/src/main/java/io/dataease/config/RedisConfig.java @@ -0,0 +1,27 @@ +package io.dataease.config; + + +import io.dataease.commons.condition.RedisStatusCondition; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Conditional; +import org.springframework.context.annotation.Configuration; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; + + + +@Configuration +public class RedisConfig { + + @Conditional({RedisStatusCondition.class}) + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory factory) { + RedisTemplate redisTemplate = new RedisTemplate<>(); + redisTemplate.setConnectionFactory(factory); + Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer(Object.class); + redisTemplate.setDefaultSerializer(serializer); + return redisTemplate; + } + +} diff --git a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java index 8e0501338b..f6c2edeeb2 100644 --- a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java +++ b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java @@ -3,11 +3,13 @@ package io.dataease.controller.chart; import com.github.xiaoymin.knife4j.annotations.ApiSupport; import io.dataease.auth.annotation.DePermission; import io.dataease.auth.annotation.DePermissionProxy; +import io.dataease.base.domain.ChartViewCacheWithBLOBs; import io.dataease.base.domain.ChartViewWithBLOBs; import io.dataease.commons.constants.DePermissionType; import io.dataease.commons.constants.ResourceAuthLevel; import io.dataease.controller.request.chart.ChartCalRequest; import io.dataease.controller.request.chart.ChartExtRequest; +import io.dataease.controller.request.chart.ChartViewCacheRequest; import io.dataease.controller.request.chart.ChartViewRequest; import io.dataease.controller.response.ChartDetail; import io.dataease.dto.chart.ChartViewDTO; @@ -35,8 +37,22 @@ public class ChartViewController { @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE) @ApiOperation("保存") @PostMapping("/save/{panelId}") + public ChartViewDTO save(@PathVariable String panelId, @RequestBody ChartViewCacheRequest request) { + return chartViewService.save(request); + } + + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE) + @ApiOperation("新建视图") + @PostMapping("/newOne/{panelId}") public ChartViewWithBLOBs save(@PathVariable String panelId, @RequestBody ChartViewWithBLOBs chartViewWithBLOBs) { - return chartViewService.save(chartViewWithBLOBs); + return chartViewService.newOne(chartViewWithBLOBs); + } + + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE) + @ApiOperation("保存到缓存表") + @PostMapping("/save2Cache/{panelId}") + public void save2Cache(@PathVariable String panelId, @RequestBody ChartViewCacheWithBLOBs chartViewWithBLOBs) { + chartViewService.save2Cache(chartViewWithBLOBs); } @ApiIgnore @@ -56,8 +72,8 @@ public class ChartViewController { @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_VIEW, paramIndex = 1) @ApiOperation("详细信息") @PostMapping("/get/{id}/{panelId}") - public ChartViewWithBLOBs get(@PathVariable String id, @PathVariable String panelId) { - return chartViewService.get(id); + public ChartViewDTO get(@PathVariable String id, @PathVariable String panelId,@RequestBody ChartViewRequest viewRequest) { + return chartViewService.getOne(id,viewRequest.getQueryFrom()); } @ApiIgnore @@ -117,4 +133,20 @@ public class ChartViewController { throws Exception { return chartViewService.checkSameDataSet(viewIdSource, viewIdTarget); } + + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_VIEW) + @ApiOperation("初始化仪表板视图缓存") + @PostMapping("/initViewCache/{panelId}") + public void initViewCache(@PathVariable String panelId) { + chartViewService.initViewCache(panelId); + } + + + @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_VIEW, paramIndex = 1) + @ApiOperation("重置视图缓存") + @PostMapping("/resetViewCache/{id}/{panelId}") + public void resetViewCache(@PathVariable String id, @PathVariable String panelId) { + chartViewService.resetViewCache(id); + } + } diff --git a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java index 1c39bf4a55..39360d17aa 100644 --- a/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java +++ b/backend/src/main/java/io/dataease/controller/panel/PanelGroupController.java @@ -23,6 +23,7 @@ import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; +import java.util.Map; /** * Author: wangjiahao @@ -92,4 +93,11 @@ public class PanelGroupController { return panelGroupService.queryPanelViewTree(); } + @ApiOperation("仪表板组件信息") + @GetMapping("/queryPanelComponents/{id}") + @I18n + public Map queryPanelComponents(@PathVariable String id){ + return panelGroupService.queryPanelComponents(id); + } + } diff --git a/backend/src/main/java/io/dataease/controller/request/chart/ChartExtRequest.java b/backend/src/main/java/io/dataease/controller/request/chart/ChartExtRequest.java index 31e99d2b83..03ec1abeaa 100644 --- a/backend/src/main/java/io/dataease/controller/request/chart/ChartExtRequest.java +++ b/backend/src/main/java/io/dataease/controller/request/chart/ChartExtRequest.java @@ -42,4 +42,5 @@ public class ChartExtRequest { @ApiModelProperty(hidden = true) private PermissionProxy proxy; + } diff --git a/backend/src/main/java/io/dataease/controller/request/chart/ChartViewCacheRequest.java b/backend/src/main/java/io/dataease/controller/request/chart/ChartViewCacheRequest.java new file mode 100644 index 0000000000..0efccb0615 --- /dev/null +++ b/backend/src/main/java/io/dataease/controller/request/chart/ChartViewCacheRequest.java @@ -0,0 +1,15 @@ +package io.dataease.controller.request.chart; + +import io.dataease.base.domain.ChartViewCacheWithBLOBs; +import lombok.Data; + +/** + * Author: wangjiahao + * Date: 2022/3/10 + * Description: + */ +@Data +public class ChartViewCacheRequest extends ChartViewCacheWithBLOBs { + + private String savePosition = "cache"; +} diff --git a/backend/src/main/java/io/dataease/controller/request/chart/ChartViewRequest.java b/backend/src/main/java/io/dataease/controller/request/chart/ChartViewRequest.java index ad297454ff..c503157132 100644 --- a/backend/src/main/java/io/dataease/controller/request/chart/ChartViewRequest.java +++ b/backend/src/main/java/io/dataease/controller/request/chart/ChartViewRequest.java @@ -16,4 +16,8 @@ public class ChartViewRequest extends ChartViewWithBLOBs { private String sort; @ApiModelProperty("当前登陆用户ID") private String userId; + @ApiModelProperty("编辑来源") + private String editFrom; + @ApiModelProperty("查询来源") + private String queryFrom; } diff --git a/backend/src/main/java/io/dataease/dto/panel/PanelGroupDTO.java b/backend/src/main/java/io/dataease/dto/panel/PanelGroupDTO.java index efbe8a0525..e328b3fad6 100644 --- a/backend/src/main/java/io/dataease/dto/panel/PanelGroupDTO.java +++ b/backend/src/main/java/io/dataease/dto/panel/PanelGroupDTO.java @@ -2,11 +2,13 @@ package io.dataease.dto.panel; import io.dataease.base.domain.PanelGroupWithBLOBs; import io.dataease.commons.model.ITreeBase; +import io.dataease.dto.chart.ChartViewDTO; import io.swagger.annotations.ApiModelProperty; import lombok.Data; import java.util.ArrayList; import java.util.List; +import java.util.Map; /** * Author: wangjiahao @@ -31,6 +33,7 @@ public class PanelGroupDTO extends PanelGroupWithBLOBs implements ITreeBase children; - + @ApiModelProperty("视图信息") + private List> viewsInfo; } diff --git a/backend/src/main/java/io/dataease/listener/util/CacheUtils.java b/backend/src/main/java/io/dataease/listener/util/CacheUtils.java index 443a9dc3fd..913fa42bb4 100644 --- a/backend/src/main/java/io/dataease/listener/util/CacheUtils.java +++ b/backend/src/main/java/io/dataease/listener/util/CacheUtils.java @@ -1,30 +1,46 @@ package io.dataease.listener.util; +import io.dataease.commons.utils.CommonBeanFactory; import net.sf.ehcache.Cache; import net.sf.ehcache.Element; -import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.CacheManager; import org.springframework.cache.ehcache.EhCacheCacheManager; -import org.springframework.context.annotation.Configuration; -import java.util.Date; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.core.ValueOperations; + +import java.util.Date; +import java.util.concurrent.TimeUnit; -@Configuration public class CacheUtils { - private static CacheManager manager; + private static CacheManager cacheManager; - @Autowired - public void setManager(CacheManager manager) { - CacheUtils.manager = manager; + + private static CacheManager getCacheManager() { + if (cacheManager == null) + cacheManager = CommonBeanFactory.getBean(CacheManager.class); + return cacheManager; } public static Object get(String cacheName, Object key) { + if (getCacheManager() instanceof RedisCacheManager) { + org.springframework.cache.Cache cache = getCacheManager().getCache(cacheName); + if (null == cache) return null; + return cache.get(key); + } Element element = cache(cacheName).get(key); if (null == element) return null; return element.getObjectValue(); } public static void put(String cacheName, Object key, Object value, Integer ttl, Integer tti) { + if (getCacheManager() instanceof RedisCacheManager) { + RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate"); + ValueOperations valueOperations = redisTemplate.opsForValue(); + valueOperations.setIfPresent(cacheName + "::" + key , value ); + return; + } Element e = new Element(key, value); //不设置则使用xml配置 if (ttl != null) { @@ -33,19 +49,35 @@ public class CacheUtils { } if (tti != null) e.setTimeToIdle(tti); - cache(cacheName).put(e); + Cache cache = cache(cacheName); + if (null != cache) + cache.put(e); } public static boolean remove(String cacheName, Object key) { + if (getCacheManager() instanceof RedisCacheManager) { + org.springframework.cache.Cache cache = getCacheManager().getCache(cacheName); + if (null == cache) return false; + return cache.evictIfPresent(key); + } return cache(cacheName).remove(key); } public static void removeAll(String cacheName) { + if (getCacheManager() instanceof RedisCacheManager) { + org.springframework.cache.Cache cache = getCacheManager().getCache(cacheName); + if (null == cache) return; + cache.clear(); + return; + } cache(cacheName).removeAll(); } private static Cache cache(String cacheName) { - net.sf.ehcache.CacheManager cacheManager = ((EhCacheCacheManager) manager).getCacheManager(); + if (getCacheManager() instanceof RedisCacheManager) { + return null; + } + net.sf.ehcache.CacheManager cacheManager = ((EhCacheCacheManager) getCacheManager()).getCacheManager(); if (!cacheManager.cacheExists(cacheName)) cacheManager.addCache(cacheName); Cache cacheManagerCache = cacheManager.getCache(cacheName); @@ -57,6 +89,12 @@ public class CacheUtils { long exp = (time - System.currentTimeMillis()) / 1000; int intExp = (int)exp; removeAll("lic_info"); + if (getCacheManager() instanceof RedisCacheManager) { + RedisTemplate redisTemplate = (RedisTemplate) CommonBeanFactory.getBean("redisTemplate"); + ValueOperations valueOperations = redisTemplate.opsForValue(); + valueOperations.set("lic_info::lic", "lic", exp, TimeUnit.SECONDS); + return; + } put("lic_info", "lic", "lic", intExp, intExp); } } diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java index d5c70d5d4f..69778f5f6e 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -5,6 +5,7 @@ import com.google.gson.reflect.TypeToken; import io.dataease.auth.entity.SysUserEntity; import io.dataease.auth.service.AuthUserService; import io.dataease.base.domain.*; +import io.dataease.base.mapper.ChartViewCacheMapper; import io.dataease.base.mapper.ChartViewMapper; import io.dataease.base.mapper.ext.ExtChartGroupMapper; import io.dataease.base.mapper.ext.ExtChartViewMapper; @@ -37,6 +38,7 @@ import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; import javax.annotation.Resource; import java.math.BigDecimal; @@ -72,29 +74,70 @@ public class ChartViewService { private AuthUserService authUserService; @Resource private EngineService engineService; + @Resource + private ChartViewCacheMapper chartViewCacheMapper; //默认使用非公平 private ReentrantLock lock = new ReentrantLock(); - public ChartViewWithBLOBs save(ChartViewWithBLOBs chartView) { - checkName(chartView); + // 直接保存统一到缓存表 + public ChartViewDTO save(ChartViewCacheRequest chartView) { long timestamp = System.currentTimeMillis(); chartView.setUpdateTime(timestamp); - if (ObjectUtils.isEmpty(chartView.getId())) { - chartView.setId(UUID.randomUUID().toString()); - chartView.setCreateBy(AuthUtils.getUser().getUsername()); - chartView.setCreateTime(timestamp); - chartView.setUpdateTime(timestamp); - chartViewMapper.insertSelective(chartView); - } else { - chartViewMapper.updateByPrimaryKeySelective(chartView); - } + chartViewCacheMapper.updateByPrimaryKeySelective(chartView); Optional.ofNullable(chartView.getId()).ifPresent(id -> { CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id); }); - return getOneWithPermission(chartView.getId()); + return getOne(chartView.getId(),"panel_edit"); } + + public ChartViewWithBLOBs newOne(ChartViewWithBLOBs chartView) { + long timestamp = System.currentTimeMillis(); + chartView.setUpdateTime(timestamp); + chartView.setId(UUID.randomUUID().toString()); + chartView.setCreateBy(AuthUtils.getUser().getUsername()); + chartView.setCreateTime(timestamp); + chartView.setUpdateTime(timestamp); + chartViewMapper.insertSelective(chartView); + // 新建的视图也存入缓存表中 + extChartViewMapper.copyToCache(chartView.getId()); + + return chartView; + } + + + // 直接保存统一到缓存表 + public void save2Cache(ChartViewCacheWithBLOBs chartView) { + long timestamp = System.currentTimeMillis(); + chartView.setUpdateTime(timestamp); + chartViewCacheMapper.updateByPrimaryKeySelective(chartView); + Optional.ofNullable(chartView.getId()).ifPresent(id -> { + CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id); + }); + } + + +// // 直接保存统一到缓存表 +// public ChartViewWithBLOBs save(ChartViewRequest chartView) { +// checkName(chartView); +// long timestamp = System.currentTimeMillis(); +// chartView.setUpdateTime(timestamp); +// if (ObjectUtils.isEmpty(chartView.getId())) { +// chartView.setId(UUID.randomUUID().toString()); +// chartView.setCreateBy(AuthUtils.getUser().getUsername()); +// chartView.setCreateTime(timestamp); +// chartView.setUpdateTime(timestamp); +// chartViewMapper.insertSelective(chartView); +// } else { +// chartViewMapper.updateByPrimaryKeySelective(chartView); +// } +// Optional.ofNullable(chartView.getId()).ifPresent(id -> { +// CacheUtils.remove(JdbcConstants.VIEW_CACHE_KEY, id); +// }); +// return getOneWithPermission(chartView.getId()); +// } + public List list(ChartViewRequest chartViewRequest) { chartViewRequest.setUserId(String.valueOf(AuthUtils.getUser().getUserId())); return extChartViewMapper.search(chartViewRequest); @@ -179,6 +222,22 @@ public class ChartViewService { return extChartViewMapper.searchOneWithPrivileges(userId, id); } + @Transactional + public ChartViewDTO getOne(String id,String queryFrom){ + ChartViewDTO result; + //仪表板编辑页面 从缓存表中取数据 缓存表中没有数据则进行插入 + if(CommonConstants.VIEW_QUERY_FROM.PANEL_EDIT.equals(queryFrom)){ + result= extChartViewMapper.searchOneFromCache(id); + if(result == null){ + extChartViewMapper.copyToCache(id); + result = extChartViewMapper.searchOneFromCache(id); + } + }else{ + result = extChartViewMapper.searchOne(id); + } + return result; + } + public void delete(String id) { chartViewMapper.deleteByPrimaryKey(id); } @@ -190,7 +249,7 @@ public class ChartViewService { } public ChartViewDTO getData(String id, ChartExtRequest request) throws Exception { - ChartViewDTO view = this.getOneWithPermission(id); + ChartViewDTO view = this.getOne(id,request.getQueryFrom()); // 如果是从仪表板获取视图数据,则仪表板的查询模式,查询结果的数量,覆盖视图对应的属性 if (CommonConstants.VIEW_QUERY_FROM.PANEL.equals(request.getQueryFrom()) && CommonConstants.VIEW_RESULT_MODE.CUSTOM.equals(request.getResultMode())) { view.setResultMode(request.getResultMode()); @@ -1685,6 +1744,7 @@ public class ChartViewService { public String chartCopy(String id, String panelId) { String newChartId = UUID.randomUUID().toString(); extChartViewMapper.chartCopy(newChartId, id, panelId); + extChartViewMapper.copyToCache(newChartId); return newChartId; } @@ -1713,4 +1773,14 @@ public class ChartViewService { } } } + + public void initViewCache(String panelId){ + extChartViewMapper.deleteCacheWithPanel(panelId); + } + + public void resetViewCache (String viewId){ + extChartViewMapper.deleteViewCache(viewId); + + extChartViewMapper.copyToCache(viewId); + } } diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java index d117cf443d..64ade01908 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -51,7 +51,9 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; -import java.io.*; +import java.io.File; +import java.io.FileOutputStream; +import java.io.InputStream; import java.math.BigDecimal; import java.text.MessageFormat; import java.text.NumberFormat; @@ -1182,6 +1184,14 @@ public class DataSetTableService { DEException.throwException( Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId)); } + CurrentUserDto user = AuthUtils.getUser(); + if (user != null && !user.getIsAdmin()) { + DataSetTableDTO withPermission = getWithPermission(datasetTable.getId(), user.getUserId()); + if (ObjectUtils.isEmpty(withPermission.getPrivileges()) || !withPermission.getPrivileges().contains("use")) { + DEException.throwException( + Translator.get("i18n_dataset_no_permission") + String.format(":table name [%s]", withPermission.getName())); + } + } List fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField()); String[] array = fields.stream() @@ -1310,6 +1320,14 @@ public class DataSetTableService { DEException.throwException( Translator.get("i18n_custom_ds_delete") + String.format(":table id [%s]", tableId)); } + CurrentUserDto user = AuthUtils.getUser(); + if (user != null && !user.getIsAdmin()) { + DataSetTableDTO withPermission = getWithPermission(datasetTable.getId(), user.getUserId()); + if (ObjectUtils.isEmpty(withPermission.getPrivileges()) || !withPermission.getPrivileges().contains("use")) { + DEException.throwException( + Translator.get("i18n_dataset_no_permission") + String.format(":table name [%s]", withPermission.getName())); + } + } List fields = dataSetTableFieldsService.getListByIdsEach(unionDTO.getCurrentDsField()); String[] array = fields.stream() diff --git a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java index 81cfe76173..a53d283dd6 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java @@ -14,14 +14,17 @@ import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.TreeUtils; import io.dataease.controller.request.authModel.VAuthModelRequest; +import io.dataease.controller.request.dataset.DataSetTableRequest; import io.dataease.controller.request.panel.PanelGroupRequest; import io.dataease.dto.authModel.VAuthModelDTO; import io.dataease.dto.chart.ChartViewDTO; +import io.dataease.dto.dataset.DataSetTableDTO; import io.dataease.dto.panel.PanelGroupDTO; import io.dataease.dto.panel.linkJump.PanelLinkJumpBaseRequest; import io.dataease.exception.DataEaseException; import io.dataease.i18n.Translator; import io.dataease.service.chart.ChartViewService; +import io.dataease.service.dataset.DataSetTableService; import io.dataease.service.sys.SysAuthService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.StringUtils; @@ -33,10 +36,7 @@ import org.springframework.transaction.annotation.Transactional; import org.springframework.util.Assert; import javax.annotation.Resource; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.UUID; +import java.util.*; import java.util.stream.Collectors; /** @@ -81,6 +81,11 @@ public class PanelGroupService { private ExtPanelViewLinkageMapper extPanelViewLinkageMapper; @Resource private ExtChartViewMapper extChartViewMapper; + @Resource + private ExtDataSetTableMapper extDataSetTableMapper; + @Resource + private DataSetTableService dataSetTableService; + public List tree(PanelGroupRequest panelGroupRequest) { String userId = String.valueOf(AuthUtils.getUser().getUserId()); @@ -99,14 +104,11 @@ public class PanelGroupService { @DeCleaner(DePermissionType.PANEL) // @Transactional public PanelGroup saveOrUpdate(PanelGroupRequest request) { - try { - Boolean mobileLayout = panelViewService.syncPanelViews(request); - request.setMobileLayout(mobileLayout); - } catch (Exception e) { - e.printStackTrace(); - LOGGER.error("更新panelView出错panelId:{}", request.getId()); - } String panelId = request.getId(); + List viewIds = null; + if(StringUtils.isNotEmpty(panelId)){ + viewIds = panelViewService.syncPanelViews(request); + } if (StringUtils.isEmpty(panelId)) { // 新建 checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType()); @@ -164,7 +166,7 @@ public class PanelGroupService { } //移除没有用到的仪表板私有视图 - extPanelGroupMapper.removeUselessViews(panelId); + extPanelGroupMapper.removeUselessViews(panelId,viewIds); return panelGroupDTOList.get(0); } @@ -187,12 +189,18 @@ public class PanelGroupService { public void deleteCircle(String id) { Assert.notNull(id, "id cannot be null"); sysAuthService.checkTreeNoManageCount("panel", id); + + //清理view 和 view cache + extPanelGroupMapper.deleteCircleView(id); + extPanelGroupMapper.deleteCircleViewCache(id); + // 同时会删除对应默认仪表盘 extPanelGroupMapper.deleteCircle(id); storeService.removeByPanelId(id); shareService.delete(id, null); panelLinkService.deleteByResourceId(id); + //清理跳转信息 extPanelLinkJumpMapper.deleteJumpTargetViewInfoWithPanel(id); extPanelLinkJumpMapper.deleteJumpInfoWithPanel(id); @@ -341,4 +349,42 @@ public class PanelGroupService { LogUtil.info("=====v1.8版本 仪表板私有化【结束】====="); } + // 获取仪表板的视图信息 + public Map queryPanelComponents(String panelId) { + try { + Map result, tableWithFields, viewWithViewInfo, tableWithTableInfo; + //查找所有view + List views = extChartViewMapper.searchViewsWithPanelId(panelId); + viewWithViewInfo = views.stream().collect(Collectors.toMap(ChartViewDTO::getId, ChartViewDTO -> ChartViewDTO)); + //查找所有dataset + List tables = extDataSetTableMapper.searchDataSetTableWithPanelId(panelId, String.valueOf(AuthUtils.getUser().getUserId())); + tableWithTableInfo = tables.stream().collect(Collectors.toMap(DataSetTableDTO::getId, DataSetTableDTO -> DataSetTableDTO)); + //查找所有datasetFields + tableWithFields = new HashMap(); + if (CollectionUtils.isNotEmpty(tables)) { + for (DataSetTableDTO table : tables) { + DataSetTableRequest dataSetTableRequest = new DataSetTableRequest(); + dataSetTableRequest.setId(table.getId()); + Map> tableDataSetFields = dataSetTableService.getFieldsFromDE(dataSetTableRequest); + tableWithFields.put(table.getId(), tableDataSetFields); + } + } + + result = new HashMap(); + result.put("tableWithFields", tableWithFields); + result.put("viewWithViewInfo", viewWithViewInfo); + result.put("tableWithTableInfo", tableWithTableInfo); + return result; + } catch (Exception e) { + e.printStackTrace(); + LogUtil.error(e); + } + return null; + } + + public void findPanelAttachInfo(String panelId) { + + } + + } diff --git a/backend/src/main/java/io/dataease/service/panel/PanelViewService.java b/backend/src/main/java/io/dataease/service/panel/PanelViewService.java index 9351ddd953..ed54cc93c9 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelViewService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelViewService.java @@ -7,6 +7,7 @@ import io.dataease.base.domain.PanelGroupWithBLOBs; import io.dataease.base.domain.PanelView; import io.dataease.base.domain.PanelViewExample; import io.dataease.base.mapper.PanelViewMapper; +import io.dataease.base.mapper.ext.ExtChartViewMapper; import io.dataease.base.mapper.ext.ExtPanelViewMapper; import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.BeanUtils; @@ -39,6 +40,9 @@ public class PanelViewService { @Resource private PanelViewMapper panelViewMapper; + @Resource + private ExtChartViewMapper extChartViewMapper; + private final static String SCENE_TYPE = "scene"; public List groups() { @@ -80,7 +84,8 @@ public class PanelViewService { } @Transactional(propagation = Propagation.REQUIRES_NEW) - public Boolean syncPanelViews(PanelGroupWithBLOBs panelGroup) { + public List syncPanelViews(PanelGroupWithBLOBs panelGroup) { + List viewIds = new ArrayList<>(); Boolean mobileLayout = null; String panelId = panelGroup.getId(); Assert.notNull(panelId, "panelId cannot be null"); @@ -115,9 +120,14 @@ public class PanelViewService { extPanelViewMapper.deleteWithPanelId(panelId); if (CollectionUtils.isNotEmpty(panelViewInsertDTOList)) { extPanelViewMapper.savePanelView(panelViewInsertDTOList); + //将视图从cache表中更新到正式表中 + viewIds = panelViewInsertDTOList.stream().map(panelView ->panelView.getChartViewId()).collect(Collectors.toList()); + extChartViewMapper.copyCacheToView(viewIds); + extChartViewMapper.deleteCacheWithPanel(panelId); } } - return mobileLayout; + panelGroup.setMobileLayout(mobileLayout); + return viewIds; } public List detailList(String panelId) { diff --git a/backend/src/main/resources/application.properties b/backend/src/main/resources/application.properties index fdb33ea352..df130211f2 100644 --- a/backend/src/main/resources/application.properties +++ b/backend/src/main/resources/application.properties @@ -61,13 +61,14 @@ quartz.scheduler-name=deServerJob spring.servlet.multipart.max-file-size=500MB spring.servlet.multipart.max-request-size=500MB # actuator -management.server.port=8083 -management.endpoints.web.exposure.include=* +management.health.redis.enabled=false +#management.server.port=8083 +#management.endpoints.web.exposure.include=* #spring.freemarker.checkTemplateLocation=false #RSA非对称加密参数:私钥 rsa.private_key=MIIBUwIBADANBgkqhkiG9w0BAQEFAASCAT0wggE5AgEAAkEA0vfvyTdGJkdbHkB8mp0f3FE0GYP3AYPaJF7jUd1M0XxFSE2ceK3k2kw20YvQ09NJKk+OMjWQl9WitG9pB6tSCQIDAQABAkA2SimBrWC2/wvauBuYqjCFwLvYiRYqZKThUS3MZlebXJiLB+Ue/gUifAAKIg1avttUZsHBHrop4qfJCwAI0+YRAiEA+W3NK/RaXtnRqmoUUkb59zsZUBLpvZgQPfj1MhyHDz0CIQDYhsAhPJ3mgS64NbUZmGWuuNKp5coY2GIj/zYDMJp6vQIgUueLFXv/eZ1ekgz2Oi67MNCk5jeTF2BurZqNLR3MSmUCIFT3Q6uHMtsB9Eha4u7hS31tj1UWE+D+ADzp59MGnoftAiBeHT7gDMuqeJHPL4b+kC+gzV4FGTfhR9q3tTbklZkD2A== rsa.public_key=MFwwDQYJKoZIhvcNAQEBBQADSwAwSAJBANL378k3RiZHWx5AfJqdH9xRNBmD9wGD2iRe41HdTNF8RUhNnHit5NpMNtGL0NPTSSpPjjI1kJfVorRvaQerUgkCAwEAAQ== -spring.cache.type=ehcache +#spring.cache.type=ehcache spring.cache.ehcache.config=classpath:/ehcache/ehcache.xml #打印URL路径 #logging.level.org.springframework.web=trace @@ -85,6 +86,32 @@ server.compression.enabled=true server.compression.mime-types=application/javascript,text/css,application/json,application/xml,text/html,text/xml,text/plain server.compression.min-response-size=1024 +#下面的配置新增到/opt/dataease/conf/dataease/properties +#缓存类型 +##spring.cache.type=redis +#spring.cache.type=ehcache +#redis公共配置 +#spring.redis.timeout=10000 +#spring.redis.lettuce.pool.max-active=8 +#spring.redis.lettuce.pool.max-wait=-1 +#spring.redis.lettuce.pool.max-idle=8 + +#单机模式redis配置 +#spring.redis.database=0 +#spring.redis.host=192.168.0.110 +#spring.redis.port=6379 +#spring.redis.password=DataEase_ZNB@REDIS + +#哨兵模式redis配置 +#spring.redis.sentinel.master=mymaster +#spring.redis.sentinel.nodes=192.168.0.110:26379,192.168.0.110:26380,192.168.0.110:26381 +#spring.redis.sentinel.password= + +#cluster模式redis配置 +#spring.redis.cluster.nodes=192.168.0.110:7001,192.168.0.110:7002,192.168.0.110:7003,192.168.0.110:7004,192.168.0.110:7005,192.168.0.110:7006 +#spring.redis.cluster.max-redirects=3 +#spring.redis.password=DataEase_ZNB@REDIS + diff --git a/backend/src/main/resources/db/migration/V33__1.9.sql b/backend/src/main/resources/db/migration/V33__1.9.sql index d182498b0b..7694874363 100644 --- a/backend/src/main/resources/db/migration/V33__1.9.sql +++ b/backend/src/main/resources/db/migration/V33__1.9.sql @@ -1,2 +1,35 @@ ALTER TABLE `chart_view` ADD COLUMN `senior` LONGTEXT COMMENT '高级' AFTER `drill_fields`; UPDATE `chart_view` SET `senior` = '{}'; + +CREATE TABLE `chart_view_cache` ( + `id` varchar(50) NOT NULL COMMENT 'ID', + `name` varchar(1024) DEFAULT NULL COMMENT '名称', + `title` varchar(1024) DEFAULT NULL COMMENT 'EChart标题', + `scene_id` varchar(50) NOT NULL COMMENT '场景ID chart_type为private的时候 是仪表板id', + `table_id` varchar(50) NOT NULL COMMENT '数据集表ID', + `type` varchar(50) DEFAULT NULL COMMENT '图表类型', + `render` varchar(50) DEFAULT NULL COMMENT '视图渲染方式', + `result_count` int(10) DEFAULT NULL COMMENT '展示结果', + `result_mode` varchar(50) DEFAULT NULL COMMENT '展示模式', + `x_axis` longtext COMMENT '横轴field', + `x_axis_ext` longtext COMMENT 'table-row', + `y_axis` longtext COMMENT '纵轴field', + `y_axis_ext` longtext COMMENT '副轴', + `ext_stack` longtext COMMENT '堆叠项', + `ext_bubble` longtext COMMENT '气泡大小', + `custom_attr` longtext COMMENT '图形属性', + `custom_style` longtext COMMENT '组件样式', + `custom_filter` longtext COMMENT '结果过滤', + `drill_fields` longtext COMMENT '钻取字段', + `senior` longtext COMMENT '高级', + `create_by` varchar(50) DEFAULT NULL COMMENT '创建人ID', + `create_time` bigint(13) DEFAULT NULL COMMENT '创建时间', + `update_time` bigint(13) DEFAULT NULL COMMENT '更新时间', + `snapshot` longtext COMMENT '缩略图 ', + `style_priority` varchar(255) DEFAULT 'panel' COMMENT '样式优先级 panel 仪表板 view 视图', + `chart_type` varchar(255) DEFAULT 'private' COMMENT '视图类型 public 公共 历史可复用的视图,private 私有 专属某个仪表板', + `is_plugin` bit(1) DEFAULT NULL COMMENT '是否插件', + PRIMARY KEY (`id`) +) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4; + +SET FOREIGN_KEY_CHECKS = 1; diff --git a/backend/src/main/resources/generatorConfig.xml b/backend/src/main/resources/generatorConfig.xml index ad83d89780..d5256f1916 100644 --- a/backend/src/main/resources/generatorConfig.xml +++ b/backend/src/main/resources/generatorConfig.xml @@ -63,5 +63,6 @@ + diff --git a/frontend/pom.xml b/frontend/pom.xml index 1ca3d3227d..99ccea975c 100644 --- a/frontend/pom.xml +++ b/frontend/pom.xml @@ -6,7 +6,7 @@ dataease-server io.dataease - 1.8.0 + 1.9.0 4.0.0 diff --git a/frontend/src/api/chart/chart.js b/frontend/src/api/chart/chart.js index 5d9a956c7e..ef96c7f3e5 100644 --- a/frontend/src/api/chart/chart.js +++ b/frontend/src/api/chart/chart.js @@ -1,10 +1,12 @@ import request from '@/utils/request' +import store from '@/store' +import { queryPanelComponents } from '@/api/panel/panel' export function post(url, data) { return request({ url: url, method: 'post', - loading: true, + loading: false, data }) } @@ -13,7 +15,7 @@ export function getChartTree(data) { return request({ url: 'api', method: 'post', - loading: true, + loading: false, data }) } @@ -38,7 +40,7 @@ export function searchAdviceSceneId(panelId) { return request({ url: '/chart/view/searchAdviceSceneId/' + panelId, method: 'get', - loading: true + loading: false }) } @@ -54,7 +56,7 @@ export function ajaxGetDataOnly(id, panelId, data) { return request({ url: '/chart/view/getData/' + id + '/' + panelId, method: 'post', - loading: true, + loading: false, hideMsg: true, data }) @@ -75,3 +77,34 @@ export function deleteCircle(id) { }) } +export function getChartDetails(id, panelId, data) { + return request({ + url: '/chart/view/get/' + id + '/' + panelId, + method: 'post', + loading: false, + data + }) +} + +export function save2Cache(panelId, data) { + return request({ + url: '/chart/view/save2Cache/' + panelId, + method: 'post', + loading: false, + data + }) +} + +export function resetViewCacheCallBack(viewId, panelId, callback) { + // 加载仪表板组件视图数据 + resetViewCache(viewId, panelId).then(rep => { + callback(rep) + }) +} +export function resetViewCache(viewId, panelId) { + return request({ + url: '/chart/view/resetViewCache/' + viewId + '/' + panelId, + method: 'post', + loading: false + }) +} diff --git a/frontend/src/api/panel/panel.js b/frontend/src/api/panel/panel.js index 0cb50e64af..17f555d3c5 100644 --- a/frontend/src/api/panel/panel.js +++ b/frontend/src/api/panel/panel.js @@ -164,3 +164,28 @@ export function queryPanelViewTree() { }) } +export function initPanelComponentsData(panelId, callback) { + // 加载仪表板组件视图数据 + queryPanelComponents(panelId).then(rep => { + store.commit('initPanelComponents', rep.data) + callback(rep) + }) +} + +export function queryPanelComponents(id) { + return request({ + url: 'panel/group/queryPanelComponents/' + id, + method: 'get', + loading: false + }) +} + +export function initViewCache(panelId) { + // 初始化仪表板视图缓存 + return request({ + url: 'chart/view/initViewCache/' + panelId, + method: 'post', + loading: false + }) +} + diff --git a/frontend/src/components/DeDrag/index.vue b/frontend/src/components/DeDrag/index.vue index 115965c69e..20cb6b3100 100644 --- a/frontend/src/components/DeDrag/index.vue +++ b/frontend/src/components/DeDrag/index.vue @@ -531,7 +531,7 @@ export default { width: this.computedMainSlotWidth, height: this.computedMainSlotHeight } - if (this.element.commonBackground && this.element.commonBackground.enable) { + if (this.element.commonBackground&&this.element.commonBackground.enable) { if (this.element.commonBackground.backgroundType === 'innerImage') { style['background'] = `url(${this.element.commonBackground.innerImage}) no-repeat` } else if (this.element.commonBackground.backgroundType === 'outerImage') { diff --git a/frontend/src/components/canvas/components/Editor/EditBar.vue b/frontend/src/components/canvas/components/Editor/EditBar.vue index d3fd3226f3..d13c4f6910 100644 --- a/frontend/src/components/canvas/components/Editor/EditBar.vue +++ b/frontend/src/components/canvas/components/Editor/EditBar.vue @@ -184,22 +184,25 @@ export default { // resize this.$emit('resizeView') }, + // edit() { + // // 编辑时临时保存 当前修改的画布 + // this.$store.dispatch('panel/setComponentDataTemp', JSON.stringify(this.componentData)) + // this.$store.dispatch('panel/setCanvasStyleDataTemp', JSON.stringify(this.canvasStyleData)) + // if (this.curComponent.type === 'view') { + // this.$store.dispatch('chart/setViewId', null) + // this.$store.dispatch('chart/setViewId', this.curComponent.propValue.viewId) + // bus.$emit('PanelSwitchComponent', { name: 'ChartEdit', param: { 'id': this.curComponent.propValue.viewId, 'optType': 'edit' }}) + // } + // if (this.curComponent.type === 'custom') { + // bus.$emit('component-dialog-edit') + // } + // // 编辑样式组件 + // if (this.curComponent.type === 'v-text' || this.curComponent.type === 'rect-shape') { + // bus.$emit('component-dialog-style') + // } + // }, edit() { - // 编辑时临时保存 当前修改的画布 - this.$store.dispatch('panel/setComponentDataTemp', JSON.stringify(this.componentData)) - this.$store.dispatch('panel/setCanvasStyleDataTemp', JSON.stringify(this.canvasStyleData)) - if (this.curComponent.type === 'view') { - this.$store.dispatch('chart/setViewId', null) - this.$store.dispatch('chart/setViewId', this.curComponent.propValue.viewId) - bus.$emit('PanelSwitchComponent', { name: 'ChartEdit', param: { 'id': this.curComponent.propValue.viewId, 'optType': 'edit' }}) - } - if (this.curComponent.type === 'custom') { - bus.$emit('component-dialog-edit') - } - // 编辑样式组件 - if (this.curComponent.type === 'v-text' || this.curComponent.type === 'rect-shape') { - bus.$emit('component-dialog-style') - } + bus.$emit('change_panel_right_draw', true) }, linkageEdit() { diff --git a/frontend/src/components/canvas/components/Editor/SettingMenu.vue b/frontend/src/components/canvas/components/Editor/SettingMenu.vue index 2c55a62779..c08b8b260c 100644 --- a/frontend/src/components/canvas/components/Editor/SettingMenu.vue +++ b/frontend/src/components/canvas/components/Editor/SettingMenu.vue @@ -46,23 +46,24 @@ export default { ]), methods: { edit() { - // 编辑时临时保存 当前修改的画布 - this.$store.dispatch('panel/setComponentDataTemp', JSON.stringify(this.componentData)) - this.$store.dispatch('panel/setCanvasStyleDataTemp', JSON.stringify(this.canvasStyleData)) - if (this.curComponent.type === 'view') { - this.$store.dispatch('chart/setViewId', null) - this.$store.dispatch('chart/setViewId', this.curComponent.propValue.viewId) - bus.$emit('PanelSwitchComponent', { name: 'ChartEdit', param: { 'id': this.curComponent.propValue.viewId, 'optType': 'edit' }}) - } - if (this.curComponent.type === 'custom') { - bus.$emit('component-dialog-edit') - } - - // 编辑样式组件 - - if (this.curComponent.type === 'v-text' || this.curComponent.type === 'rect-shape') { - bus.$emit('component-dialog-style') - } + bus.$emit('change_panel_right_draw', true) + // // 编辑时临时保存 当前修改的画布 + // this.$store.dispatch('panel/setComponentDataTemp', JSON.stringify(this.componentData)) + // this.$store.dispatch('panel/setCanvasStyleDataTemp', JSON.stringify(this.canvasStyleData)) + // if (this.curComponent.type === 'view') { + // this.$store.dispatch('chart/setViewId', null) + // this.$store.dispatch('chart/setViewId', this.curComponent.propValue.viewId) + // bus.$emit('PanelSwitchComponent', { name: 'ChartEdit', param: { 'id': this.curComponent.propValue.viewId, 'optType': 'edit' }}) + // } + // if (this.curComponent.type === 'custom') { + // bus.$emit('component-dialog-edit') + // } + // + // // 编辑样式组件 + // + // if (this.curComponent.type === 'v-text' || this.curComponent.type === 'rect-shape') { + // bus.$emit('component-dialog-style') + // } }, lock() { this.$store.commit('lock') diff --git a/frontend/src/components/canvas/components/Editor/index.vue b/frontend/src/components/canvas/components/Editor/index.vue index cd97d64708..62ca0c7aa8 100644 --- a/frontend/src/components/canvas/components/Editor/index.vue +++ b/frontend/src/components/canvas/components/Editor/index.vue @@ -57,6 +57,7 @@ @linkJumpSet="linkJumpSet(item)" @boardSet="boardSet(item)" @canvasDragging="canvasDragging" + @editComponent="editComponent(index,item)" > + @@ -90,9 +91,10 @@ import EditBarView from '@/components/canvas/components/Editor/EditBarView' import { customAttrTrans, customStyleTrans, recursionTransObj } from '@/components/canvas/utils/style' import ChartComponentS2 from '@/views/chart/components/ChartComponentS2' import PluginCom from '@/views/system/plugin/PluginCom' +import LabelNormalText from '@/views/chart/components/normal/LabelNormalText' export default { name: 'UserView', - components: { PluginCom, ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 }, + components: { LabelNormalText, PluginCom, ChartComponentS2, EditBarView, ChartComponent, TableNormal, LabelNormal, DrillPath, ChartComponentG2 }, props: { element: { type: Object, @@ -184,13 +186,13 @@ export default { return this.active && this.inTab && !this.mobileLayoutStatus }, charViewShowFlag() { - return this.httpRequest.status && this.chart.type && !this.chart.type.includes('table') && !this.chart.type.includes('text') && this.renderComponent() === 'echarts' + return this.httpRequest.status && this.chart.type && !this.chart.type.includes('table') && !this.chart.type.includes('text') && this.chart.type !== 'label' && this.renderComponent() === 'echarts' }, charViewG2ShowFlag() { - return this.httpRequest.status && this.chart.type && !this.chart.type.includes('table') && !this.chart.type.includes('text') && this.renderComponent() === 'antv' + return this.httpRequest.status && this.chart.type && !this.chart.type.includes('table') && !this.chart.type.includes('text') && this.chart.type !== 'label' && this.renderComponent() === 'antv' }, charViewS2ShowFlag() { - return this.httpRequest.status && this.chart.type && this.chart.type.includes('table') && !this.chart.type.includes('text') && this.renderComponent() === 'antv' + return this.httpRequest.status && this.chart.type && this.chart.type.includes('table') && !this.chart.type.includes('text') && this.chart.type !== 'label' && this.renderComponent() === 'antv' }, tableShowFlag() { return this.httpRequest.status && this.chart.type && this.chart.type.includes('table') && this.renderComponent() === 'echarts' @@ -198,6 +200,9 @@ export default { labelShowFlag() { return this.httpRequest.status && this.chart.type && this.chart.type.includes('text') }, + labelTextShowFlag() { + return this.httpRequest.status && this.chart.type && this.chart.type === 'label' + }, loadingFlag() { return (this.canvasStyleData.refreshViewLoading || this.searchCount === 0) && this.requestStatus === 'waiting' }, @@ -372,6 +377,9 @@ export default { bus.$on('plugin-add-view-track-filter', param => { param.viewId && param.viewId === this.element.propValue.viewId && this.addViewTrackFilter(param) }) + bus.$on('view-in-cache', param => { + param.viewId && param.viewId === this.element.propValue.viewId && this.getDataEdit(param) + }) }, addViewTrackFilter(linkageParam) { @@ -431,7 +439,8 @@ export default { } const requestInfo = { ...this.filter, - cache: cache + cache: cache, + queryFrom: this.isEdit ? 'panel_edit' : 'panel' } if (this.panelInfo.proxy) { // method = viewInfo @@ -711,6 +720,19 @@ export default { renderComponent() { return this.chart.render + }, + getDataEdit(param) { + this.$store.state.styleChangeTimes++ + if (param.type === 'propChange') { + this.getData(param.viewId, false) + } else if (param.type === 'styleChange') { + this.chart.customAttr = param.viewInfo.customAttr + this.chart.customStyle = param.viewInfo.customStyle + this.chart.senior = param.viewInfo.senior + this.sourceCustomAttrStr = this.chart.customAttr + this.sourceCustomStyleStr = this.chart.customStyle + this.mergeScale() + } } } } diff --git a/frontend/src/icons/svg/label.svg b/frontend/src/icons/svg/label.svg new file mode 100644 index 0000000000..227ed39c51 --- /dev/null +++ b/frontend/src/icons/svg/label.svg @@ -0,0 +1,2 @@ + + diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 77b002b1c6..7c403d74cd 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -1031,6 +1031,7 @@ export default { table_align_left: 'Left', table_align_center: 'Center', table_align_right: 'Right', + draw_back: 'Draw Back', senior: 'Senior', senior_cfg: 'Senior Config', function_cfg: 'Function Config', @@ -1042,7 +1043,23 @@ export default { field_fixed: 'Fixed', line_type_dotted: 'Dotted', value_can_not_empty: 'Value can not be empty', - value_error: 'Value illegal' + value_error: 'Value illegal', + threshold: 'Threshold', + threshold_range: 'Range', + gauge_threshold_format_error: 'Format Error', + total_cfg: 'Total Config', + col_cfg: 'Column', + row_cfg: 'Row', + total_show: 'Total', + total_position: 'Position', + total_label: 'Alias', + sub_total_show: 'Sub Total', + total_pos_top: 'Top', + total_pos_bottom: 'Bottom', + total_pos_left: 'Left', + total_pos_right: 'Right', + chart_label: 'Label', + drag_block_label: 'Label' }, dataset: { sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default', @@ -1591,7 +1608,8 @@ export default { uninstall_confirm: 'Comfirm to uninstall the plugin?', uninstall_cancel: 'Cancel uninstall plugin', setting_background: 'BackGround', - setting_jump: 'Jump Setting' + setting_jump: 'Jump Setting', + select_view: 'Select View' }, display: { logo: 'Head system logo', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index 1877ab88a2..733a11340a 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -1031,6 +1031,7 @@ export default { table_align_left: '左對齊', table_align_center: '居中', table_align_right: '右對齊', + draw_back: '收回', senior: '高級', senior_cfg: '高級設置', function_cfg: '功能設置', @@ -1042,7 +1043,23 @@ export default { field_fixed: '固定值', line_type_dotted: '點', value_can_not_empty: '值不能為空', - value_error: '值必須為數值' + value_error: '值必須為數值', + threshold: '閾值', + threshold_range: '閾值區間', + gauge_threshold_format_error: '格式錯誤', + total_cfg: '總計配置', + col_cfg: '列匯總', + row_cfg: '行匯總', + total_show: '總計', + total_position: '位置', + total_label: '別名', + sub_total_show: '小計', + total_pos_top: '頂部', + total_pos_bottom: '底部', + total_pos_left: '左側', + total_pos_right: '右側', + chart_label: '文本卡', + drag_block_label: '標簽' }, dataset: { sheet_warn: '有多個 Sheet 頁,默認抽取第一個', @@ -1577,7 +1594,8 @@ export default { choose_background: '选择组件背景', choose_background_tips: '组件自有的背景设置会覆盖当前设置', setting_background: '设置背景', - setting_jump: '跳转设置' + setting_jump: '跳转设置', + select_view: '请选择视图...' }, plugin: { local_install: '本地安裝', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 49d97b0777..d0cbf18779 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -1034,6 +1034,7 @@ export default { table_align_left: '左对齐', table_align_center: '居中', table_align_right: '右对齐', + draw_back: '收回', senior: '高级', senior_cfg: '高级设置', function_cfg: '功能设置', @@ -1045,7 +1046,23 @@ export default { field_fixed: '固定值', line_type_dotted: '点', value_can_not_empty: '值不能为空', - value_error: '值必须为数值' + value_error: '值必须为数值', + threshold: '阈值', + threshold_range: '阈值区间', + gauge_threshold_format_error: '格式错误', + total_cfg: '总计配置', + col_cfg: '列汇总', + row_cfg: '行汇总', + total_show: '总计', + total_position: '位置', + total_label: '别名', + sub_total_show: '小计', + total_pos_top: '顶部', + total_pos_bottom: '底部', + total_pos_left: '左侧', + total_pos_right: '右侧', + chart_label: '文本卡', + drag_block_label: '标签' }, dataset: { sheet_warn: '有多个 Sheet 页,默认抽取第一个', @@ -1586,7 +1603,8 @@ export default { choose_background: '选择组件背景', choose_background_tips: '组件自有的背景设置会覆盖当前设置', setting_background: '设置背景', - setting_jump: '跳转设置' + setting_jump: '跳转设置', + select_view: '请选择视图...' }, plugin: { local_install: '本地安装', diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js index 55d58a53b2..1e416ae701 100644 --- a/frontend/src/store/index.js +++ b/frontend/src/store/index.js @@ -99,7 +99,9 @@ const data = { x: 300, y: 600 }, - scrollAutoMove: 0 + scrollAutoMove: 0, + // 视图是否编辑记录 + panelViewEditInfo: {} }, mutations: { ...animation.mutations, @@ -392,6 +394,17 @@ const data = { }, setScrollAutoMove(state, offset) { state.scrollAutoMove = offset + }, + initPanelComponents(state, panelComponents) { + if (panelComponents) { + state.canvasStyleData['panelComponents'] = panelComponents + } + }, + recordViewEdit(state, viewInfo) { + state.panelViewEditInfo[viewInfo.viewId] = viewInfo.hasEdit + }, + resetViewEditInfo(state) { + state.panelViewEditInfo = {} } }, modules: { diff --git a/frontend/src/views/chart/chart/bar/bar.js b/frontend/src/views/chart/chart/bar/bar.js index b55d9a9ed3..aee859135f 100644 --- a/frontend/src/views/chart/chart/bar/bar.js +++ b/frontend/src/views/chart/chart/bar/bar.js @@ -25,7 +25,7 @@ export function baseBarOption(chart_option, chart) { const y = chart.data.series[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { @@ -88,7 +88,7 @@ export function horizontalBarOption(chart_option, chart) { const y = chart.data.series[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { diff --git a/frontend/src/views/chart/chart/chart.js b/frontend/src/views/chart/chart/chart.js index d7d62bcdee..5da618a310 100644 --- a/frontend/src/views/chart/chart/chart.js +++ b/frontend/src/views/chart/chart/chart.js @@ -78,6 +78,38 @@ export const DEFAULT_TOOLTIP = { }, formatter: '' } +export const DEFAULT_TOTAL = { + row: { + showGrandTotals: true, + showSubTotals: true, + reverseLayout: false, + reverseSubLayout: false, + label: '总计', + subLabel: '小计', + subTotalsDimensions: [], + calcTotals: { + aggregation: 'SUM' + }, + calcSubTotals: { + aggregation: 'SUM' + } + }, + col: { + showGrandTotals: true, + showSubTotals: true, + reverseLayout: false, + reverseSubLayout: false, + label: '总计', + subLabel: '小计', + subTotalsDimensions: [], + calcTotals: { + aggregation: 'SUM' + }, + calcSubTotals: { + aggregation: 'SUM' + } + } +} export const DEFAULT_TITLE_STYLE = { show: true, fontSize: '18', @@ -244,6 +276,9 @@ export const DEFAULT_FUNCTION_CFG = { sliderShow: false, sliderRange: [0, 10] } +export const DEFAULT_THRESHOLD = { + gaugeThreshold: '' +} // chart config export const BASE_BAR = { title: { diff --git a/frontend/src/views/chart/chart/common/common_table.js b/frontend/src/views/chart/chart/common/common_table.js index 4ffed26eeb..23f1a32b73 100644 --- a/frontend/src/views/chart/chart/common/common_table.js +++ b/frontend/src/views/chart/chart/common/common_table.js @@ -77,6 +77,11 @@ export function getCustomTheme(chart) { fill: DEFAULT_COLOR_CASE.tableFontColor, fontSize: DEFAULT_SIZE.tableItemFontSize, textAlign: itemAlign + }, + bolderText: { + fill: DEFAULT_COLOR_CASE.tableFontColor, + fontSize: DEFAULT_SIZE.tableItemFontSize, + textAlign: itemAlign } } } @@ -114,6 +119,7 @@ export function getCustomTheme(chart) { theme.dataCell.cell.backgroundColor = i_c theme.dataCell.cell.horizontalBorderColor = b_c theme.dataCell.cell.verticalBorderColor = b_c + theme.dataCell.bolderText.fill = c.tableFontColor theme.dataCell.text.fill = c.tableFontColor } // size @@ -137,6 +143,8 @@ export function getCustomTheme(chart) { theme.colCell.text.fontSize = parseInt(s.tableTitleFontSize) theme.colCell.text.textAlign = h_a + theme.dataCell.bolderText.fontSize = parseInt(s.tableItemFontSize) + theme.dataCell.bolderText.textAlign = i_a theme.dataCell.text.fontSize = parseInt(s.tableItemFontSize) theme.dataCell.text.textAlign = i_a } diff --git a/frontend/src/views/chart/chart/funnel/funnel.js b/frontend/src/views/chart/chart/funnel/funnel.js index 522016ecfe..16f699d2b7 100644 --- a/frontend/src/views/chart/chart/funnel/funnel.js +++ b/frontend/src/views/chart/chart/funnel/funnel.js @@ -40,7 +40,7 @@ export function baseFunnelOption(chart_option, chart) { y.name = chart.data.x[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // y.type = 'funnel' chart_option.series[0].data.push(y) diff --git a/frontend/src/views/chart/chart/gauge/gauge.js b/frontend/src/views/chart/chart/gauge/gauge.js index 616d0b8561..71c6a1814c 100644 --- a/frontend/src/views/chart/chart/gauge/gauge.js +++ b/frontend/src/views/chart/chart/gauge/gauge.js @@ -1,5 +1,6 @@ import { componentStyle } from '../common/common' import { hexColorToRGBA } from '@/views/chart/chart/util' +import { DEFAULT_THRESHOLD } from '@/views/chart/chart/chart' export function baseGaugeOption(chart_option, chart) { // 处理shape attr @@ -49,6 +50,57 @@ export function baseGaugeOption(chart_option, chart) { value: chart.data.series[0].data[0] } chart_option.series[0].data.push(y) + // threshold + if (chart.senior) { + const range = [] + let index = 0 + let flag = false + const senior = JSON.parse(chart.senior) + const threshold = JSON.parse(JSON.stringify(senior.threshold ? senior.threshold : DEFAULT_THRESHOLD)) + if (threshold.gaugeThreshold && threshold.gaugeThreshold !== '') { + const arr = threshold.gaugeThreshold.split(',') + const per = parseFloat(chart.data.series[0].data[0]) / parseFloat(chart_option.series[0].max) + for (let i = 0; i < arr.length; i++) { + const ele = arr[i] + const p = parseInt(ele) / 100 + range.push([p, hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha)]) + if (!flag && per <= p) { + flag = true + index = i + } + } + if (!flag) { + index = arr.length + } + + range.push([1, hexColorToRGBA(customAttr.color.colors[arr.length % customAttr.color.colors.length], customAttr.color.alpha)]) + chart_option.series[0].axisLine = { + lineStyle: { + color: range + } + } + + chart_option.series[0].itemStyle = { + color: hexColorToRGBA(customAttr.color.colors[index], customAttr.color.alpha) + } + chart_option.series[0].progress = { + show: false + } + chart_option.series[0].axisTick = { + lineStyle: { + color: 'auto' + } + } + chart_option.series[0].splitLine = { + lineStyle: { + color: 'auto' + } + } + chart_option.series[0].axisLabel = { + color: 'auto' + } + } + } } } // console.log(chart_option); diff --git a/frontend/src/views/chart/chart/gauge/gauge_antv.js b/frontend/src/views/chart/chart/gauge/gauge_antv.js index 1fe0979e30..82cd5071d7 100644 --- a/frontend/src/views/chart/chart/gauge/gauge_antv.js +++ b/frontend/src/views/chart/chart/gauge/gauge_antv.js @@ -1,6 +1,6 @@ import { getPadding, getTheme } from '@/views/chart/chart/common/common_antv' import { Gauge } from '@antv/g2plot' -import { DEFAULT_SIZE } from '@/views/chart/chart/chart' +import { DEFAULT_SIZE, DEFAULT_THRESHOLD } from '@/views/chart/chart/chart' export function baseGaugeOptionAntV(plot, container, chart, action) { let max, labelContent, startAngel, endAngel @@ -33,11 +33,39 @@ export function baseGaugeOptionAntV(plot, container, chart, action) { labelContent = false } } + const per = (parseFloat(data) / parseFloat(max)) + + const range = [0] + let index = 0 + let flag = false + let hasThreshold = false + + if (chart.senior) { + const senior = JSON.parse(chart.senior) + const threshold = JSON.parse(JSON.stringify(senior.threshold ? senior.threshold : DEFAULT_THRESHOLD)) + if (threshold.gaugeThreshold && threshold.gaugeThreshold !== '') { + hasThreshold = true + const arr = threshold.gaugeThreshold.split(',') + for (let i = 0; i < arr.length; i++) { + const ele = arr[i] + const p = parseInt(ele) / 100 + range.push(p) + if (!flag && per <= p) { + flag = true + index = i + } + } + if (!flag) { + index = arr.length + } + } + } + range.push(1) // options const options = { theme: theme, - percent: (parseFloat(data) / parseFloat(max)), + percent: per, startAngle: startAngel, endAngle: endAngel, appendPadding: getPadding(chart), @@ -52,6 +80,24 @@ export function baseGaugeOptionAntV(plot, container, chart, action) { // lineCap: 'round' // } } + if (hasThreshold) { + options.range = { + color: theme.styleSheet.paletteQualitative10, + ticks: range + } + options.indicator = { + pointer: { + style: { + stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length] + } + }, + pin: { + style: { + stroke: theme.styleSheet.paletteQualitative10[index % theme.styleSheet.paletteQualitative10.length] + } + } + } + } // 开始渲染 if (plot) { diff --git a/frontend/src/views/chart/chart/line/line.js b/frontend/src/views/chart/chart/line/line.js index 2ef2ea59ba..faf0f5fb88 100644 --- a/frontend/src/views/chart/chart/line/line.js +++ b/frontend/src/views/chart/chart/line/line.js @@ -25,7 +25,7 @@ export function baseLineOption(chart_option, chart) { const y = chart.data.series[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { diff --git a/frontend/src/views/chart/chart/map/map.js b/frontend/src/views/chart/chart/map/map.js index aee4192f28..27ec15676d 100644 --- a/frontend/src/views/chart/chart/map/map.js +++ b/frontend/src/views/chart/chart/map/map.js @@ -73,7 +73,7 @@ export function baseMapOption(chart_option, chart) { y.name = chart.data.x[i] // color // y.itemStyle = { - // color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), + // color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha), // borderRadius: 0 // } chart_option.series[0].data.push(y) diff --git a/frontend/src/views/chart/chart/mix/mix.js b/frontend/src/views/chart/chart/mix/mix.js index bad33d3181..3380996cb4 100644 --- a/frontend/src/views/chart/chart/mix/mix.js +++ b/frontend/src/views/chart/chart/mix/mix.js @@ -27,7 +27,7 @@ export function baseMixOption(chart_option, chart) { y.type = y.type ? y.type : 'bar' // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { diff --git a/frontend/src/views/chart/chart/mix/mix_antv.js b/frontend/src/views/chart/chart/mix/mix_antv.js index c361008d3b..8298d79b5c 100644 --- a/frontend/src/views/chart/chart/mix/mix_antv.js +++ b/frontend/src/views/chart/chart/mix/mix_antv.js @@ -43,7 +43,7 @@ export function baseMixOptionAntV(plot, container, chart, action) { const o = { type: '', options: { - color: colors[i % 9], + color: colors[i % colors.length], data: d.data, xField: 'field', yField: 'value', diff --git a/frontend/src/views/chart/chart/pie/pie.js b/frontend/src/views/chart/chart/pie/pie.js index d2afdd159d..e7622d8dda 100644 --- a/frontend/src/views/chart/chart/pie/pie.js +++ b/frontend/src/views/chart/chart/pie/pie.js @@ -41,7 +41,7 @@ export function basePieOption(chart_option, chart) { y.name = chart.data.x[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha), borderRadius: 0 } y.type = 'pie' @@ -94,7 +94,7 @@ export function rosePieOption(chart_option, chart) { y.name = chart.data.x[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha), + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha), borderRadius: customAttr.size.pieRoseRadius } y.type = 'pie' diff --git a/frontend/src/views/chart/chart/radar/radar.js b/frontend/src/views/chart/chart/radar/radar.js index d2b582981c..0de2f39d7c 100644 --- a/frontend/src/views/chart/chart/radar/radar.js +++ b/frontend/src/views/chart/chart/radar/radar.js @@ -33,7 +33,7 @@ export function baseRadarOption(chart_option, chart) { } // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // label if (customAttr.label) { diff --git a/frontend/src/views/chart/chart/scatter/scatter.js b/frontend/src/views/chart/chart/scatter/scatter.js index 9e2924368a..d6f1a88a95 100644 --- a/frontend/src/views/chart/chart/scatter/scatter.js +++ b/frontend/src/views/chart/chart/scatter/scatter.js @@ -30,7 +30,7 @@ export function baseScatterOption(chart_option, chart, terminal = 'pc') { const y = chart.data.series[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // size if (customAttr.size) { diff --git a/frontend/src/views/chart/chart/table/table-info.js b/frontend/src/views/chart/chart/table/table-info.js index dd6b000952..d3e4f9ec90 100644 --- a/frontend/src/views/chart/chart/table/table-info.js +++ b/frontend/src/views/chart/chart/table/table-info.js @@ -1,5 +1,6 @@ import { TableSheet, S2Event, PivotSheet } from '@antv/s2' import { getCustomTheme, getSize } from '@/views/chart/chart/common/common_table' +import { DEFAULT_TOTAL } from '@/views/chart/chart/chart' export function baseTableInfo(s2, container, chart, action, tableData) { const containerDom = document.getElementById(container) @@ -281,11 +282,31 @@ export function baseTablePivot(s2, container, chart, action, tableData) { data: tableData } + // total config + let totalCfg = {} + const chartObj = JSON.parse(JSON.stringify(chart)) + if (chartObj.customAttr) { + let customAttr = null + if (Object.prototype.toString.call(chartObj.customAttr) === '[object Object]') { + customAttr = JSON.parse(JSON.stringify(chartObj.customAttr)) + } else { + customAttr = JSON.parse(chartObj.customAttr) + } + if (customAttr.totalCfg) { + totalCfg = customAttr.totalCfg + } else { + totalCfg = JSON.parse(JSON.stringify(DEFAULT_TOTAL)) + } + } + totalCfg.row.subTotalsDimensions = r + totalCfg.col.subTotalsDimensions = c + // options const s2Options = { width: containerDom.offsetWidth, height: containerDom.offsetHeight, - style: getSize(chart) + style: getSize(chart), + totals: totalCfg } // 开始渲染 diff --git a/frontend/src/views/chart/chart/treemap/treemap.js b/frontend/src/views/chart/chart/treemap/treemap.js index 4db4572bea..6c6befa083 100644 --- a/frontend/src/views/chart/chart/treemap/treemap.js +++ b/frontend/src/views/chart/chart/treemap/treemap.js @@ -49,7 +49,7 @@ export function baseTreemapOption(chart_option, chart) { y.name = chart.data.x[i] // color y.itemStyle = { - color: hexColorToRGBA(customAttr.color.colors[i % 9], customAttr.color.alpha) + color: hexColorToRGBA(customAttr.color.colors[i % customAttr.color.colors.length], customAttr.color.alpha) } // y.type = 'treemap' chart_option.series[0].data.push(y) diff --git a/frontend/src/views/chart/chart/util.js b/frontend/src/views/chart/chart/util.js index 4991c2a24b..e97b22ee84 100644 --- a/frontend/src/views/chart/chart/util.js +++ b/frontend/src/views/chart/chart/util.js @@ -50,6 +50,13 @@ export const TYPE_CONFIGS = [ icon: 'table-pivot' }, + { + render: 'antv', + category: 'chart.chart_type_quota', + value: 'label', + title: 'chart.chart_label', + icon: 'label' + }, { render: 'antv', category: 'chart.chart_type_quota', @@ -189,6 +196,13 @@ export const TYPE_CONFIGS = [ icon: 'table-info' }, + { + render: 'echarts', + category: 'chart.chart_type_quota', + value: 'label', + title: 'chart.chart_label', + icon: 'label' + }, { render: 'echarts', category: 'chart.chart_type_quota', diff --git a/frontend/src/views/chart/components/normal/LabelNormalText.vue b/frontend/src/views/chart/components/normal/LabelNormalText.vue new file mode 100644 index 0000000000..cd4eb3e6d1 --- /dev/null +++ b/frontend/src/views/chart/components/normal/LabelNormalText.vue @@ -0,0 +1,180 @@ + + + {{ chart.title }} + + + + {{ chart.data.datas[0].name }} + + + + + + + + + + + + + + + diff --git a/frontend/src/views/chart/components/senior/FunctionCfg.vue b/frontend/src/views/chart/components/senior/FunctionCfg.vue index 242b66233a..d99773d66d 100644 --- a/frontend/src/views/chart/components/senior/FunctionCfg.vue +++ b/frontend/src/views/chart/components/senior/FunctionCfg.vue @@ -6,7 +6,7 @@ {{ $t('chart.show') }} - + diff --git a/frontend/src/views/chart/components/senior/Threshold.vue b/frontend/src/views/chart/components/senior/Threshold.vue new file mode 100644 index 0000000000..ad764e3a2e --- /dev/null +++ b/frontend/src/views/chart/components/senior/Threshold.vue @@ -0,0 +1,123 @@ + + + + + + 0, + + ,100 + + + 阈值设置,决定仪表盘区间颜色,为空则不开启阈值,范围(0-100),仅限整数,且逐级递增 + + 例如:输入 30,70;表示:分为3段,分别为[0,30],(30,70],(70,100] + + + + + + + + + + + + diff --git a/frontend/src/views/chart/components/senior/dialog/AssistLineEdit.vue b/frontend/src/views/chart/components/senior/dialog/AssistLineEdit.vue index 27b0449355..f249d3b5d3 100644 --- a/frontend/src/views/chart/components/senior/dialog/AssistLineEdit.vue +++ b/frontend/src/views/chart/components/senior/dialog/AssistLineEdit.vue @@ -58,7 +58,7 @@ export default { name: '辅助线', field: '0', // 固定值 axis: 'y', // 主轴 - value: 0, + value: '0', lineType: 'solid', color: '#ff0000' }, @@ -81,7 +81,7 @@ export default { this.lineArr = JSON.parse(JSON.stringify(this.line)) }, addLine() { - this.lineArr.push(this.lineObj) + this.lineArr.push(JSON.parse(JSON.stringify(this.lineObj))) this.changeAssistLine() }, removeLine(index) { diff --git a/frontend/src/views/chart/components/shape-attr/ColorSelector.vue b/frontend/src/views/chart/components/shape-attr/ColorSelector.vue index eaf684e362..e90d82139e 100644 --- a/frontend/src/views/chart/components/shape-attr/ColorSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/ColorSelector.vue @@ -3,7 +3,7 @@ - + - + @@ -71,7 +71,7 @@ - + diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue index 0a96d990d7..7b9dfafa57 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue @@ -127,21 +127,21 @@ - + - + {{ $t('chart.show') }} - + - + diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue index ebe711e1c2..8138e1105b 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue @@ -153,21 +153,21 @@ - + - + {{ $t('chart.show') }} - + - + diff --git a/frontend/src/views/chart/components/shape-attr/TotalCfg.vue b/frontend/src/views/chart/components/shape-attr/TotalCfg.vue new file mode 100644 index 0000000000..48e577833b --- /dev/null +++ b/frontend/src/views/chart/components/shape-attr/TotalCfg.vue @@ -0,0 +1,182 @@ + + + + + {{ $t('chart.row_cfg') }} + + {{ $t('chart.show') }} + + + + + {{ $t('chart.total_pos_top') }} + {{ $t('chart.total_pos_bottom') }} + + + + + + + + + {{ $t('chart.show') }} + + + + + {{ $t('chart.total_pos_top') }} + {{ $t('chart.total_pos_bottom') }} + + + + + + + + {{ $t('chart.col_cfg') }} + + {{ $t('chart.show') }} + + + + + {{ $t('chart.total_pos_left') }} + {{ $t('chart.total_pos_right') }} + + + + + + + + + {{ $t('chart.show') }} + + + + + {{ $t('chart.total_pos_left') }} + {{ $t('chart.total_pos_right') }} + + + + + + + + + + + + + + diff --git a/frontend/src/views/chart/group/Group.vue b/frontend/src/views/chart/group/Group.vue index 613c4d3e61..688f711a6a 100644 --- a/frontend/src/views/chart/group/Group.vue +++ b/frontend/src/views/chart/group/Group.vue @@ -309,7 +309,9 @@ import { DEFAULT_YAXIS_EXT_STYLE, DEFAULT_BACKGROUND_COLOR, DEFAULT_SPLIT, - DEFAULT_FUNCTION_CFG + DEFAULT_FUNCTION_CFG, + DEFAULT_THRESHOLD, + DEFAULT_TOTAL } from '../chart/chart' export default { @@ -754,7 +756,8 @@ export default { tableColor: DEFAULT_COLOR_CASE, size: DEFAULT_SIZE, label: DEFAULT_LABEL, - tooltip: DEFAULT_TOOLTIP + tooltip: DEFAULT_TOOLTIP, + totalCfg: DEFAULT_TOTAL }) view.customStyle = JSON.stringify({ text: DEFAULT_TITLE_STYLE, @@ -767,7 +770,8 @@ export default { }) view.senior = JSON.stringify({ functionCfg: DEFAULT_FUNCTION_CFG, - assistLine: [] + assistLine: [], + threshold: DEFAULT_THRESHOLD }) view.stylePriority = 'view' // 默认样式优先级视图 view.xaxis = JSON.stringify([]) @@ -780,7 +784,7 @@ export default { view.extBubble = JSON.stringify([]) this.setChartDefaultOptions(view) const _this = this - post('/chart/view/save/' + this.panelInfo.id, view).then(response => { + post('/chart/view/newOne/' + this.panelInfo.id, view).then(response => { this.closeCreateChart() this.$store.dispatch('chart/setTableId', null) this.$store.dispatch('chart/setTableId', this.table.id) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 146713344b..a853736e20 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1,7 +1,10 @@ - + + + + + - {{ view.name }} - + + {{ view.name }} - - {{ $t('chart.close') }} - - + + + + {{ $t('chart.recover') }} - - {{ $t('commons.save') }} - + + + - + - + - + @@ -218,7 +227,11 @@ - + @@ -298,6 +311,7 @@ {{ $t('chart.area') }} {{ $t('chart.drag_block_treemap_label') }} {{ $t('chart.drag_block_word_cloud_label') }} + {{ $t('chart.drag_block_label') }} / {{ $t('chart.dimension') }} - + {{ $t('chart.drag_block_table_data_column') }} {{ $t('chart.chart_data') }} {{ $t('chart.drag_block_treemap_size') }} {{ $t('chart.drag_block_value_axis_main') }} - {{ $t('chart.drag_block_progress') }} + {{ $t('chart.drag_block_progress') }} {{ $t('chart.drag_block_word_cloud_size') }} / {{ $t('chart.quota') }} @@ -462,7 +478,11 @@ - + {{ $t('chart.bubble_size') }} / @@ -536,7 +556,7 @@ @@ -578,7 +598,7 @@ - + @@ -657,7 +677,7 @@ /> @@ -676,6 +696,18 @@ @onTooltipChange="onTooltipChange" /> + + + @@ -778,7 +810,7 @@ /> @@ -810,14 +842,14 @@ - + - + {{ $t('chart.senior_cfg') }} @@ -825,12 +857,15 @@ - + {{ $t('chart.analyse_cfg') }} - + + + + @@ -841,7 +876,7 @@ - + +
{{ chart.title }}
+ {{ chart.data.datas[0].name }} +