From df0c0b87778fe8fb1d7cf0ec541160efd508240d Mon Sep 17 00:00:00 2001 From: junjie Date: Tue, 6 Jul 2021 11:01:08 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E8=A7=86=E5=9B=BE=E8=BF=87=E6=BB=A4?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8C=85=E5=90=AB=E4=B8=8E=E4=B8=8D=E5=8C=85?= =?UTF-8?q?=E5=90=AB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../dataease/provider/doris/DorisQueryProvider.java | 6 +++--- .../dataease/provider/mysql/MysqlQueryProvider.java | 6 +++--- .../provider/oracle/OracleQueryProvider.java | 6 +++--- frontend/src/lang/en.js | 4 +++- frontend/src/lang/tw.js | 4 +++- frontend/src/lang/zh.js | 4 +++- .../components/filter/DimensionFilterEditor.vue | 13 ++++++++++++- .../chart/components/filter/QuotaFilterEditor.vue | 13 ++++++++++++- .../chart/components/filter/ResultFilterEditor.vue | 13 ++++++++++++- 9 files changed, 54 insertions(+), 15 deletions(-) diff --git a/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java b/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java index f87da730f3..0e1e1ff255 100644 --- a/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/doris/DorisQueryProvider.java @@ -200,7 +200,7 @@ public class DorisQueryProvider extends QueryProvider { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')"); } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { - filter.append("%").append(f.getValue()).append("%"); + filter.append("'%").append(f.getValue()).append("%'"); } else { filter.append("'").append(f.getValue()).append("'"); } @@ -241,7 +241,7 @@ public class DorisQueryProvider extends QueryProvider { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')"); } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { - filter.append("%").append(f.getValue()).append("%"); + filter.append("'%").append(f.getValue()).append("%'"); } else { filter.append("'").append(f.getValue()).append("'"); } @@ -327,7 +327,7 @@ public class DorisQueryProvider extends QueryProvider { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')"); } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { - filter.append("%").append(f.getValue()).append("%"); + filter.append("'%").append(f.getValue()).append("%'"); } else { filter.append("'").append(f.getValue()).append("'"); } diff --git a/backend/src/main/java/io/dataease/provider/mysql/MysqlQueryProvider.java b/backend/src/main/java/io/dataease/provider/mysql/MysqlQueryProvider.java index 048e774332..ac7dd0406b 100644 --- a/backend/src/main/java/io/dataease/provider/mysql/MysqlQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/mysql/MysqlQueryProvider.java @@ -205,7 +205,7 @@ public class MysqlQueryProvider extends QueryProvider { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')"); } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { - filter.append("%").append(f.getValue()).append("%"); + filter.append("'%").append(f.getValue()).append("%'"); } else { filter.append("'").append(f.getValue()).append("'"); } @@ -247,7 +247,7 @@ public class MysqlQueryProvider extends QueryProvider { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')"); } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { - filter.append("%").append(f.getValue()).append("%"); + filter.append("'%").append(f.getValue()).append("%'"); } else { filter.append("'").append(f.getValue()).append("'"); } @@ -333,7 +333,7 @@ public class MysqlQueryProvider extends QueryProvider { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')"); } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { - filter.append("%").append(f.getValue()).append("%"); + filter.append("'%").append(f.getValue()).append("%'"); } else { filter.append("'").append(f.getValue()).append("'"); } diff --git a/backend/src/main/java/io/dataease/provider/oracle/OracleQueryProvider.java b/backend/src/main/java/io/dataease/provider/oracle/OracleQueryProvider.java index 4f4f633e82..6bb4c06bac 100644 --- a/backend/src/main/java/io/dataease/provider/oracle/OracleQueryProvider.java +++ b/backend/src/main/java/io/dataease/provider/oracle/OracleQueryProvider.java @@ -239,7 +239,7 @@ public class OracleQueryProvider extends QueryProvider { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')"); } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { - filter.append("%").append(f.getValue()).append("%"); + filter.append("'%").append(f.getValue()).append("%'"); } else { filter.append("'").append(f.getValue()).append("'"); } @@ -281,7 +281,7 @@ public class OracleQueryProvider extends QueryProvider { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')"); } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { - filter.append("%").append(f.getValue()).append("%"); + filter.append("'%").append(f.getValue()).append("%'"); } else { filter.append("'").append(f.getValue()).append("'"); } @@ -367,7 +367,7 @@ public class OracleQueryProvider extends QueryProvider { } else if (StringUtils.containsIgnoreCase(f.getTerm(), "in")) { filter.append("('").append(StringUtils.join(f.getValue(), "','")).append("')"); } else if (StringUtils.containsIgnoreCase(f.getTerm(), "like")) { - filter.append("%").append(f.getValue()).append("%"); + filter.append("'%").append(f.getValue()).append("%'"); } else { filter.append("'").append(f.getValue()).append("'"); } diff --git a/frontend/src/lang/en.js b/frontend/src/lang/en.js index 161ad73a73..17a002a4b4 100644 --- a/frontend/src/lang/en.js +++ b/frontend/src/lang/en.js @@ -790,7 +790,9 @@ export default { split_color: 'Split Color', shadow: 'Shadow', condition: 'Filter Value', - filter_value_can_null: 'Filter value can not empty' + filter_value_can_null: 'Filter value can not empty', + filter_like: 'Contain', + filter_not_like: 'Not Contain' }, dataset: { sheet_warn: 'There are multiple sheet pages, and the first one is extracted by default', diff --git a/frontend/src/lang/tw.js b/frontend/src/lang/tw.js index d1e2b4ac50..cc3fa99eac 100644 --- a/frontend/src/lang/tw.js +++ b/frontend/src/lang/tw.js @@ -790,7 +790,9 @@ export default { split_color: '分割顏色', shadow: '陰影', condition: '過濾值', - filter_value_can_null: '過濾值不能為空' + filter_value_can_null: '過濾值不能為空', + filter_like: '包含', + filter_not_like: '不包含' }, dataset: { sheet_warn: '有多個sheet頁面,默認抽取第一個', diff --git a/frontend/src/lang/zh.js b/frontend/src/lang/zh.js index 5c6f80d34e..9913b3bc58 100644 --- a/frontend/src/lang/zh.js +++ b/frontend/src/lang/zh.js @@ -790,7 +790,9 @@ export default { split_color: '分割颜色', shadow: '阴影', condition: '过滤值', - filter_value_can_null: '过滤值不能为空' + filter_value_can_null: '过滤值不能为空', + filter_like: '包含', + filter_not_like: '不包含' }, dataset: { sheet_warn: '有多个 Sheet 页,默认抽取第一个', diff --git a/frontend/src/views/chart/components/filter/DimensionFilterEditor.vue b/frontend/src/views/chart/components/filter/DimensionFilterEditor.vue index d6cca088f0..a5dd51d769 100644 --- a/frontend/src/views/chart/components/filter/DimensionFilterEditor.vue +++ b/frontend/src/views/chart/components/filter/DimensionFilterEditor.vue @@ -53,7 +53,18 @@ export default { value: 'not_eq', label: this.$t('chart.filter_not_eq') }] - }, { + }, + { + label: '', + options: [{ + value: 'like', + label: this.$t('chart.filter_like') + }, { + value: 'not like', + label: this.$t('chart.filter_not_like') + }] + }, + { label: '', options: [{ value: 'lt', diff --git a/frontend/src/views/chart/components/filter/QuotaFilterEditor.vue b/frontend/src/views/chart/components/filter/QuotaFilterEditor.vue index f5d1bf50ec..45df54cb13 100644 --- a/frontend/src/views/chart/components/filter/QuotaFilterEditor.vue +++ b/frontend/src/views/chart/components/filter/QuotaFilterEditor.vue @@ -53,7 +53,18 @@ export default { value: 'not_eq', label: this.$t('chart.filter_not_eq') }] - }, { + }, + { + label: '', + options: [{ + value: 'like', + label: this.$t('chart.filter_like') + }, { + value: 'not like', + label: this.$t('chart.filter_not_like') + }] + }, + { label: '', options: [{ value: 'lt', diff --git a/frontend/src/views/chart/components/filter/ResultFilterEditor.vue b/frontend/src/views/chart/components/filter/ResultFilterEditor.vue index bcbef5f0bb..6a97faa7d0 100644 --- a/frontend/src/views/chart/components/filter/ResultFilterEditor.vue +++ b/frontend/src/views/chart/components/filter/ResultFilterEditor.vue @@ -69,7 +69,18 @@ export default { value: 'not_eq', label: this.$t('chart.filter_not_eq') }] - }, { + }, + { + label: '', + options: [{ + value: 'like', + label: this.$t('chart.filter_like') + }, { + value: 'not like', + label: this.$t('chart.filter_not_like') + }] + }, + { label: '', options: [{ value: 'lt',