提交 f4ee879c authored 作者: taojinlong's avatar taojinlong

Merge branch 'dev' into pr@dev@impala

package io.dataease.base.domain;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
public class ChartView implements Serializable {
@ApiModelProperty("ID")
private String id;
@ApiModelProperty("名称")
private String name;
@ApiModelProperty("数据集ID")
private String title;
private String sceneId;
private String tableId;
@ApiModelProperty("图表类型")
private String type;
@ApiModelProperty("渲染方式")
private String render;
@ApiModelProperty("展示结果数量")
private Integer resultCount;
@ApiModelProperty("展示结果")
private String resultMode;
@ApiModelProperty("标题")
private String title;
@ApiModelProperty("场景ID")
private String sceneId;
@ApiModelProperty("创建人")
private String createBy;
@ApiModelProperty("创建时间")
private Long createTime;
@ApiModelProperty("更新时间")
private Long updateTime;
@ApiModelProperty("样式优先级")
private String stylePriority;
@ApiModelProperty("public or private")
private String chartType;
@ApiModelProperty("是否插件")
private Boolean isPlugin;
private String dataFrom;
private static final long serialVersionUID = 1L;
}
}
\ No newline at end of file
......@@ -35,5 +35,7 @@ public class ChartViewCache implements Serializable {
private Boolean isPlugin;
private String dataFrom;
private static final long serialVersionUID = 1L;
}
\ No newline at end of file
......@@ -1113,6 +1113,76 @@ public class ChartViewCacheExample {
addCriterion("is_plugin not between", value1, value2, "isPlugin");
return (Criteria) this;
}
public Criteria andDataFromIsNull() {
addCriterion("data_from is null");
return (Criteria) this;
}
public Criteria andDataFromIsNotNull() {
addCriterion("data_from is not null");
return (Criteria) this;
}
public Criteria andDataFromEqualTo(String value) {
addCriterion("data_from =", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromNotEqualTo(String value) {
addCriterion("data_from <>", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromGreaterThan(String value) {
addCriterion("data_from >", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromGreaterThanOrEqualTo(String value) {
addCriterion("data_from >=", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromLessThan(String value) {
addCriterion("data_from <", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromLessThanOrEqualTo(String value) {
addCriterion("data_from <=", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromLike(String value) {
addCriterion("data_from like", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromNotLike(String value) {
addCriterion("data_from not like", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromIn(List<String> values) {
addCriterion("data_from in", values, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromNotIn(List<String> values) {
addCriterion("data_from not in", values, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromBetween(String value1, String value2) {
addCriterion("data_from between", value1, value2, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromNotBetween(String value1, String value2) {
addCriterion("data_from not between", value1, value2, "dataFrom");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
package io.dataease.base.domain;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
......@@ -11,30 +9,29 @@ import lombok.ToString;
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class ChartViewWithBLOBs extends ChartView implements Serializable {
@ApiModelProperty("x轴")
private String xAxis;
@ApiModelProperty("x副轴")
private String xAxisExt;
@ApiModelProperty("y轴")
private String yAxis;
@ApiModelProperty("y副轴")
private String yAxisExt;
@ApiModelProperty("堆叠字段")
private String extStack;
@ApiModelProperty("气泡大小字段")
private String extBubble;
@ApiModelProperty("图形属性")
private String customAttr;
@ApiModelProperty("组件样式")
private String customStyle;
@ApiModelProperty("过滤器字段")
private String customFilter;
@ApiModelProperty("下钻字段")
private String drillFields;
@ApiModelProperty("高级设置")
private String senior;
@ApiModelProperty("视图截图快照")
private String snapshot;
private static final long serialVersionUID = 1L;
}
}
\ No newline at end of file
......@@ -29,8 +29,6 @@ public class PanelView implements Serializable {
private String copyId;
private String dataFrom;
private byte[] content;
private static final long serialVersionUID = 1L;
......
......@@ -923,76 +923,6 @@ public class PanelViewExample {
addCriterion("copy_id not between", value1, value2, "copyId");
return (Criteria) this;
}
public Criteria andDataFromIsNull() {
addCriterion("data_from is null");
return (Criteria) this;
}
public Criteria andDataFromIsNotNull() {
addCriterion("data_from is not null");
return (Criteria) this;
}
public Criteria andDataFromEqualTo(String value) {
addCriterion("data_from =", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromNotEqualTo(String value) {
addCriterion("data_from <>", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromGreaterThan(String value) {
addCriterion("data_from >", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromGreaterThanOrEqualTo(String value) {
addCriterion("data_from >=", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromLessThan(String value) {
addCriterion("data_from <", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromLessThanOrEqualTo(String value) {
addCriterion("data_from <=", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromLike(String value) {
addCriterion("data_from like", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromNotLike(String value) {
addCriterion("data_from not like", value, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromIn(List<String> values) {
addCriterion("data_from in", values, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromNotIn(List<String> values) {
addCriterion("data_from not in", values, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromBetween(String value1, String value2) {
addCriterion("data_from between", value1, value2, "dataFrom");
return (Criteria) this;
}
public Criteria andDataFromNotBetween(String value1, String value2) {
addCriterion("data_from not between", value1, value2, "dataFrom");
return (Criteria) this;
}
}
public static class Criteria extends GeneratedCriteria {
......
......@@ -17,6 +17,7 @@
<result column="style_priority" jdbcType="VARCHAR" property="stylePriority" />
<result column="chart_type" jdbcType="VARCHAR" property="chartType" />
<result column="is_plugin" jdbcType="BIT" property="isPlugin" />
<result column="data_from" jdbcType="VARCHAR" property="dataFrom" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.ChartViewCacheWithBLOBs">
<result column="x_axis" jdbcType="LONGVARCHAR" property="xAxis" />
......@@ -92,7 +93,7 @@
</sql>
<sql id="Base_Column_List">
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
create_by, create_time, update_time, style_priority, chart_type, is_plugin, data_from
</sql>
<sql id="Blob_Column_List">
x_axis, x_axis_ext, y_axis, y_axis_ext, ext_stack, ext_bubble, custom_attr, custom_style,
......@@ -152,21 +153,21 @@
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
)
data_from, 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}
)
#{dataFrom,jdbcType=VARCHAR}, #{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>
<insert id="insertSelective" parameterType="io.dataease.base.domain.ChartViewCacheWithBLOBs">
insert into chart_view_cache
......@@ -216,6 +217,9 @@
<if test="isPlugin != null">
is_plugin,
</if>
<if test="dataFrom != null">
data_from,
</if>
<if test="xAxis != null">
x_axis,
</if>
......@@ -299,6 +303,9 @@
<if test="isPlugin != null">
#{isPlugin,jdbcType=BIT},
</if>
<if test="dataFrom != null">
#{dataFrom,jdbcType=VARCHAR},
</if>
<if test="xAxis != null">
#{xAxis,jdbcType=LONGVARCHAR},
</if>
......@@ -391,6 +398,9 @@
<if test="record.isPlugin != null">
is_plugin = #{record.isPlugin,jdbcType=BIT},
</if>
<if test="record.dataFrom != null">
data_from = #{record.dataFrom,jdbcType=VARCHAR},
</if>
<if test="record.xAxis != null">
x_axis = #{record.xAxis,jdbcType=LONGVARCHAR},
</if>
......@@ -449,6 +459,7 @@
style_priority = #{record.stylePriority,jdbcType=VARCHAR},
chart_type = #{record.chartType,jdbcType=VARCHAR},
is_plugin = #{record.isPlugin,jdbcType=BIT},
data_from = #{record.dataFrom,jdbcType=VARCHAR},
x_axis = #{record.xAxis,jdbcType=LONGVARCHAR},
x_axis_ext = #{record.xAxisExt,jdbcType=LONGVARCHAR},
y_axis = #{record.yAxis,jdbcType=LONGVARCHAR},
......@@ -481,7 +492,8 @@
update_time = #{record.updateTime,jdbcType=BIGINT},
style_priority = #{record.stylePriority,jdbcType=VARCHAR},
chart_type = #{record.chartType,jdbcType=VARCHAR},
is_plugin = #{record.isPlugin,jdbcType=BIT}
is_plugin = #{record.isPlugin,jdbcType=BIT},
data_from = #{record.dataFrom,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -531,6 +543,9 @@
<if test="isPlugin != null">
is_plugin = #{isPlugin,jdbcType=BIT},
</if>
<if test="dataFrom != null">
data_from = #{dataFrom,jdbcType=VARCHAR},
</if>
<if test="xAxis != null">
x_axis = #{xAxis,jdbcType=LONGVARCHAR},
</if>
......@@ -586,6 +601,7 @@
style_priority = #{stylePriority,jdbcType=VARCHAR},
chart_type = #{chartType,jdbcType=VARCHAR},
is_plugin = #{isPlugin,jdbcType=BIT},
data_from = #{dataFrom,jdbcType=VARCHAR},
x_axis = #{xAxis,jdbcType=LONGVARCHAR},
x_axis_ext = #{xAxisExt,jdbcType=LONGVARCHAR},
y_axis = #{yAxis,jdbcType=LONGVARCHAR},
......@@ -615,7 +631,8 @@
update_time = #{updateTime,jdbcType=BIGINT},
style_priority = #{stylePriority,jdbcType=VARCHAR},
chart_type = #{chartType,jdbcType=VARCHAR},
is_plugin = #{isPlugin,jdbcType=BIT}
is_plugin = #{isPlugin,jdbcType=BIT},
data_from = #{dataFrom,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
......@@ -14,7 +14,6 @@
<result column="copy_from_view" jdbcType="VARCHAR" property="copyFromView" />
<result column="copy_from" jdbcType="VARCHAR" property="copyFrom" />
<result column="copy_id" jdbcType="VARCHAR" property="copyId" />
<result column="data_from" jdbcType="VARCHAR" property="dataFrom" />
</resultMap>
<resultMap extends="BaseResultMap" id="ResultMapWithBLOBs" type="io.dataease.base.domain.PanelView">
<result column="content" jdbcType="LONGVARBINARY" property="content" />
......@@ -79,7 +78,7 @@
</sql>
<sql id="Base_Column_List">
id, panel_id, chart_view_id, create_by, create_time, update_by, update_time, `position`,
copy_from_panel, copy_from_view, copy_from, copy_id, data_from
copy_from_panel, copy_from_view, copy_from, copy_id
</sql>
<sql id="Blob_Column_List">
content
......@@ -137,12 +136,12 @@
create_by, create_time, update_by,
update_time, `position`, copy_from_panel,
copy_from_view, copy_from, copy_id,
data_from, content)
content)
values (#{id,jdbcType=VARCHAR}, #{panelId,jdbcType=VARCHAR}, #{chartViewId,jdbcType=VARCHAR},
#{createBy,jdbcType=VARCHAR}, #{createTime,jdbcType=BIGINT}, #{updateBy,jdbcType=VARCHAR},
#{updateTime,jdbcType=BIGINT}, #{position,jdbcType=VARCHAR}, #{copyFromPanel,jdbcType=VARCHAR},
#{copyFromView,jdbcType=VARCHAR}, #{copyFrom,jdbcType=VARCHAR}, #{copyId,jdbcType=VARCHAR},
#{dataFrom,jdbcType=VARCHAR}, #{content,jdbcType=LONGVARBINARY})
#{content,jdbcType=LONGVARBINARY})
</insert>
<insert id="insertSelective" parameterType="io.dataease.base.domain.PanelView">
insert into panel_view
......@@ -183,9 +182,6 @@
<if test="copyId != null">
copy_id,
</if>
<if test="dataFrom != null">
data_from,
</if>
<if test="content != null">
content,
</if>
......@@ -227,9 +223,6 @@
<if test="copyId != null">
#{copyId,jdbcType=VARCHAR},
</if>
<if test="dataFrom != null">
#{dataFrom,jdbcType=VARCHAR},
</if>
<if test="content != null">
#{content,jdbcType=LONGVARBINARY},
</if>
......@@ -280,9 +273,6 @@
<if test="record.copyId != null">
copy_id = #{record.copyId,jdbcType=VARCHAR},
</if>
<if test="record.dataFrom != null">
data_from = #{record.dataFrom,jdbcType=VARCHAR},
</if>
<if test="record.content != null">
content = #{record.content,jdbcType=LONGVARBINARY},
</if>
......@@ -305,7 +295,6 @@
copy_from_view = #{record.copyFromView,jdbcType=VARCHAR},
copy_from = #{record.copyFrom,jdbcType=VARCHAR},
copy_id = #{record.copyId,jdbcType=VARCHAR},
data_from = #{record.dataFrom,jdbcType=VARCHAR},
content = #{record.content,jdbcType=LONGVARBINARY}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
......@@ -324,8 +313,7 @@
copy_from_panel = #{record.copyFromPanel,jdbcType=VARCHAR},
copy_from_view = #{record.copyFromView,jdbcType=VARCHAR},
copy_from = #{record.copyFrom,jdbcType=VARCHAR},
copy_id = #{record.copyId,jdbcType=VARCHAR},
data_from = #{record.dataFrom,jdbcType=VARCHAR}
copy_id = #{record.copyId,jdbcType=VARCHAR}
<if test="_parameter != null">
<include refid="Update_By_Example_Where_Clause" />
</if>
......@@ -366,9 +354,6 @@
<if test="copyId != null">
copy_id = #{copyId,jdbcType=VARCHAR},
</if>
<if test="dataFrom != null">
data_from = #{dataFrom,jdbcType=VARCHAR},
</if>
<if test="content != null">
content = #{content,jdbcType=LONGVARBINARY},
</if>
......@@ -388,7 +373,6 @@
copy_from_view = #{copyFromView,jdbcType=VARCHAR},
copy_from = #{copyFrom,jdbcType=VARCHAR},
copy_id = #{copyId,jdbcType=VARCHAR},
data_from = #{dataFrom,jdbcType=VARCHAR},
content = #{content,jdbcType=LONGVARBINARY}
where id = #{id,jdbcType=VARCHAR}
</update>
......@@ -404,8 +388,7 @@
copy_from_panel = #{copyFromPanel,jdbcType=VARCHAR},
copy_from_view = #{copyFromView,jdbcType=VARCHAR},
copy_from = #{copyFrom,jdbcType=VARCHAR},
copy_id = #{copyId,jdbcType=VARCHAR},
data_from = #{dataFrom,jdbcType=VARCHAR}
copy_id = #{copyId,jdbcType=VARCHAR}
where id = #{id,jdbcType=VARCHAR}
</update>
</mapper>
\ No newline at end of file
......@@ -54,7 +54,8 @@
custom_filter,
drill_fields,
senior,
SNAPSHOT
SNAPSHOT,
data_from
) SELECT
id,
`name`,
......@@ -82,7 +83,8 @@
custom_filter,
drill_fields,
senior,
SNAPSHOT from chart_view
SNAPSHOT,
data_from from chart_view
WHERE
chart_view.id = #{id}
</insert>
......@@ -181,7 +183,8 @@
`result_count`,
`result_mode`,
`chart_type`,
`senior`)
`senior`,
`data_from`)
SELECT #{newChartId},
`name`,
#{panelId},
......@@ -207,7 +210,8 @@
`result_count`,
`result_mode`,
'private',
`senior`
`senior`,
`data_from`
FROM chart_view_cache
WHERE id = #{oldChartId}
</insert>
......@@ -256,7 +260,8 @@
custom_style,
custom_filter,
drill_fields,
SNAPSHOT)
SNAPSHOT,
data_from)
SELECT pv_copy.chart_view_id AS id,
`name`,
title,
......@@ -282,7 +287,8 @@
custom_style,
custom_filter,
drill_fields,
SNAPSHOT
SNAPSHOT,
data_from
FROM (
SELECT panel_id,
copy_from_view,
......@@ -389,7 +395,9 @@
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
cv.SNAPSHOT = cve.SNAPSHOT,
cv.data_from = cve.data_from
where cve.id = cv.id and cv.id in
<foreach collection="viewIds" item="viewId" open='(' separator=',' close=')'>
#{viewId}
</foreach>
......
......@@ -33,6 +33,7 @@
panel_group.`name` AS label,
panel_group.`source`,
panel_group.`panel_type`,
sourcePanelGroup.`mobile_layout`,
sourcePanelGroup.`name` as source_panel_name,
authInfo.privileges as `privileges`
from (select GET_V_AUTH_MODEL_ID_P_USE (#{userId}, 'panel') cids) t,panel_group
......@@ -105,6 +106,7 @@
panel_group.panel_type,
panel_group.`name` AS label,
panel_group.`node_type`,
panel_group.`mobile_layout`,
(case when ISNULL(defaultPanelGroup.id) then false else true end) is_default,
defaultPanelGroup.id as default_panel_id,
defaultPanelGroup.`name` as default_panel_name,
......
......@@ -110,6 +110,4 @@
and chart_view.id is not null
</insert>
</mapper>
......@@ -69,4 +69,15 @@ public class CommonConstants {
public static final String CACHE = "cache";
}
//视图数据读取来源
public static final class VIEW_DATA_FROM {
// 模板数据
public static final String TEMPLATE = "template";
//数据集数据
public static final String CHART = "dataset";
}
}
......@@ -14,6 +14,7 @@ import io.dataease.controller.request.chart.ChartViewRequest;
import io.dataease.controller.response.ChartDetail;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.service.chart.ChartViewService;
import io.dataease.service.panel.PanelViewService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;
......@@ -33,6 +34,8 @@ import java.util.List;
public class ChartViewController {
@Resource
private ChartViewService chartViewService;
@Resource
private PanelViewService panelViewService;
@DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE)
@ApiOperation("保存")
......@@ -73,7 +76,8 @@ public class ChartViewController {
@ApiOperation("详细信息")
@PostMapping("/get/{id}/{panelId}")
public ChartViewDTO get(@PathVariable String id, @PathVariable String panelId,@RequestBody ChartViewRequest viewRequest) {
return chartViewService.getOne(id,viewRequest.getQueryFrom());
ChartViewDTO result = chartViewService.getOne(id,viewRequest.getQueryFrom());
return result;
}
@ApiIgnore
......
......@@ -30,4 +30,6 @@ public class ChartViewDTO extends ChartViewWithBLOBs {
private boolean drill;
@ApiModelProperty("下钻条件集合")
private List<ChartExtFilterRequest> drillFilters;
@ApiModelProperty("视图存放位置")
private String position;
}
......@@ -24,12 +24,5 @@ public class PanelViewInsertDTO extends PanelView {
super.setPanelId(panelGroupId);
super.setPosition(position);
}
public PanelViewInsertDTO(String chartViewId,String panelGroupId,String position,String dataFrom) {
super();
super.setChartViewId(chartViewId);
super.setPanelId(panelGroupId);
super.setPosition(position);
super.setDataFrom(dataFrom);
}
}
......@@ -7,6 +7,7 @@ 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.PanelViewMapper;
import io.dataease.base.mapper.ext.ExtChartGroupMapper;
import io.dataease.base.mapper.ext.ExtChartViewMapper;
import io.dataease.commons.constants.ColumnPermissionConstants;
......@@ -23,6 +24,7 @@ import io.dataease.dto.chart.*;
import io.dataease.dto.dataset.DataSetTableDTO;
import io.dataease.dto.dataset.DataSetTableUnionDTO;
import io.dataease.dto.dataset.DataTableInfoDTO;
import io.dataease.exception.DataEaseException;
import io.dataease.i18n.Translator;
import io.dataease.listener.util.CacheUtils;
import io.dataease.provider.ProviderFactory;
......@@ -35,6 +37,8 @@ import io.dataease.service.dataset.DataSetTableUnionService;
import io.dataease.service.dataset.PermissionService;
import io.dataease.service.datasource.DatasourceService;
import io.dataease.service.engine.EngineService;
import io.dataease.service.panel.PanelGroupExtendDataService;
import io.dataease.service.panel.PanelViewService;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
......@@ -77,6 +81,11 @@ public class ChartViewService {
private EngineService engineService;
@Resource
private ChartViewCacheMapper chartViewCacheMapper;
@Resource
private PanelViewService panelViewService;
@Resource
private PanelGroupExtendDataService extendDataService;
//默认使用非公平
private ReentrantLock lock = new ReentrantLock();
......@@ -223,20 +232,31 @@ 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);
try{
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);
}
} else {
result = extChartViewMapper.searchOne(id);
if(result==null){
DataEaseException.throwException(Translator.get("i18n_chart_delete"));
}
return result;
}catch (Exception e){
e.printStackTrace();
DataEaseException.throwException(e);
}
return result;
return null;
}
public void delete(String id) {
......@@ -250,13 +270,26 @@ public class ChartViewService {
}
public ChartViewDTO getData(String id, ChartExtRequest request) throws Exception {
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());
view.setResultCount(request.getResultCount());
try {
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());
view.setResultCount(request.getResultCount());
}
// 数据来源在模板中直接从模板取数据
if (CommonConstants.VIEW_DATA_FROM.TEMPLATE.equals(view.getDataFrom())) {
return extendDataService.getChartDataInfo(id, view);
} else {
return calcData(view, request, request.isCache());
}
} catch (Exception e) {
e.printStackTrace();
DataEaseException.throwException(e);
}
return calcData(view, request, request.isCache());
return null;
}
public ChartViewDTO calcData(ChartViewDTO view, ChartExtRequest requestList, boolean cache) throws Exception {
......
package io.dataease.service.panel;
import com.alibaba.fastjson.JSONObject;
import io.dataease.base.domain.PanelGroupExtendData;
import io.dataease.base.domain.PanelGroupExtendDataExample;
import io.dataease.base.mapper.PanelGroupExtendDataMapper;
import io.dataease.commons.constants.CommonConstants;
import io.dataease.dto.chart.ChartViewDTO;
import io.dataease.exception.DataEaseException;
import org.apache.commons.collections.CollectionUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* Author: wangjiahao
* Date: 2022/3/15
* Description:
*/
@Service
public class PanelGroupExtendDataService {
@Resource
private PanelGroupExtendDataMapper panelGroupExtendDataMapper;
public ChartViewDTO getChartDataInfo(String viewId,ChartViewDTO view){
PanelGroupExtendDataExample extendDataExample = new PanelGroupExtendDataExample();
extendDataExample.createCriteria().andViewIdEqualTo(viewId);
List<PanelGroupExtendData> extendDataList = panelGroupExtendDataMapper.selectByExampleWithBLOBs(extendDataExample);
if(CollectionUtils.isNotEmpty(extendDataList)){
ChartViewDTO chartViewTemplate = JSONObject.parseObject(extendDataList.get(0).getViewDetails(),ChartViewDTO.class);
view.setData(chartViewTemplate.getData());
}else{
DataEaseException.throwException("模板缓存数据中未获取指定视图数据:"+viewId);
}
return view;
}
}
package io.dataease.service.panel;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import io.dataease.auth.annotation.DeCleaner;
import io.dataease.base.domain.*;
import io.dataease.base.mapper.*;
import io.dataease.base.mapper.ext.*;
import io.dataease.commons.constants.CommonConstants;
import io.dataease.commons.constants.DePermissionType;
import io.dataease.commons.constants.PanelConstants;
import io.dataease.commons.utils.AuthUtils;
......@@ -326,17 +328,21 @@ public class PanelGroupService {
for(Map.Entry<String, String> entry : dynamicDataMap.entrySet()){
String originViewId = entry.getKey();
String originViewData = entry.getValue();
String position = JSON.parseObject(originViewData).getString("position");
ChartViewDTO chartView = JSON.parseObject(originViewData,ChartViewDTO.class);
String position = chartView.getPosition();
String newViewId = UUIDUtil.getUUIDAsString();
chartView.setId(newViewId);
chartView.setSceneId(newPanelId);
chartView.setDataFrom(CommonConstants.VIEW_DATA_FROM.TEMPLATE);
//TODO 数据处理 1.替换viewId 2.加入panelView 数据(数据来源为template) 3.加入模板view data数据
templateData = templateData.replaceAll(originViewId,newViewId);
panelViews.add(new PanelViewInsertDTO(newViewId,newPanelId,position,"template"));
panelViews.add(new PanelViewInsertDTO(newViewId,newPanelId,position));
viewsData.add(new PanelGroupExtendDataDTO(newPanelId,newViewId,originViewData));
chartViewMapper.insertSelective(chartView);
extChartViewMapper.copyToCache(newViewId);
}
if(CollectionUtils.isNotEmpty(panelViews)){
extPanelViewMapper.savePanelView(panelViews);
}
if(CollectionUtils.isNotEmpty(viewsData)){
extPanelGroupExtendDataMapper.savePanelExtendData(viewsData);
}
request.setPanelData(templateData);
......
......@@ -10,6 +10,7 @@ import io.dataease.base.mapper.PanelViewMapper;
import io.dataease.base.mapper.ext.ExtChartViewMapper;
import io.dataease.base.mapper.ext.ExtPanelGroupMapper;
import io.dataease.base.mapper.ext.ExtPanelViewMapper;
import io.dataease.commons.constants.CommonConstants;
import io.dataease.commons.utils.AuthUtils;
import io.dataease.commons.utils.BeanUtils;
import io.dataease.dto.panel.PanelViewDto;
......@@ -130,8 +131,6 @@ public class PanelViewService {
}
}
panelGroup.setMobileLayout(mobileLayout);
//移除没有用到的仪表板私有视图
extPanelGroupMapper.removeUselessViews(panelId,viewIds);
return viewIds;
}
......@@ -144,4 +143,15 @@ public class PanelViewService {
panelViewExample.createCriteria().andCopyIdEqualTo(copyId);
return panelViewMapper.selectByExample(panelViewExample);
}
public PanelView findByViewId(String viewId){
PanelViewExample panelViewExample = new PanelViewExample();
panelViewExample.createCriteria().andChartViewIdEqualTo(viewId);
List<PanelView> result = panelViewMapper.selectByExample(panelViewExample);
if(CollectionUtils.isNotEmpty(result)){
return result.get(0);
}else{
return null;
}
}
}
......@@ -34,8 +34,11 @@ CREATE TABLE `chart_view_cache` (
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE `panel_view`
ADD COLUMN `data_from` varchar(255) NULL DEFAULT 'chart' COMMENT '当前数据来源 chart 视图 template 模板' AFTER `copy_id`;
ALTER TABLE `chart_view`
ADD COLUMN `data_from` varchar(255) NULL DEFAULT 'dataset' COMMENT '数据来源 template 模板数据 dataset 数据集数据' AFTER `is_plugin`;
ALTER TABLE `chart_view_cache`
ADD COLUMN `data_from` varchar(255) NULL DEFAULT 'dataset' COMMENT '数据来源 template 模板数据 dataset 数据集数据' AFTER `is_plugin`;
SET NAMES utf8mb4;
......
......@@ -60,9 +60,11 @@
</javaClientGenerator>
<!--要生成的数据库表 -->
<table tableName="de_engine">
<columnOverride column="configuration" property="configuration" javaType="java.lang.String"/>
</table>
<!-- <table tableName="de_engine">-->
<!-- <columnOverride column="configuration" property="configuration" javaType="java.lang.String"/>-->
<!-- </table>-->
<table tableName="panel_view"/>
<table tableName="chart_view"/>
<table tableName="chart_view_cache"/>
</context>
</generatorConfiguration>
......@@ -4,7 +4,8 @@ export function save(data) {
return request({
url: '/template/save',
data: data,
method: 'post'
method: 'post',
loading: true
})
}
export function templateDelete(id) {
......
<svg width="1285" height="1024" xmlns="http://www.w3.org/2000/svg" p-id="2359" version="1.1" class="icon" t="1621433305409">
<defs>
<filter id="svg_4_blur">
<feGaussianBlur stdDeviation="0" in="SourceGraphic"/>
</filter>
</defs>
<g>
<title>Layer 1</title>
<path id="svg_1" p-id="2360" fill="#0069F6" d="m100.39216,70.27451a30.11765,30.11765 0 0 0 -30.11765,30.11765l0,823.21568a30.11765,30.11765 0 0 0 30.11765,30.11765l1084.23529,0a30.11765,30.11765 0 0 0 30.11765,-30.11765l0,-823.21568a30.11765,30.11765 0 0 0 -30.11765,-30.11765l-1084.23529,0zm0,-60.23529l1084.23529,0a90.35294,90.35294 0 0 1 90.35294,90.35294l0,823.21568a90.35294,90.35294 0 0 1 -90.35294,90.35294l-1084.23529,0a90.35294,90.35294 0 0 1 -90.35294,-90.35294l0,-823.21568a90.35294,90.35294 0 0 1 90.35294,-90.35294z"/>
<path id="svg_2" p-id="2361" fill="#5ED7BC" d="m261.01961,261.01961m-60.2353,0a60.23529,60.23529 0 1 0 120.47059,0a60.23529,60.23529 0 1 0 -120.47059,0z"/>
<path id="svg_3" p-id="2362" fill="#5ED7BC" d="m331.29412,839.47922a30.11765,30.11765 0 0 1 -60.2353,0a189.94196,189.94196 0 0 1 189.94196,-189.94197l186.58887,0a102.46023,102.46023 0 0 0 98.4847,-130.71058a162.69553,162.69553 0 0 1 156.37083,-207.61098l241.14196,0a30.11765,30.11765 0 0 1 0,60.23529l-241.14196,0a102.46023,102.46023 0 0 0 -98.46463,130.73067a162.69553,162.69553 0 0 1 -156.3909,207.61098l-186.58887,0a129.70667,129.70667 0 0 0 -129.70666,129.70666l0,-0.02007z"/>
<rect stroke="null" id="svg_8" height="760.00015" width="508.00008" y="187.00002" x="689.50014" fill="#000000"/>
<rect stroke="null" rx="5" filter="url(#svg_4_blur)" id="svg_4" height="669.66668" width="430.00003" y="231.99995" x="728.16665" fill="#56ffff"/>
<line stroke="null" id="svg_5" y2="392.99996" x2="754.16667" y1="392.99996" x1="559.16667" fill="none"/>
<ellipse stroke="null" ry="65.5" rx="66.33335" id="svg_6" cy="823.83325" cx="952.16662" fill="#000000"/>
<rect stroke="null" id="svg_7" height="47.66669" width="187.33336" y="242.6666" x="863.49997" fill="#000000"/>
</g>
</svg>
\ No newline at end of file
......@@ -1381,6 +1381,7 @@ export default {
sure_bt: 'Confirm'
},
panel: {
template_view_tips: "Template's Views. Please Change",
no_auth_role: 'Unshared roles',
auth_role: 'Shared roles',
picture_limit: 'Only pictures can be inserted',
......
......@@ -1382,6 +1382,7 @@ export default {
sure_bt: '確定'
},
panel: {
template_view_tips: '当前是模板视图,请点击更换数据集',
no_auth_role: '未分享角色',
auth_role: '已分享角色',
picture_limit: '只能插入圖片',
......
......@@ -1390,6 +1390,7 @@ export default {
sure_bt: '确定'
},
panel: {
template_view_tips: '当前是模板视图,请点击更换数据集',
no_auth_role: '未分享角色',
auth_role: '已分享角色',
picture_limit: '只能插入图片',
......
......@@ -41,6 +41,20 @@
<el-row class="view-panel-row">
<el-tabs :stretch="true" class="tab-header">
<el-tab-pane :label="$t('chart.chart_data')" class="padding-tab" style="width: 300px">
<div v-if="view.dataFrom==='template'" class="view-panel-Mask">
<span style="opacity: 1;">
<el-button
style="opacity: 1!important;"
type="warning"
:title="$t('chart.change_ds')"
size="mini"
round
@click="changeDs"
>
<span style="font-weight: bold">{{ $t('panel.template_view_tips') }}<i class="el-icon-refresh el-icon--right" /></span>
</el-button>
</span>
</div>
<el-row class="view-panel">
<el-col class="theme-border-class" :span="12" style="border-right: 1px solid #E6E6E6;">
<div style="display: flex;align-items: center;justify-content: center;padding: 6px;">
......@@ -1388,6 +1402,7 @@ export default {
}
},
created() {
debugger
// this.get(this.$store.state.chart.viewId);
// this.initAreas()
},
......@@ -1402,6 +1417,13 @@ export default {
},
methods: {
emptyTableData() {
this.table = {}
this.dimension = []
this.quota = []
this.dimensionData = []
this.quotaData = []
},
initFromPanel() {
this.hasEdit = (this.panelViewEditInfo[this.param.id] || false)
},
......@@ -1613,6 +1635,8 @@ export default {
ele.filter = []
}
})
this.view = JSON.parse(JSON.stringify(view))
// stringify json param
view.xaxis = JSON.stringify(view.xaxis)
view.xaxisExt = JSON.stringify(view.xaxisExt)
view.yaxis = JSON.stringify(view.yaxis)
......@@ -1787,7 +1811,11 @@ export default {
getChart(id, queryFrom = 'panel_edit') {
if (id) {
getChartDetails(id, this.panelInfo.id, { queryFrom: queryFrom }).then(response => {
this.initTableData(response.data.tableId)
if (response.data.dataFrom === 'template') {
this.emptyTableData()
} else {
this.initTableData(response.data.tableId)
}
this.view = JSON.parse(JSON.stringify(response.data))
this.view.xaxis = this.view.xaxis ? JSON.parse(this.view.xaxis) : []
this.view.xaxisExt = this.view.xaxisExt ? JSON.parse(this.view.xaxisExt) : []
......@@ -2145,10 +2173,12 @@ export default {
this.view.extStack = []
this.view.extBubble = []
this.view.drillFields = []
this.view.dataFrom = 'dataset'
}
// this.save(true, 'chart', false)
this.calcData(true, 'chart', false)
this.initTableData(this.view.tableId)
this.closeChangeChart()
},
fieldFilter(val) {
......@@ -2516,6 +2546,22 @@ export default {
height: calc(100vh - 75px);
}
.view-panel-Mask {
display: flex;
height: calc(100vh - 60px);
background-color: #5c5e61;
opacity: 0.7;
position:absolute;
top:0px;
left: 0px;
width: 300px;
z-index: 2;
cursor:not-allowed;
display: flex;
align-items: center;
justify-content: center;
}
.view-panel {
display: flex;
height: calc(100% - 80px);
......
......@@ -48,7 +48,7 @@
<span v-else>
<svg-icon :icon-class="data.modelInnerType" style="width: 14px;height: 14px" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ data.name }}</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
</span>
<span v-if="data.mode===1" class="child">
<span @click.stop>
......
......@@ -146,13 +146,17 @@ export default {
return false
}
this.editPanel.panelInfo['newFrom'] = this.inputType
this.loading = true
panelSave(this.editPanel.panelInfo).then(response => {
this.$message({
message: this.$t('commons.save_success'),
type: 'success',
showClose: true
})
this.loading = false
this.$emit('closeEditPanelDialog', response.data)
}).catch(() => {
this.loading = false
})
},
handleFileChange(e) {
......
......@@ -39,9 +39,10 @@
<span slot-scope="{ node, data }" class="custom-tree-node father">
<span style="display: flex; flex: 1 1 0%; width: 0px;">
<span>
<svg-icon icon-class="panel" class="ds-icon-scene" />
<svg-icon v-if="!data.mobileLayout" icon-class="panel" class="ds-icon-scene" />
<svg-icon v-if="data.mobileLayout" icon-class="panel-mobile" class="ds-icon-scene" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ data.name }}</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
</span>
<span style="margin-left: 12px;" class="child" @click.stop>
<el-dropdown v-if="hasDataPermission('manage',data.privileges)" trigger="click" size="small" @command="clickMore">
......@@ -90,12 +91,13 @@
<span slot-scope="{ node, data }" class="custom-tree-node-list father">
<span style="display: flex; flex: 1 1 0%; width: 0px;">
<span v-if="data.nodeType === 'panel'">
<svg-icon icon-class="panel" class="ds-icon-scene" />
<svg-icon v-if="!data.mobileLayout" icon-class="panel" class="ds-icon-scene" />
<svg-icon v-if="data.mobileLayout" icon-class="panel-mobile" class="ds-icon-scene" />
</span>
<span v-if="data.nodeType === 'folder'">
<i class="el-icon-folder" />
</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;">{{ data.name }}</span>
<span style="margin-left: 6px;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;" :title="data.name">{{ data.name }}</span>
</span>
<span v-if="hasDataPermission('manage',data.privileges)" class="child">
<span v-if="data.nodeType ==='folder'" @click.stop>
......
<template>
<el-row>
<el-row v-loading="$store.getters.loadingMap[$store.getters.currentPath]">
<el-row style="margin-top: 5px">
<el-col :span="4">{{ $t('commons.name') }}</el-col>
<el-col :span="16">
......@@ -44,6 +44,7 @@ export default {
name: '',
templateStyle: null,
templateData: null,
dynamicData: null,
snapshot: ''
}
}
......@@ -118,6 +119,7 @@ export default {
this.templateInfo.templateStyle = this.importTemplateInfo.panelStyle
this.templateInfo.templateData = this.importTemplateInfo.panelData
this.templateInfo.snapshot = this.importTemplateInfo.snapshot
this.templateInfo.dynamicData = this.importTemplateInfo.dynamicData
this.templateInfo.nodeType = 'template'
}
reader.readAsText(file)
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论