From e36df37a598b359aec2312ddafad5f75a0effd25 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 1 Apr 2022 15:54:18 +0800 Subject: [PATCH 01/16] =?UTF-8?q?fix:=20=E5=88=A0=E9=99=A4=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E6=9D=BF=E5=90=8E=E5=85=AC=E5=85=B1=E9=93=BE=E6=8E=A5?= =?UTF-8?q?=E6=98=A0=E5=B0=84=E8=BF=98=E5=AD=98=E5=9C=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/io/dataease/service/panel/PanelLinkService.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/backend/src/main/java/io/dataease/service/panel/PanelLinkService.java b/backend/src/main/java/io/dataease/service/panel/PanelLinkService.java index e2b6834c2a..6fe1ce190f 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelLinkService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelLinkService.java @@ -136,6 +136,10 @@ public class PanelLinkService { PanelLinkExample example = new PanelLinkExample(); example.createCriteria().andResourceIdEqualTo(resourceId); mapper.deleteByExample(example); + + PanelLinkMappingExample mappingExample = new PanelLinkMappingExample(); + mappingExample.createCriteria().andResourceIdEqualTo(resourceId); + panelLinkMappingMapper.deleteByExample(mappingExample); } public String decryptParam(String text) throws Exception { From b6ac2dec6a95f966b9d3e5c45595090f07bb7a1b Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Fri, 1 Apr 2022 16:59:14 +0800 Subject: [PATCH 02/16] =?UTF-8?q?fix:=20=E6=8F=92=E4=BB=B6=E7=AE=A1?= =?UTF-8?q?=E7=90=86=E8=8F=9C=E5=8D=95icons?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- backend/src/main/resources/db/migration/V33__1.9.sql | 2 +- frontend/src/icons/svg/plugins.svg | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) create mode 100644 frontend/src/icons/svg/plugins.svg 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 256d528cb1..8a7956f258 100644 --- a/backend/src/main/resources/db/migration/V33__1.9.sql +++ b/backend/src/main/resources/db/migration/V33__1.9.sql @@ -258,7 +258,7 @@ ADD COLUMN `attach_params` tinyint(1) NULL COMMENT '是否附加点击参数' AF update `sys_menu` set menu_id = 100 where title = '首页'; -INSERT INTO `sys_menu` VALUES (101, 1, 4, 1, '插件管理', 'system-plugin', 'system/plugin/index', 1002, 'peoples', 'plugin', b'0', b'0', b'0', 'plugin:read', NULL, NULL, NULL, 1620281952752); +INSERT INTO `sys_menu` VALUES (101, 1, 4, 1, '插件管理', 'system-plugin', 'system/plugin/index', 1002, 'plugins', 'plugin', b'0', b'0', b'0', 'plugin:read', NULL, NULL, NULL, 1620281952752); DROP FUNCTION IF EXISTS `GET_CHART_VIEW_COPY_NAME`; delimiter ;; diff --git a/frontend/src/icons/svg/plugins.svg b/frontend/src/icons/svg/plugins.svg new file mode 100644 index 0000000000..de353db688 --- /dev/null +++ b/frontend/src/icons/svg/plugins.svg @@ -0,0 +1 @@ + \ No newline at end of file From 505349f3f89d5da73ef9ee38f9c81a58c2a6ed45 Mon Sep 17 00:00:00 2001 From: junjun Date: Fri, 1 Apr 2022 17:59:30 +0800 Subject: [PATCH 03/16] =?UTF-8?q?fix:=20=E8=A1=A8=E6=A0=BC=E9=A2=9C?= =?UTF-8?q?=E8=89=B2=E9=85=8D=E7=BD=AE=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/views/chart/components/shape-attr/ColorSelector.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/chart/components/shape-attr/ColorSelector.vue b/frontend/src/views/chart/components/shape-attr/ColorSelector.vue index d9e775764f..62cac156ee 100644 --- a/frontend/src/views/chart/components/shape-attr/ColorSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/ColorSelector.vue @@ -62,7 +62,7 @@ - + From f2135c175d61834aaa5901b14d098f960c79b310 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 1 Apr 2022 18:48:34 +0800 Subject: [PATCH 04/16] =?UTF-8?q?refactor:=20=E5=A4=8D=E5=88=B6=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E7=9A=84=E6=97=B6=E9=97=B4=E4=BF=9D=E6=8C=81=E4=B8=BA?= =?UTF-8?q?=E5=BD=93=E5=89=8D=E6=97=B6=E9=97=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/io/dataease/base/mapper/ext/ExtChartViewMapper.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) 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 7a638314fa..84fb290bcd 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 @@ -200,8 +200,8 @@ `custom_filter`, `drill_fields`, `create_by`, - `create_time`, - `update_time`, + unix_timestamp()*1000 as `create_time`, + unix_timestamp()*1000 as `update_time`, `snapshot`, `style_priority`, `ext_stack`, From da2cbc4ce62b9a8ba1b0fcb288a02af07db22633 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 1 Apr 2022 19:17:16 +0800 Subject: [PATCH 05/16] =?UTF-8?q?refactor:=20=E5=8E=BB=E6=8E=89=E7=BB=84?= =?UTF-8?q?=E4=BB=B6=E6=82=AC=E6=B5=AE=E6=A0=B7=E5=BC=8F=E6=A1=86=E5=A4=9A?= =?UTF-8?q?=E4=BD=99=E7=9A=84=E6=A0=B7=E5=BC=8F=E8=AE=BE=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/canvas/components/TextAttr.vue | 22 +++---------- .../canvas/custom-component/component-list.js | 32 ++++++------------- 2 files changed, 13 insertions(+), 41 deletions(-) diff --git a/frontend/src/components/canvas/components/TextAttr.vue b/frontend/src/components/canvas/components/TextAttr.vue index ec18af4c13..8b3c8d8278 100644 --- a/frontend/src/components/canvas/components/TextAttr.vue +++ b/frontend/src/components/canvas/components/TextAttr.vue @@ -244,8 +244,6 @@ export default { 'picture-add': [ 'borderStyle', 'borderWidth', - 'borderRadius', - 'opacity', 'borderColor', 'hyperlinks' ], @@ -254,15 +252,12 @@ export default { 'fontSize', 'fontWeight', 'letterSpacing', - 'color', - 'backgroundColor' + 'color' ], // tab组件显示的属性 'de-tabs': [ 'borderStyle', 'borderWidth', - 'borderRadius', - 'opacity', 'borderColor', 'deTabStyle' ], @@ -270,20 +265,14 @@ export default { 'rect-shape': [ 'borderStyle', 'borderWidth', - 'borderRadius', - 'opacity', - 'borderColor', - 'backgroundColor' + 'borderColor' ], // 时间组件显示的属性 'de-show-date': [ 'textAlign', 'fontSize', 'fontWeight', - 'opacity', - 'borderRadius', 'color', - 'backgroundColor', 'date-format', 'time_margin', 'padding' @@ -295,10 +284,7 @@ export default { 'fontSize', 'fontWeight', 'letterSpacing', - 'opacity', - 'borderRadius', 'color', - 'backgroundColor', 'hyperlinks' ], 'de-video': [ @@ -405,9 +391,9 @@ export default { this.innerOpacity = this.styleInfo['opacity'] * 100 } if (this.curComponent.type === 'v-text') { - this.mainWidthOffset = 600 + this.mainWidthOffset = 400 } else if (this.curComponent.type === 'de-show-date') { - this.mainWidthOffset = 600 + this.mainWidthOffset = 350 } else { this.mainWidthOffset = document.getElementById('main-attr').offsetWidth - 50 } diff --git a/frontend/src/components/canvas/custom-component/component-list.js b/frontend/src/components/canvas/custom-component/component-list.js index 397f696cbf..b05b616d1c 100644 --- a/frontend/src/components/canvas/custom-component/component-list.js +++ b/frontend/src/components/canvas/custom-component/component-list.js @@ -208,9 +208,7 @@ const list = [ letterSpacing: 0, textAlign: 'center', color: '#000000', - verticalAlign: 'middle', - backgroundColor: '#ffffff', - borderRadius: 0 + verticalAlign: 'middle' }, hyperlinks: HYPERLINKS, x: 1, @@ -255,8 +253,7 @@ const list = [ mobileStyle: BASE_MOBILE_STYLE, style: { width: 300, - height: 200, - borderRadius: '' + height: 200 }, x: 1, y: 1, @@ -296,9 +293,7 @@ const list = [ height: 200, borderStyle: 'solid', borderWidth: 0, - borderColor: '#000000', - backgroundColor: '#ffffff', - borderRadius: 0 + borderColor: '#000000' }, x: 1, y: 1, @@ -317,8 +312,7 @@ const list = [ mobileStyle: BASE_MOBILE_STYLE, style: { width: 300, - height: 200, - borderRadius: '' + height: 200 }, x: 1, y: 36, @@ -341,9 +335,7 @@ const list = [ height: 200, borderStyle: 'solid', borderWidth: 0, - borderColor: '#000000', - backgroundColor: '#ffffff', - borderRadius: 0 + borderColor: '#000000' }, options: { tabList: [{ @@ -377,10 +369,8 @@ const list = [ textAlign: 'center', color: '#000000', verticalAlign: 'middle', - backgroundColor: '#ffffff', borderStyle: 'solid', borderColor: '#000000', - borderRadius: 0, time_margin: 0, padding: 10 }, @@ -408,8 +398,7 @@ const list = [ mobileStyle: BASE_MOBILE_STYLE, style: { width: 400, - height: 200, - borderRadius: '' + height: 200 }, frameLinks: FRAMELINKS, x: 1, @@ -430,8 +419,7 @@ const list = [ hyperlinks: HYPERLINKS, style: { width: 400, - height: 200, - borderRadius: '' + height: 200 }, x: 1, y: 1, @@ -450,8 +438,7 @@ const list = [ mobileStyle: BASE_MOBILE_STYLE, style: { width: 400, - height: 200, - borderRadius: '' + height: 200 }, videoLinks: VIDEOLINKS, x: 1, @@ -471,8 +458,7 @@ const list = [ mobileStyle: BASE_MOBILE_STYLE, style: { width: 400, - height: 200, - borderRadius: '' + height: 200 }, streamMediaLinks: STREAMMEDIALINKS, x: 1, From a427a2b1c87351038fe92972446e9f1bc1ec82e1 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 1 Apr 2022 19:21:06 +0800 Subject: [PATCH 06/16] =?UTF-8?q?refactor:=20=E5=8E=BB=E6=8E=89=E8=A7=86?= =?UTF-8?q?=E5=9B=BE=E5=88=97=E8=A1=A8=E5=A4=9A=E4=BD=99=E7=9A=84=E5=9B=BE?= =?UTF-8?q?=E6=A0=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/panel/ViewSelect/index.vue | 1 - 1 file changed, 1 deletion(-) diff --git a/frontend/src/views/panel/ViewSelect/index.vue b/frontend/src/views/panel/ViewSelect/index.vue index c6ac23043d..defcda2f76 100644 --- a/frontend/src/views/panel/ViewSelect/index.vue +++ b/frontend/src/views/panel/ViewSelect/index.vue @@ -46,7 +46,6 @@ - {{ data.name }} From a2bd03d86f64a47e6de0278b98bd4777f82e5480 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Fri, 1 Apr 2022 19:37:47 +0800 Subject: [PATCH 07/16] =?UTF-8?q?fix:=20=E6=A0=B7=E5=BC=8F=E4=BC=98?= =?UTF-8?q?=E5=85=88=E7=BA=A7=E6=B2=A1=E6=9C=89=E7=AB=8B=E5=8D=B3=E7=94=9F?= =?UTF-8?q?=E6=95=88=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/custom-component/UserView.vue | 2 ++ frontend/src/views/chart/view/ChartEdit.vue | 1 + 2 files changed, 3 insertions(+) diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index cfb9e7c787..2ebdf30eb3 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -758,9 +758,11 @@ export default { this.chart.customStyle = param.viewInfo.customStyle this.chart.senior = param.viewInfo.senior this.chart.title = param.viewInfo.title + this.chart.stylePriority = param.viewInfo.stylePriority this.sourceCustomAttrStr = this.chart.customAttr this.sourceCustomStyleStr = this.chart.customStyle this.mergeScale() + this.mergeStyle() } } } diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index c77965e2b1..83d02e9891 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1744,6 +1744,7 @@ export default { view.customFilter = JSON.stringify(this.view.customFilter) view.senior = JSON.stringify(this.view.senior) view.title = this.view.title + view.stylePriority = this.view.stylePriority // view.data = this.data this.chart = view From b64880447ef2de26a2238f56d14cb285e8a0a568 Mon Sep 17 00:00:00 2001 From: junjun Date: Sat, 2 Apr 2022 09:59:02 +0800 Subject: [PATCH 08/16] =?UTF-8?q?refactor:=20=E6=96=87=E6=9C=AC=E5=8D=A1?= =?UTF-8?q?=E4=BB=85=E6=94=AF=E6=8C=81=E4=B8=80=E4=B8=AA=E7=BB=B4=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/view/ChartEdit.vue | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index 83d02e9891..a27e6b4191 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -1628,6 +1628,11 @@ export default { } } }) + if (view.type === 'label') { + if (view.xaxis.length > 1) { + view.xaxis.splice(1, view.xaxis.length) + } + } if (view.type.startsWith('pie') || view.type.startsWith('funnel') || view.type.startsWith('text') || From 36d8cf180bdd8a78c28e607f2450d5617c266a8a Mon Sep 17 00:00:00 2001 From: junjun Date: Sat, 2 Apr 2022 10:16:43 +0800 Subject: [PATCH 09/16] =?UTF-8?q?refactor:=20=E8=A7=86=E5=9B=BE=E7=BC=96?= =?UTF-8?q?=E8=BE=91=E5=9D=97=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/views/chart/view/ChartEdit.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/views/chart/view/ChartEdit.vue b/frontend/src/views/chart/view/ChartEdit.vue index a27e6b4191..384714b667 100644 --- a/frontend/src/views/chart/view/ChartEdit.vue +++ b/frontend/src/views/chart/view/ChartEdit.vue @@ -438,7 +438,7 @@ :index="index" :item="item" :chart="chart" - :dimension-data="dimensionD" + :dimension-data="dimension" :quota-data="quota" @onQuotaItemChange="quotaItemChange" @onQuotaItemRemove="quotaItemRemove" From e259ac0d880af4a7b0d6e354fc4b5a9e9103aab4 Mon Sep 17 00:00:00 2001 From: wangjiahao <1522128093@qq.com> Date: Sat, 2 Apr 2022 11:12:03 +0800 Subject: [PATCH 10/16] =?UTF-8?q?fix:=20=E4=BB=AA=E8=A1=A8=E6=9D=BF?= =?UTF-8?q?=E7=BC=96=E8=BE=91=E6=98=AF=E9=A1=B5=E9=9D=A2=E5=81=B6=E5=B0=94?= =?UTF-8?q?=E5=87=BA=E7=8E=B0SQL=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../base/mapper/ext/ExtChartViewMapper.java | 3 + .../base/mapper/ext/ExtChartViewMapper.xml | 96 +++++++++++++++++++ .../controller/chart/ChartViewController.java | 6 +- .../service/chart/ChartViewCacheService.java | 28 ++++++ .../service/chart/ChartViewService.java | 35 ++----- 5 files changed, 137 insertions(+), 31 deletions(-) create mode 100644 backend/src/main/java/io/dataease/service/chart/ChartViewCacheService.java 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 82667c44a0..d35a55d2fd 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 @@ -45,4 +45,7 @@ public interface ExtChartViewMapper { void copyCacheToView(@Param("viewIds") List viewIds ); + int updateToCache(@Param("viewId") String viewId ); + + void copyCache(@Param("sourceViewId") String sourceViewId,@Param("newViewId") String newViewId); } 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 84fb290bcd..531b19914b 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 @@ -89,6 +89,69 @@ chart_view.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, + data_from + ) SELECT + #{newViewId} as 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, + data_from from chart_view_cache + WHERE + chart_view_cache.id = #{sourceViewId} + + @@ -404,4 +467,37 @@ #{viewId} + + + UPDATE chart_view_cache cv, + chart_view 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, + cv.data_from = cve.data_from + where cve.id = cv.id and cv.id =#{viewId} + 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 2f1bd97c90..e23370eb14 100644 --- a/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java +++ b/backend/src/main/java/io/dataease/controller/chart/ChartViewController.java @@ -13,6 +13,7 @@ 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; +import io.dataease.service.chart.ChartViewCacheService; import io.dataease.service.chart.ChartViewService; import io.dataease.service.panel.PanelViewService; import io.swagger.annotations.Api; @@ -34,8 +35,9 @@ import java.util.List; public class ChartViewController { @Resource private ChartViewService chartViewService; + @Resource - private PanelViewService panelViewService; + private ChartViewCacheService chartViewCacheService; @DePermission(type = DePermissionType.PANEL, level = ResourceAuthLevel.PANNEL_LEVEL_MANAGE) @ApiOperation("保存") @@ -150,7 +152,7 @@ public class ChartViewController { @ApiOperation("重置视图缓存") @PostMapping("/resetViewCache/{id}/{panelId}") public void resetViewCache(@PathVariable String id, @PathVariable String panelId) { - chartViewService.resetViewCache(id); + chartViewCacheService.refreshCache(id); } } diff --git a/backend/src/main/java/io/dataease/service/chart/ChartViewCacheService.java b/backend/src/main/java/io/dataease/service/chart/ChartViewCacheService.java new file mode 100644 index 0000000000..07426943e3 --- /dev/null +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewCacheService.java @@ -0,0 +1,28 @@ +package io.dataease.service.chart; + +import io.dataease.base.mapper.ChartViewCacheMapper; +import io.dataease.base.mapper.ext.ExtChartViewMapper; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import javax.annotation.Resource; + +/** + * Author: wangjiahao + * Date: 2022/4/2 + * Description: + */ +@Service +public class ChartViewCacheService { + + @Resource + private ExtChartViewMapper extChartViewMapper; + + @Transactional + public void refreshCache(String viewId){ + if(extChartViewMapper.updateToCache(viewId)==0){ + extChartViewMapper.copyToCache(viewId); + } + } + +} 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 d42d44b804..2f5a670380 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -97,6 +97,8 @@ public class ChartViewService { private PanelGroupExtendDataService extendDataService; @Resource private ExtPanelGroupExtendDataMapper extPanelGroupExtendDataMapper; + @Resource + private ChartViewCacheService chartViewCacheService; //默认使用非公平 @@ -130,7 +132,7 @@ public class ChartViewService { chartView.setUpdateTime(timestamp); chartViewMapper.insertSelective(chartView); // 新建的视图也存入缓存表中 - extChartViewMapper.copyToCache(chartView.getId()); + chartViewCacheService.refreshCache(chartView.getId()); PanelView newPanelView = new PanelView(); newPanelView.setId(UUIDUtil.getUUIDAsString()); @@ -154,27 +156,6 @@ public class ChartViewService { }); } - -// // 直接保存统一到缓存表 -// 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); @@ -268,7 +249,7 @@ public class ChartViewService { //仪表板编辑页面 从缓存表中取数据 缓存表中没有数据则进行插入 result = extChartViewMapper.searchOneFromCache(id); if (result == null) { - extChartViewMapper.copyToCache(id); + chartViewCacheService.refreshCache(id); result = extChartViewMapper.searchOneFromCache(id); } } else { @@ -1047,8 +1028,9 @@ public class ChartViewService { public String chartCopy(String id, String panelId) { String newChartId = UUID.randomUUID().toString(); extChartViewMapper.chartCopy(newChartId, id, panelId); + extChartViewMapper.copyCache(id,newChartId); extPanelGroupExtendDataMapper.copyExtendData(id,newChartId,panelId); - extChartViewMapper.copyToCache(newChartId); + chartViewCacheService.refreshCache(id); return newChartId; } @@ -1082,9 +1064,4 @@ public class ChartViewService { extChartViewMapper.deleteCacheWithPanel(panelId); } - public void resetViewCache(String viewId) { - extChartViewMapper.deleteViewCache(viewId); - - extChartViewMapper.copyToCache(viewId); - } } From f21564f8495510a5160bd6e53f56ebfbba8a6a82 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Sat, 2 Apr 2022 11:40:15 +0800 Subject: [PATCH 11/16] =?UTF-8?q?fix:=20tabs=E6=A0=87=E9=A2=98=E4=B8=BA?= =?UTF-8?q?=E7=A9=BA=E6=98=BE=E7=A4=BA=E5=BC=82=E5=B8=B8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/widget/DeWidget/DeTabs.vue | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frontend/src/components/widget/DeWidget/DeTabs.vue b/frontend/src/components/widget/DeWidget/DeTabs.vue index 74d4d004e3..7e624a59b7 100644 --- a/frontend/src/components/widget/DeWidget/DeTabs.vue +++ b/frontend/src/components/widget/DeWidget/DeTabs.vue @@ -93,7 +93,7 @@ /> {{ $t('table.cancel') }} - {{ $t('table.confirm') }} + {{ $t('table.confirm') }} From 9cf2c2a0be7a268660aa1118b84ab01364d2bfff Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Sat, 2 Apr 2022 11:54:42 +0800 Subject: [PATCH 12/16] =?UTF-8?q?fix:=20=E7=A7=BB=E5=8A=A8=E7=AB=AF?= =?UTF-8?q?=E7=99=BB=E5=BD=95=E8=B4=A6=E5=8F=B7=E9=95=BF=E5=BA=A6=E9=99=90?= =?UTF-8?q?=E5=88=B6=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- mobile/src/locale/en.json | 3 ++- mobile/src/locale/zh-Hans.json | 3 ++- mobile/src/locale/zh-Hant.json | 3 ++- mobile/src/pages/login/index.vue | 8 ++++---- 4 files changed, 10 insertions(+), 7 deletions(-) diff --git a/mobile/src/locale/en.json b/mobile/src/locale/en.json index 12505a46d6..a7b72f12c3 100644 --- a/mobile/src/locale/en.json +++ b/mobile/src/locale/en.json @@ -30,7 +30,8 @@ "passwordPlaceholder": "Please Input Password:", "loginbtn": "Login", "pwdFmtError": "Password Must More Than 6 Characters", - "uOrpwdError": "Invalid Account Or Password" + "uOrpwdError": "Invalid Account Or Password", + "accFmtError": "Account Must More Than 1 Characters" }, "home": { "tab1": "My Favorites", diff --git a/mobile/src/locale/zh-Hans.json b/mobile/src/locale/zh-Hans.json index 780d06d6d6..afaed12e0f 100644 --- a/mobile/src/locale/zh-Hans.json +++ b/mobile/src/locale/zh-Hans.json @@ -29,7 +29,8 @@ "password": "密码:", "passwordPlaceholder": "请输入密码", "loginbtn": "登录", - "pwdFmtError": "密码最短为6个字符", + "pwdFmtError": "密码最短为1个字符", + "accFmtError": "账号最短为1个字符", "uOrpwdError": "无效账号或密码" }, "home": { diff --git a/mobile/src/locale/zh-Hant.json b/mobile/src/locale/zh-Hant.json index e2ca5b6406..a3b8f5f97c 100644 --- a/mobile/src/locale/zh-Hant.json +++ b/mobile/src/locale/zh-Hant.json @@ -31,7 +31,8 @@ "passwordPlaceholder": "請輸入密碼", "loginbtn": "登錄", "pwdFmtError": "密碼最短為6個字符", - "uOrpwdError": "無效賬號或密碼" + "uOrpwdError": "無效賬號或密碼", + "accFmtError": "帳號最短為1個字符" }, "home": { "tab1": "我的收藏", diff --git a/mobile/src/pages/login/index.vue b/mobile/src/pages/login/index.vue index b3a741575b..5b10f91ac3 100644 --- a/mobile/src/pages/login/index.vue +++ b/mobile/src/pages/login/index.vue @@ -67,17 +67,17 @@ async loginByPwd() { - if (this.username.length < 3) { + if (this.username.length < 1) { uni.showToast({ icon: 'none', - title: '账号最短为 3 个字符' + title: this.$t('login.accFmtError') }); return; } - if (this.password.length < 6) { + if (this.password.length < 1) { uni.showToast({ icon: 'none', - title: this.$t('login.pwdFmtError') + title: this.$t('login.passwordPlaceholder') }); return; } From 11800316ae8eaeafa8058037ccde0e0190ebffb5 Mon Sep 17 00:00:00 2001 From: taojinlong Date: Sat, 2 Apr 2022 14:05:33 +0800 Subject: [PATCH 13/16] =?UTF-8?q?fix:=20=E6=95=B0=E6=8D=AE=E6=BA=90?= =?UTF-8?q?=E6=8C=87=E5=AE=9Aschame?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/main/java/io/dataease/provider/QueryProvider.java | 2 +- .../main/java/io/dataease/provider/QueryProviderImpl.java | 2 +- .../java/io/dataease/provider/datasource/EsProvider.java | 2 +- .../dataease/provider/engine/doris/DorisQueryProvider.java | 4 ++-- .../dataease/provider/engine/mysql/MysqlQueryProvider.java | 4 ++-- .../io/dataease/provider/query/ck/CKQueryProvider.java | 4 ++-- .../io/dataease/provider/query/db2/Db2QueryProvider.java | 5 +++-- .../io/dataease/provider/query/es/EsQueryProvider.java | 4 ++-- .../io/dataease/provider/query/hive/HiveQueryProvider.java | 4 ++-- .../provider/query/impala/ImpalaQueryProvider.java | 4 ++-- .../provider/query/mongodb/MongoQueryProvider.java | 4 ++-- .../dataease/provider/query/mysql/MysqlQueryProvider.java | 4 ++-- .../provider/query/oracle/OracleQueryProvider.java | 5 +++-- .../io/dataease/provider/query/pg/PgQueryProvider.java | 7 ++++--- .../provider/query/redshift/RedshiftQueryProvider.java | 5 +++-- .../provider/query/sqlserver/SqlserverQueryProvider.java | 5 +++-- .../java/io/dataease/service/chart/ChartViewService.java | 4 ++-- frontend/src/views/chart/view/TableSelector.vue | 2 +- 18 files changed, 38 insertions(+), 33 deletions(-) diff --git a/backend/src/main/java/io/dataease/provider/QueryProvider.java b/backend/src/main/java/io/dataease/provider/QueryProvider.java index b7ec46a861..36544da31c 100644 --- a/backend/src/main/java/io/dataease/provider/QueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/QueryProvider.java @@ -53,7 +53,7 @@ public abstract class QueryProvider { public abstract String searchTable(String table); - public abstract String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view); + public abstract String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds); public Integer transFieldSize(String type) { return 50; diff --git a/backend/src/main/java/io/dataease/provider/QueryProviderImpl.java b/backend/src/main/java/io/dataease/provider/QueryProviderImpl.java index 7d8083e2ee..c995ca7ac1 100644 --- a/backend/src/main/java/io/dataease/provider/QueryProviderImpl.java +++ b/backend/src/main/java/io/dataease/provider/QueryProviderImpl.java @@ -96,7 +96,7 @@ public class QueryProviderImpl extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { return null; } diff --git a/backend/src/main/java/io/dataease/provider/datasource/EsProvider.java b/backend/src/main/java/io/dataease/provider/datasource/EsProvider.java index 7b88b14edf..077c25c5d9 100644 --- a/backend/src/main/java/io/dataease/provider/datasource/EsProvider.java +++ b/backend/src/main/java/io/dataease/provider/datasource/EsProvider.java @@ -266,7 +266,7 @@ public class EsProvider extends DatasourceProvider { if (Integer.valueOf(versionList[0]) == 6) { esConfiguration.setUri("_xpack/sql"); } - if (Integer.valueOf(versionList[0]) == 7) { + if (Integer.valueOf(versionList[0]) > 6) { esConfiguration.setUri("_sql"); } datasourceRequest.getDatasource().setConfiguration(new Gson().toJson(esConfiguration)); diff --git a/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java b/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java index 45e598be5d..4e2de70788 100644 --- a/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/engine/doris/DorisQueryProvider.java @@ -590,7 +590,7 @@ public class DorisQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(DorisConstants.KEYWORD_TABLE, table)) @@ -663,7 +663,7 @@ public class DorisQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sql + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sql + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/engine/mysql/MysqlQueryProvider.java b/backend/src/main/java/io/dataease/provider/engine/mysql/MysqlQueryProvider.java index b0da249e9a..2591bc95a1 100644 --- a/backend/src/main/java/io/dataease/provider/engine/mysql/MysqlQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/engine/mysql/MysqlQueryProvider.java @@ -590,7 +590,7 @@ public class MysqlQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MysqlConstants.KEYWORD_TABLE, table)) @@ -663,7 +663,7 @@ public class MysqlQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sql + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sql + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java index f3cb75fcf2..7550e43e2a 100644 --- a/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/ck/CKQueryProvider.java @@ -620,7 +620,7 @@ public class CKQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(CKConstants.KEYWORD_TABLE, table)) @@ -693,7 +693,7 @@ public class CKQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/db2/Db2QueryProvider.java b/backend/src/main/java/io/dataease/provider/query/db2/Db2QueryProvider.java index cec11a5fb2..6c7e297fae 100644 --- a/backend/src/main/java/io/dataease/provider/query/db2/Db2QueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/db2/Db2QueryProvider.java @@ -597,12 +597,13 @@ public class Db2QueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(Db2Constants.KEYWORD_TABLE, table)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .build(); + setSchema(tableObj, ds); List yFields = new ArrayList<>(); List yWheres = new ArrayList<>(); List yOrders = new ArrayList<>(); @@ -670,7 +671,7 @@ public class Db2QueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/es/EsQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/es/EsQueryProvider.java index 7d210c209a..89ff8efebd 100644 --- a/backend/src/main/java/io/dataease/provider/query/es/EsQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/es/EsQueryProvider.java @@ -644,7 +644,7 @@ public class EsQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(EsSqlLConstants.KEYWORD_TABLE, table)) @@ -721,7 +721,7 @@ public class EsQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/hive/HiveQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/hive/HiveQueryProvider.java index d9ecac9302..83d86fd151 100644 --- a/backend/src/main/java/io/dataease/provider/query/hive/HiveQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/hive/HiveQueryProvider.java @@ -580,7 +580,7 @@ public class HiveQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(HiveConstants.KEYWORD_TABLE, table)) @@ -653,7 +653,7 @@ public class HiveQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/impala/ImpalaQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/impala/ImpalaQueryProvider.java index 26506da3ee..10dfcc17f3 100644 --- a/backend/src/main/java/io/dataease/provider/query/impala/ImpalaQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/impala/ImpalaQueryProvider.java @@ -577,7 +577,7 @@ public class ImpalaQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(ImpalaConstants.KEYWORD_TABLE, table)) @@ -650,7 +650,7 @@ public class ImpalaQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/mongodb/MongoQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/mongodb/MongoQueryProvider.java index ee6a626966..5a3de4c889 100644 --- a/backend/src/main/java/io/dataease/provider/query/mongodb/MongoQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/mongodb/MongoQueryProvider.java @@ -583,7 +583,7 @@ public class MongoQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MongoConstants.KEYWORD_TABLE, table)) @@ -659,7 +659,7 @@ public class MongoQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java index 293eda3766..7e4bc615a5 100644 --- a/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/mysql/MysqlQueryProvider.java @@ -586,7 +586,7 @@ public class MysqlQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(MySQLConstants.KEYWORD_TABLE, table)) @@ -659,7 +659,7 @@ public class MysqlQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java index 199fc65d99..1dff6cabeb 100644 --- a/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/oracle/OracleQueryProvider.java @@ -633,12 +633,13 @@ public class OracleQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(OracleConstants.KEYWORD_TABLE, table)) .tableAlias(String.format(OracleConstants.ALIAS_FIX, String.format(TABLE_ALIAS_PREFIX, 0))) .build(); + setSchema(tableObj, ds); List yFields = new ArrayList<>(); List yWheres = new ArrayList<>(); List yOrders = new ArrayList<>(); @@ -705,7 +706,7 @@ public class OracleQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/pg/PgQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/pg/PgQueryProvider.java index d77587c505..f5b452b9dd 100644 --- a/backend/src/main/java/io/dataease/provider/query/pg/PgQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/pg/PgQueryProvider.java @@ -371,7 +371,7 @@ public class PgQueryProvider extends QueryProvider { @Override public String getSQLAsTmpTableInfo(String sql, List xAxis, List fieldCustomFilter, List extFilterRequestList, Datasource ds, ChartViewWithBLOBs view) { - return getSQLTableInfo("(" + sqlFix(sql) + ")", xAxis, fieldCustomFilter, extFilterRequestList, null, view); + return getSQLTableInfo("(" + sqlFix(sql) + ")", xAxis, fieldCustomFilter, extFilterRequestList, ds, view); } @@ -608,12 +608,13 @@ public class PgQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .build(); + setSchema(tableObj, ds); List yFields = new ArrayList<>(); List yWheres = new ArrayList<>(); List yOrders = new ArrayList<>(); @@ -681,7 +682,7 @@ public class PgQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/redshift/RedshiftQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/redshift/RedshiftQueryProvider.java index 0b748f1922..78c8e79717 100644 --- a/backend/src/main/java/io/dataease/provider/query/redshift/RedshiftQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/redshift/RedshiftQueryProvider.java @@ -549,12 +549,13 @@ public class RedshiftQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(PgConstants.KEYWORD_TABLE, table)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .build(); + setSchema(tableObj, ds); List yFields = new ArrayList<>(); List yWheres = new ArrayList<>(); List yOrders = new ArrayList<>(); @@ -622,7 +623,7 @@ public class RedshiftQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override diff --git a/backend/src/main/java/io/dataease/provider/query/sqlserver/SqlserverQueryProvider.java b/backend/src/main/java/io/dataease/provider/query/sqlserver/SqlserverQueryProvider.java index 559707fd73..a5dfc97a22 100644 --- a/backend/src/main/java/io/dataease/provider/query/sqlserver/SqlserverQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/query/sqlserver/SqlserverQueryProvider.java @@ -637,12 +637,13 @@ public class SqlserverQueryProvider extends QueryProvider { } @Override - public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { + public String getSQLSummary(String table, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view, Datasource ds) { // 字段汇总 排序等 SQLObj tableObj = SQLObj.builder() .tableName((table.startsWith("(") && table.endsWith(")")) ? table : String.format(SqlServerSQLConstants.KEYWORD_TABLE, table)) .tableAlias(String.format(TABLE_ALIAS_PREFIX, 0)) .build(); + setSchema(tableObj, ds); List yFields = new ArrayList<>(); List yWheres = new ArrayList<>(); List yOrders = new ArrayList<>(); @@ -714,7 +715,7 @@ public class SqlserverQueryProvider extends QueryProvider { @Override public String getSQLSummaryAsTmp(String sql, List yAxis, List fieldCustomFilter, List extFilterRequestList, ChartViewWithBLOBs view) { - return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view); + return getSQLSummary("(" + sqlFix(sql) + ")", yAxis, fieldCustomFilter, extFilterRequestList, view, null); } @Override 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 d42d44b804..b57e8c0d8d 100644 --- a/backend/src/main/java/io/dataease/service/chart/ChartViewService.java +++ b/backend/src/main/java/io/dataease/service/chart/ChartViewService.java @@ -559,7 +559,7 @@ public class ChartViewService { if (StringUtils.equalsIgnoreCase(table.getType(), "db")) { datasourceRequest.setTable(dataTableInfoDTO.getTable()); if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) { - datasourceRequest.setQuery(qp.getSQLSummary(dataTableInfoDTO.getTable(), yAxis, fieldCustomFilter, extFilterList, view)); + datasourceRequest.setQuery(qp.getSQLSummary(dataTableInfoDTO.getTable(), yAxis, fieldCustomFilter, extFilterList, view, ds)); } else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) { datasourceRequest.setQuery(qp.getSQLStack(dataTableInfoDTO.getTable(), xAxis, yAxis, fieldCustomFilter, extFilterList, extStack, ds, view)); } else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) { @@ -623,7 +623,7 @@ public class ChartViewService { datasourceRequest.setTable(tableName); QueryProvider qp = ProviderFactory.getQueryProvider(ds.getType()); if (StringUtils.equalsIgnoreCase("text", view.getType()) || StringUtils.equalsIgnoreCase("gauge", view.getType()) || StringUtils.equalsIgnoreCase("liquid", view.getType())) { - datasourceRequest.setQuery(qp.getSQLSummary(tableName, yAxis, fieldCustomFilter, extFilterList, view)); + datasourceRequest.setQuery(qp.getSQLSummary(tableName, yAxis, fieldCustomFilter, extFilterList, view, ds)); } else if (StringUtils.containsIgnoreCase(view.getType(), "stack")) { datasourceRequest.setQuery(qp.getSQLStack(tableName, xAxis, yAxis, fieldCustomFilter, extFilterList, extStack, ds, view)); } else if (StringUtils.containsIgnoreCase(view.getType(), "scatter")) { diff --git a/frontend/src/views/chart/view/TableSelector.vue b/frontend/src/views/chart/view/TableSelector.vue index 92548c41f8..15b2d7c326 100644 --- a/frontend/src/views/chart/view/TableSelector.vue +++ b/frontend/src/views/chart/view/TableSelector.vue @@ -48,7 +48,7 @@ export default { privileges: { type: String, required: false, - default: 'use' + default: null }, clearEmptyDir: { type: Boolean, From 5d7f9f357f57f8b2f2118fbaed5453758ab30476 Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Sat, 2 Apr 2022 15:01:33 +0800 Subject: [PATCH 14/16] =?UTF-8?q?fix:=20=E8=A7=84=E8=8C=83=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E8=A7=A3=E5=86=B3console=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/custom-component/UserView.vue | 2 +- frontend/src/views/chart/components/shape-attr/SizeSelector.vue | 2 +- .../src/views/chart/components/shape-attr/SizeSelectorAntV.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index 2ebdf30eb3..6beddbea39 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -264,7 +264,7 @@ export default { return this.canvasStyleData.panel.resultCount }, innerPadding() { - return this.element.commonBackground.innerPadding || 0 + return this.element.commonBackground && this.element.commonBackground.innerPadding || 0 }, ...mapState([ 'canvasStyleData', diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue index 05180d7227..28fed28c05 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue @@ -142,7 +142,7 @@ - + diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue index 7b1d2c576c..fdc96396d9 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue @@ -168,7 +168,7 @@ - + From f631fc98d732c08e11e952a5f56affb14db7f2f6 Mon Sep 17 00:00:00 2001 From: fit2cloudrd Date: Sat, 2 Apr 2022 15:04:35 +0800 Subject: [PATCH 15/16] =?UTF-8?q?fix:=20=E6=96=B0=E5=BB=BA=E4=BB=AA?= =?UTF-8?q?=E8=A1=A8=E6=9D=BF=E5=8D=A1=E9=A1=BF=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: wangjiahao <1522128093@qq.com> --- .../base/mapper/ext/ExtSysAuthMapper.java | 4 +- .../base/mapper/ext/ExtSysAuthMapper.xml | 4 + .../commons/constants/SysAuthConstants.java | 16 ++ .../service/dataset/DataSetGroupService.java | 3 + .../service/dataset/DataSetTableService.java | 7 + .../service/datasource/DatasourceService.java | 5 + .../service/panel/PanelGroupService.java | 19 +- .../dataease/service/sys/SysAuthService.java | 5 + .../main/resources/db/migration/V33__1.9.sql | 163 ++++++++++-------- 9 files changed, 145 insertions(+), 81 deletions(-) create mode 100644 backend/src/main/java/io/dataease/commons/constants/SysAuthConstants.java diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtSysAuthMapper.java b/backend/src/main/java/io/dataease/base/mapper/ext/ExtSysAuthMapper.java index d0018e5069..ccfc9857f2 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtSysAuthMapper.java +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtSysAuthMapper.java @@ -5,8 +5,8 @@ import org.apache.ibatis.annotations.Param; public interface ExtSysAuthMapper { - Boolean checkTreeNoManageCount(@Param("userId") Long userId , @Param("modelType") String modelType, @Param("nodeId") String nodeId); - + Boolean checkTreeNoManageCount(@Param("userId") Long userId, @Param("modelType") String modelType, @Param("nodeId") String nodeId); + String copyAuth(@Param("authSource") String authSource, @Param("authSourceType") String authSourceType, @Param("authUser") String authUser); } diff --git a/backend/src/main/java/io/dataease/base/mapper/ext/ExtSysAuthMapper.xml b/backend/src/main/java/io/dataease/base/mapper/ext/ExtSysAuthMapper.xml index 7386356dfe..16a50c7997 100644 --- a/backend/src/main/java/io/dataease/base/mapper/ext/ExtSysAuthMapper.xml +++ b/backend/src/main/java/io/dataease/base/mapper/ext/ExtSysAuthMapper.xml @@ -14,4 +14,8 @@ select if(CHECK_TREE_NO_MANAGE_PRIVILEGE(#{userId},#{modelType},#{nodeId})>0,1,0) + + diff --git a/backend/src/main/java/io/dataease/commons/constants/SysAuthConstants.java b/backend/src/main/java/io/dataease/commons/constants/SysAuthConstants.java new file mode 100644 index 0000000000..a541e0f488 --- /dev/null +++ b/backend/src/main/java/io/dataease/commons/constants/SysAuthConstants.java @@ -0,0 +1,16 @@ +package io.dataease.commons.constants; + +/** + * Author: wangjiahao + * Date: 2022/4/2 + * Description: + */ +public class SysAuthConstants { + + public final static String AUTH_SOURCE_TYPE_PANEL = "panel"; + + public final static String AUTH_SOURCE_TYPE_DATASET = "dataset"; + + public final static String AUTH_SOURCE_TYPE_DATASOURCE = "link"; + +} diff --git a/backend/src/main/java/io/dataease/service/dataset/DataSetGroupService.java b/backend/src/main/java/io/dataease/service/dataset/DataSetGroupService.java index 1b07685c82..cdc13d7d74 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetGroupService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetGroupService.java @@ -7,6 +7,7 @@ import io.dataease.base.mapper.DatasetGroupMapper; import io.dataease.base.mapper.ext.ExtDataSetGroupMapper; import io.dataease.commons.constants.AuthConstants; import io.dataease.commons.constants.DePermissionType; +import io.dataease.commons.constants.SysAuthConstants; import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.BeanUtils; import io.dataease.commons.utils.TreeUtils; @@ -54,8 +55,10 @@ public class DataSetGroupService { datasetGroup.setCreateBy(AuthUtils.getUser().getUsername()); datasetGroup.setCreateTime(System.currentTimeMillis()); datasetGroupMapper.insert(datasetGroup); + String userName = AuthUtils.getUser().getUsername(); // 清理权限缓存 CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME); + sysAuthService.copyAuth(datasetGroup.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET); } else { datasetGroupMapper.updateByPrimaryKeySelective(datasetGroup); } 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 48cf75ce9d..f4ae1d03d2 100644 --- a/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java +++ b/backend/src/main/java/io/dataease/service/dataset/DataSetTableService.java @@ -33,6 +33,7 @@ import io.dataease.provider.datasource.JdbcProvider; import io.dataease.provider.DDLProvider; import io.dataease.provider.QueryProvider; import io.dataease.service.engine.EngineService; +import io.dataease.service.sys.SysAuthService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; @@ -102,6 +103,8 @@ public class DataSetTableService { private PermissionService permissionService; @Resource private EngineService engineService; + @Resource + private SysAuthService sysAuthService; private static boolean isUpdatingDatasetTableStatus = false; private static final String lastUpdateTime = "${__last_update_time__}"; @@ -261,6 +264,10 @@ public class DataSetTableService { datasetTable.setCreateBy(AuthUtils.getUser().getUsername()); datasetTable.setCreateTime(System.currentTimeMillis()); int insert = datasetTableMapper.insert(datasetTable); + // 清理权限缓存 + CacheUtils.removeAll(AuthConstants.USER_PERMISSION_CACHE_NAME); + sysAuthService.copyAuth(datasetTable.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASET); + // 添加表成功后,获取当前表字段和类型,抽象到dataease数据库 if (insert == 1) { saveTableField(datasetTable); diff --git a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java index ee31edf8c3..4d20e3c26b 100644 --- a/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java +++ b/backend/src/main/java/io/dataease/service/datasource/DatasourceService.java @@ -11,6 +11,7 @@ import io.dataease.base.mapper.DatasourceMapper; import io.dataease.base.mapper.ext.ExtDataSourceMapper; import io.dataease.base.mapper.ext.query.GridExample; import io.dataease.commons.constants.DePermissionType; +import io.dataease.commons.constants.SysAuthConstants; import io.dataease.commons.exception.DEException; import io.dataease.commons.model.AuthURD; import io.dataease.commons.utils.AuthUtils; @@ -34,6 +35,7 @@ import io.dataease.provider.datasource.ApiProvider; import io.dataease.provider.datasource.DatasourceProvider; import io.dataease.service.dataset.DataSetGroupService; import io.dataease.service.message.DeMsgutil; +import io.dataease.service.sys.SysAuthService; import org.apache.commons.collections4.CollectionUtils; import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.StringUtils; @@ -57,6 +59,8 @@ public class DatasourceService { private DataSetGroupService dataSetGroupService; @Resource private CommonThreadPool commonThreadPool; + @Resource + private SysAuthService sysAuthService; private static List dsTypes = Arrays.asList("TiDB", "StarRocks", "excel", "mysql", "hive", "impala", "mariadb", "ds_doris", "pg", "sqlServer", "oracle", "mongo", "ck", "db2", "es", "redshift", "api"); @DeCleaner(DePermissionType.DATASOURCE) @@ -73,6 +77,7 @@ public class DatasourceService { checkAndUpdateDatasourceStatus(datasource); datasourceMapper.insertSelective(datasource); handleConnectionPool(datasource, "add"); + sysAuthService.copyAuth(datasource.getId(), SysAuthConstants.AUTH_SOURCE_TYPE_DATASOURCE); return datasource; } 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 1f1c51a8f0..f9f869f5fa 100644 --- a/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java +++ b/backend/src/main/java/io/dataease/service/panel/PanelGroupService.java @@ -6,10 +6,7 @@ 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.AuthConstants; -import io.dataease.commons.constants.CommonConstants; -import io.dataease.commons.constants.DePermissionType; -import io.dataease.commons.constants.PanelConstants; +import io.dataease.commons.constants.*; import io.dataease.commons.utils.AuthUtils; import io.dataease.commons.utils.LogUtil; import io.dataease.commons.utils.TreeUtils; @@ -31,6 +28,7 @@ import io.dataease.service.dataset.DataSetTableService; import io.dataease.service.sys.SysAuthService; import io.swagger.annotations.ApiModelProperty; import org.apache.commons.collections4.CollectionUtils; +import org.apache.commons.lang3.ArrayUtils; import org.apache.commons.lang3.StringUtils; import org.pentaho.di.core.util.UUIDUtil; import org.slf4j.Logger; @@ -94,7 +92,6 @@ public class PanelGroupService { @Resource private ExtPanelGroupExtendDataMapper extPanelGroupExtendDataMapper; - public List tree(PanelGroupRequest panelGroupRequest) { String userId = String.valueOf(AuthUtils.getUser().getUserId()); panelGroupRequest.setUserId(userId); @@ -110,22 +107,21 @@ public class PanelGroupService { } @DeCleaner(DePermissionType.PANEL) -// @Transactional public PanelGroup saveOrUpdate(PanelGroupRequest request) { + String userName = AuthUtils.getUser().getUsername(); String panelId = request.getId(); if(StringUtils.isNotEmpty(panelId)){ panelViewService.syncPanelViews(request); } - if (StringUtils.isEmpty(panelId)) { - // 新建 + if (StringUtils.isEmpty(panelId)) { // 新建 checkPanelName(request.getName(), request.getPid(), PanelConstants.OPT_TYPE_INSERT, null, request.getNodeType()); panelId = newPanel(request); panelGroupMapper.insert(request); // 清理权限缓存 clearPermissionCache(); - } else if ("toDefaultPanel".equals(request.getOptType())) { + sysAuthService.copyAuth(panelId, SysAuthConstants.AUTH_SOURCE_TYPE_PANEL); + } else if ("toDefaultPanel".equals(request.getOptType())) { // 转存为默认仪表板 panelId = UUID.randomUUID().toString(); - // 转存为默认仪表板 PanelGroupWithBLOBs newDefaultPanel = panelGroupMapper.selectByPrimaryKey(request.getId()); newDefaultPanel.setPanelType(PanelConstants.PANEL_TYPE_SYSTEM); newDefaultPanel.setNodeType(PanelConstants.PANEL_NODE_TYPE_PANEL); @@ -139,10 +135,12 @@ public class PanelGroupService { panelGroupMapper.insertSelective(newDefaultPanel); // 清理权限缓存 clearPermissionCache(); + sysAuthService.copyAuth(panelId, SysAuthConstants.AUTH_SOURCE_TYPE_PANEL); } else if ("copy".equals(request.getOptType())) { panelId = this.panelGroupCopy(request, null, true); // 清理权限缓存 clearPermissionCache(); + sysAuthService.copyAuth(panelId, SysAuthConstants.AUTH_SOURCE_TYPE_PANEL); } else if ("move".equals(request.getOptType())) { PanelGroupWithBLOBs panelInfo = panelGroupMapper.selectByPrimaryKey(request.getId()); if (panelInfo.getPid().equalsIgnoreCase(request.getPid())) { @@ -447,5 +445,4 @@ public class PanelGroupService { CacheUtils.removeAll(AuthConstants.DEPT_PANEL_NAME); } - } diff --git a/backend/src/main/java/io/dataease/service/sys/SysAuthService.java b/backend/src/main/java/io/dataease/service/sys/SysAuthService.java index 43478aaa32..f2d440b67c 100644 --- a/backend/src/main/java/io/dataease/service/sys/SysAuthService.java +++ b/backend/src/main/java/io/dataease/service/sys/SysAuthService.java @@ -20,4 +20,9 @@ public class SysAuthService { } } + public void copyAuth(String authSource,String authSourceType){ + String userName = AuthUtils.getUser().getUsername(); + extSysAuthMapper.copyAuth(authSource,authSourceType,userName); + } + } 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 8a7956f258..8cc46a3726 100644 --- a/backend/src/main/resources/db/migration/V33__1.9.sql +++ b/backend/src/main/resources/db/migration/V33__1.9.sql @@ -101,9 +101,7 @@ ADD COLUMN `copy_from` varchar(255) NULL COMMENT '复制来源' AFTER `update_ti ADD COLUMN `copy_id` varchar(255) NULL COMMENT '复制ID' AFTER `copy_from`; --- ---------------------------- --- Function structure for copy_auth --- ---------------------------- + DROP FUNCTION IF EXISTS `copy_auth`; delimiter ;; CREATE FUNCTION `copy_auth`(authSource varchar(255),authSourceType varchar(255),authUser varchar(255)) @@ -130,25 +128,25 @@ select id from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth delete from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth_source_type=authSourceType; INSERT INTO sys_auth ( - id, - auth_source, - auth_source_type, - auth_target, - auth_target_type, - auth_time, - auth_user + id, + auth_source, + auth_source_type, + auth_target, + auth_target_type, + auth_time, + auth_user ) VALUES - ( - authId, - authSource, - authSourceType, - userId, - 'user', - unix_timestamp( - now())* 1000,'auto'); + ( + authId, + authSource, + authSourceType, + userId, + 'user', + unix_timestamp( + now())* 1000,'auto'); - INSERT INTO sys_auth_detail ( + INSERT INTO sys_auth_detail ( id, auth_id, privilege_name, @@ -175,50 +173,52 @@ VALUES insert into sys_auth( id, - auth_source, - auth_source_type, - auth_target, - auth_target_type, - auth_time, - auth_user, - copy_from, - copy_id + auth_source, + auth_source_type, + auth_target, + auth_target_type, + auth_time, + auth_user, + copy_from, + copy_id ) SELECT - uuid() as id, - authSource as auth_source, - authSourceType as auth_source_type, - auth_target, - auth_target_type, - NOW()* 1000 as auth_time, - 'auto' as auth_user, - id as copy_from, - copyId as copy_id + uuid() as id, + authSource as auth_source, + authSourceType as auth_source_type, + auth_target, + auth_target_type, + NOW()* 1000 as auth_time, + 'auto' as auth_user, + id as copy_from, + copyId as copy_id FROM - sys_auth + sys_auth WHERE - auth_source IN ( - SELECT - pid - FROM - v_auth_model - WHERE - id = authSource - AND model_type = authSourceType - ) - AND auth_source_type = authSourceType; + auth_source = ( + SELECT + pid + FROM + v_auth_model + WHERE + id = authSource + AND model_type = authSourceType + ) + AND auth_source_type = authSourceType + and concat(auth_target,'-',auth_target_type) !=CONCAT(userId,'-','user'); + INSERT INTO sys_auth_detail ( - id, - auth_id, - privilege_name, - privilege_type, - privilege_value, - privilege_extend, - remark, - create_user, - create_time, - copy_from, - copy_id + id, + auth_id, + privilege_name, + privilege_type, + privilege_value, + privilege_extend, + remark, + create_user, + create_time, + copy_from, + copy_id ) SELECT uuid() AS id, sa_copy.t_id AS auth_id, @@ -233,16 +233,38 @@ now())* 1000 AS create_time, id AS copy_from, copyId AS copy_id FROM - sys_auth_detail - INNER JOIN ( - SELECT - id AS t_id, - copy_from AS s_id - FROM - sys_auth - WHERE - copy_id = copyId - ) sa_copy ON sys_auth_detail.auth_id = sa_copy.s_id; + sys_auth_detail + INNER JOIN ( + SELECT + id AS t_id, + copy_from AS s_id + FROM + sys_auth + WHERE + copy_id = copyId + ) sa_copy ON sys_auth_detail.auth_id = sa_copy.s_id; + +RETURN 'success'; + +END +;; +delimiter ; + +-- ---------------------------- +-- Function structure for delete_auth_source +-- ---------------------------- +DROP FUNCTION IF EXISTS `delete_auth_source`; +delimiter ;; +CREATE FUNCTION `delete_auth_source`(authSource varchar(255),authSourceType varchar(255)) + RETURNS varchar(255) CHARSET utf8mb4 + READS SQL DATA +BEGIN + +delete from sys_auth_detail where auth_id in ( +select id from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth_source_type=authSourceType +); + +delete from sys_auth where sys_auth.auth_source=authSource and sys_auth.auth_source_type=authSourceType; RETURN 'success'; @@ -336,3 +358,8 @@ CREATE TABLE `panel_outer_params_target_view_info` ( SET FOREIGN_KEY_CHECKS = 1; update `my_plugin` set `name` = 'X-Pack默认插件' where `plugin_id` = 1; update `my_plugin` set `module_name` = 'view-bubblemap-backend' where `plugin_id` = 2; + +DROP TRIGGER `new_auth_panel`; +DROP TRIGGER `new_auth_dataset_group`; +DROP TRIGGER `new_auth_dataset_table`; +DROP TRIGGER `new_auth_link`; From fd0c7b5c9954df1e89eb3671692bebc4d4f56a0e Mon Sep 17 00:00:00 2001 From: fit2cloud-chenyw Date: Sat, 2 Apr 2022 15:01:33 +0800 Subject: [PATCH 16/16] =?UTF-8?q?fix:=20=E8=A7=84=E8=8C=83=E8=AF=AD?= =?UTF-8?q?=E6=B3=95=EF=BC=8C=E8=A7=A3=E5=86=B3console=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- frontend/src/components/canvas/custom-component/UserView.vue | 2 +- frontend/src/views/chart/components/shape-attr/SizeSelector.vue | 2 +- .../src/views/chart/components/shape-attr/SizeSelectorAntV.vue | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/frontend/src/components/canvas/custom-component/UserView.vue b/frontend/src/components/canvas/custom-component/UserView.vue index cfb9e7c787..02672c4052 100644 --- a/frontend/src/components/canvas/custom-component/UserView.vue +++ b/frontend/src/components/canvas/custom-component/UserView.vue @@ -264,7 +264,7 @@ export default { return this.canvasStyleData.panel.resultCount }, innerPadding() { - return this.element.commonBackground.innerPadding || 0 + return this.element.commonBackground && this.element.commonBackground.innerPadding || 0 }, ...mapState([ 'canvasStyleData', diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue index 05180d7227..28fed28c05 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelector.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelector.vue @@ -142,7 +142,7 @@ - + diff --git a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue index 7b1d2c576c..fdc96396d9 100644 --- a/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue +++ b/frontend/src/views/chart/components/shape-attr/SizeSelectorAntV.vue @@ -168,7 +168,7 @@ - +