Browse Source

Merge pull request #285 from lgcareer/branch-1.0.2

Support for custom SQL job title
pull/2/head
lgcareer 6 years ago committed by GitHub
parent
commit
cca2877bf4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 14
      escheduler-common/src/main/java/cn/escheduler/common/task/sql/SqlParameters.java
  2. 6
      escheduler-server/src/main/java/cn/escheduler/server/worker/task/sql/SqlTask.java

14
escheduler-common/src/main/java/cn/escheduler/common/task/sql/SqlParameters.java

@ -73,6 +73,11 @@ public class SqlParameters extends AbstractParameters {
*/ */
private List<String> postStatements; private List<String> postStatements;
/**
* title
*/
private String title;
/** /**
* receivers * receivers
*/ */
@ -139,6 +144,14 @@ public class SqlParameters extends AbstractParameters {
this.connParams = connParams; this.connParams = connParams;
} }
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public String getReceivers() { public String getReceivers() {
return receivers; return receivers;
} }
@ -190,6 +203,7 @@ public class SqlParameters extends AbstractParameters {
", udfs='" + udfs + '\'' + ", udfs='" + udfs + '\'' +
", showType='" + showType + '\'' + ", showType='" + showType + '\'' +
", connParams='" + connParams + '\'' + ", connParams='" + connParams + '\'' +
", title='" + title + '\'' +
", receivers='" + receivers + '\'' + ", receivers='" + receivers + '\'' +
", receiversCc='" + receiversCc + '\'' + ", receiversCc='" + receiversCc + '\'' +
", preStatements=" + preStatements + ", preStatements=" + preStatements +

6
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"); logger.info("showType is empty,don't need send email");
} else { } else {
if (array.size() > 0) { 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));
}
} }
} }

Loading…
Cancel
Save