From 43819559625eccf0eab403f1e1df5ba9f43714f2 Mon Sep 17 00:00:00 2001 From: ligang Date: Mon, 13 May 2019 16:20:59 +0800 Subject: [PATCH] add title in SqlParameters --- .../escheduler/common/task/sql/SqlParameters.java | 14 ++++++++++++++ .../escheduler/server/worker/task/sql/SqlTask.java | 6 +++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/escheduler-common/src/main/java/cn/escheduler/common/task/sql/SqlParameters.java b/escheduler-common/src/main/java/cn/escheduler/common/task/sql/SqlParameters.java index ae9d8b6904..0dc54b4c70 100644 --- a/escheduler-common/src/main/java/cn/escheduler/common/task/sql/SqlParameters.java +++ b/escheduler-common/src/main/java/cn/escheduler/common/task/sql/SqlParameters.java @@ -73,6 +73,11 @@ public class SqlParameters extends AbstractParameters { */ private List postStatements; + /** + * title + */ + private String title; + /** * receivers */ @@ -139,6 +144,14 @@ public class SqlParameters extends AbstractParameters { this.connParams = connParams; } + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + public String getReceivers() { return receivers; } @@ -190,6 +203,7 @@ public class SqlParameters extends AbstractParameters { ", udfs='" + udfs + '\'' + ", showType='" + showType + '\'' + ", connParams='" + connParams + '\'' + + ", title='" + title + '\'' + ", receivers='" + receivers + '\'' + ", receiversCc='" + receiversCc + '\'' + ", preStatements=" + preStatements + diff --git a/escheduler-server/src/main/java/cn/escheduler/server/worker/task/sql/SqlTask.java b/escheduler-server/src/main/java/cn/escheduler/server/worker/task/sql/SqlTask.java index f984549e72..89822e710c 100644 --- a/escheduler-server/src/main/java/cn/escheduler/server/worker/task/sql/SqlTask.java +++ b/escheduler-server/src/main/java/cn/escheduler/server/worker/task/sql/SqlTask.java @@ -279,7 +279,11 @@ public class SqlTask extends AbstractTask { logger.info("showType is empty,don't need send email"); } else { if (array.size() > 0) { - sendAttachment(taskProps.getNodeName() + " query resultsets ", JSONObject.toJSONString(array, SerializerFeature.WriteMapNullValue)); + if (StringUtils.isNotEmpty(sqlParameters.getTitle())) { + sendAttachment(sqlParameters.getTitle(), JSONObject.toJSONString(array, SerializerFeature.WriteMapNullValue)); + }else{ + sendAttachment(taskProps.getNodeName() + " query resultsets ", JSONObject.toJSONString(array, SerializerFeature.WriteMapNullValue)); + } } }