From c97d2da7f8fd95ddfab7b52cf42683a5f9231f7e Mon Sep 17 00:00:00 2001 From: casionone Date: Sat, 7 Oct 2023 22:51:05 +0800 Subject: [PATCH 1/3] code format spotless --- .../common/conf/ConfigurationTest.scala | 2 -- .../executor/TrinoEngineConnExecutor.scala | 2 +- .../restful/api/QueryRestfulApi.java | 32 ++++++++++++++----- 3 files changed, 25 insertions(+), 11 deletions(-) diff --git a/linkis-commons/linkis-common/src/test/scala/org/apache/linkis/common/conf/ConfigurationTest.scala b/linkis-commons/linkis-common/src/test/scala/org/apache/linkis/common/conf/ConfigurationTest.scala index 00ba6be7fc..ebd06bf797 100644 --- a/linkis-commons/linkis-common/src/test/scala/org/apache/linkis/common/conf/ConfigurationTest.scala +++ b/linkis-commons/linkis-common/src/test/scala/org/apache/linkis/common/conf/ConfigurationTest.scala @@ -27,11 +27,9 @@ class ConfigurationTest { Assertions.assertFalse(Configuration.isAdmin("HaDooop")) } - @Test private[conf] def testFormatValue(): Unit = { val confvalue = CommonVars[Int]("linkis.test.error.conf", 456).getValue Assertions.assertTrue(123 == confvalue) } - } diff --git a/linkis-engineconn-plugins/trino/src/main/scala/org/apache/linkis/engineplugin/trino/executor/TrinoEngineConnExecutor.scala b/linkis-engineconn-plugins/trino/src/main/scala/org/apache/linkis/engineplugin/trino/executor/TrinoEngineConnExecutor.scala index c8cb544dd2..a892475bbc 100644 --- a/linkis-engineconn-plugins/trino/src/main/scala/org/apache/linkis/engineplugin/trino/executor/TrinoEngineConnExecutor.scala +++ b/linkis-engineconn-plugins/trino/src/main/scala/org/apache/linkis/engineplugin/trino/executor/TrinoEngineConnExecutor.scala @@ -41,6 +41,7 @@ import org.apache.linkis.engineplugin.trino.password.{ import org.apache.linkis.engineplugin.trino.socket.SocketChannelSocketFactory import org.apache.linkis.engineplugin.trino.utils.{TrinoCode, TrinoSQLHook} import org.apache.linkis.governance.common.paser.SQLCodeParser +import org.apache.linkis.governance.common.utils.JobUtils import org.apache.linkis.manager.common.entity.resource.{ CommonNodeResource, LoadResource, @@ -80,7 +81,6 @@ import scala.collection.JavaConverters._ import com.google.common.cache.{Cache, CacheBuilder} import io.trino.client._ import okhttp3.OkHttpClient -import org.apache.linkis.governance.common.utils.JobUtils class TrinoEngineConnExecutor(override val outputPrintLimit: Int, val id: Int) extends ConcurrentComputationExecutor(outputPrintLimit) { diff --git a/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java b/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java index cbd1729ebf..a18da3a042 100644 --- a/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java +++ b/linkis-public-enhancements/linkis-jobhistory/src/main/java/org/apache/linkis/jobhistory/restful/api/QueryRestfulApi.java @@ -232,14 +232,30 @@ public Message list( /** Method list should not contain subjob, which may cause performance problems. */ @ApiOperation(value = "listundonetasks", notes = "list undone tasks", response = Message.class) @ApiImplicitParams({ - @ApiImplicitParam(name = "startDate", required = false, dataType = "Long", value = "start date"), - @ApiImplicitParam(name = "endDate", required = false, dataType = "Long", value = "end date"), - @ApiImplicitParam(name = "status", required = false, dataType = "String", value = "status"), - @ApiImplicitParam(name = "pageNow", required = false, dataType = "Integer", value = "page now"), - @ApiImplicitParam(name = "pageSize", required = false, dataType = "Integer", value = "page size"), - @ApiImplicitParam(name = "startTaskID", required = false, dataType = "Long", value = "start task id"), - @ApiImplicitParam(name = "engineType", required = false, dataType = "String", value = "engine type"), - @ApiImplicitParam(name = "creator", required = false, dataType = "String", value = "creator") + @ApiImplicitParam( + name = "startDate", + required = false, + dataType = "Long", + value = "start date"), + @ApiImplicitParam(name = "endDate", required = false, dataType = "Long", value = "end date"), + @ApiImplicitParam(name = "status", required = false, dataType = "String", value = "status"), + @ApiImplicitParam(name = "pageNow", required = false, dataType = "Integer", value = "page now"), + @ApiImplicitParam( + name = "pageSize", + required = false, + dataType = "Integer", + value = "page size"), + @ApiImplicitParam( + name = "startTaskID", + required = false, + dataType = "Long", + value = "start task id"), + @ApiImplicitParam( + name = "engineType", + required = false, + dataType = "String", + value = "engine type"), + @ApiImplicitParam(name = "creator", required = false, dataType = "String", value = "creator") }) @RequestMapping(path = "/listundonetasks", method = RequestMethod.GET) public Message listundonetasks( From ea7cbdd3badfe5e0dc2b8abb847a352171fff7c5 Mon Sep 17 00:00:00 2001 From: casionone Date: Sat, 7 Oct 2023 22:52:46 +0800 Subject: [PATCH 2/3] code support to set template conf name --- .../protocol/conf/TemplateConfRequest.java | 15 ++ .../execute/ComputationExecutor.scala | 21 ++ .../impl/TemplateConfInterceptor.scala | 2 +- .../interceptor/impl/TemplateConfUtils.scala | 192 +++++++++++++++--- .../manager/am/restful/EMRestfulApi.java | 2 +- .../label/constant/LabelKeyConstant.java | 2 + .../executor/HiveEngineConnExecutor.scala | 3 + .../dao/TemplateConfigKeyMapper.java | 3 + .../impl/TemplateConfigKeyServiceImpl.java | 15 +- .../mapper/common/TemplateConfigKeyMapper.xml | 10 + 10 files changed, 231 insertions(+), 34 deletions(-) diff --git a/linkis-computation-governance/linkis-computation-governance-common/src/main/java/org/apache/linkis/governance/common/protocol/conf/TemplateConfRequest.java b/linkis-computation-governance/linkis-computation-governance-common/src/main/java/org/apache/linkis/governance/common/protocol/conf/TemplateConfRequest.java index 258f724e82..e8b566cda1 100644 --- a/linkis-computation-governance/linkis-computation-governance-common/src/main/java/org/apache/linkis/governance/common/protocol/conf/TemplateConfRequest.java +++ b/linkis-computation-governance/linkis-computation-governance-common/src/main/java/org/apache/linkis/governance/common/protocol/conf/TemplateConfRequest.java @@ -23,6 +23,13 @@ public class TemplateConfRequest implements RequestProtocol { private String templateUuid; + private String templateName; + + public TemplateConfRequest(String templateUuid, String templateName) { + this.templateUuid = templateUuid; + this.templateName = templateName; + } + public TemplateConfRequest(String templateUuid) { this.templateUuid = templateUuid; } @@ -34,4 +41,12 @@ public String getTemplateUuid() { public void setTemplateUuid(String templateUuid) { this.templateUuid = templateUuid; } + + public String getTemplateName() { + return templateName; + } + + public void setTemplateName(String templateName) { + this.templateName = templateName; + } } diff --git a/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/execute/ComputationExecutor.scala b/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/execute/ComputationExecutor.scala index 96e5a7d480..8a9e1bf8e9 100644 --- a/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/execute/ComputationExecutor.scala +++ b/linkis-computation-governance/linkis-engineconn/linkis-computation-engineconn/src/main/scala/org/apache/linkis/engineconn/computation/executor/execute/ComputationExecutor.scala @@ -51,6 +51,8 @@ import org.apache.commons.lang3.exception.ExceptionUtils import java.util.concurrent.TimeUnit import java.util.concurrent.atomic.AtomicInteger +import scala.collection.JavaConverters._ + import com.google.common.cache.{Cache, CacheBuilder} abstract class ComputationExecutor(val outputPrintLimit: Int = 1000) @@ -354,6 +356,25 @@ abstract class ComputationExecutor(val outputPrintLimit: Int = 1000) } } + /** + * job task log print task params info + * + * @param engineExecutorContext + * @return + * Unit + */ + + def printTaskParamsLog(engineExecutorContext: EngineExecutionContext): Unit = { + val sb = new StringBuilder + engineExecutorContext.getProperties.asScala.foreach { keyAndValue => + sb.append(s"${keyAndValue._1}=${keyAndValue._2.toString}\n") + } + sb.append("\n") + engineExecutorContext.appendStdout( + LogUtils.generateInfo(s" Your job exec with configs:\n${sb.toString()}") + ) + } + def transformTaskStatus(task: EngineConnTask, newStatus: ExecutionNodeStatus): Unit = { val oriStatus = task.getStatus logger.info(s"task ${task.getTaskId} from status $oriStatus to new status $newStatus") diff --git a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/TemplateConfInterceptor.scala b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/TemplateConfInterceptor.scala index e59557efa0..6accd30bd5 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/TemplateConfInterceptor.scala +++ b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/TemplateConfInterceptor.scala @@ -27,7 +27,7 @@ class TemplateConfInterceptor extends EntranceInterceptor { override def apply(jobRequest: JobRequest, logAppender: lang.StringBuilder): JobRequest = { if (EntranceConfiguration.TEMPLATE_CONF_SWITCH.getValue) { - TemplateConfUtils.dealWithStartParams(jobRequest, logAppender) + TemplateConfUtils.dealWithTemplateConf(jobRequest, logAppender) } else { jobRequest } diff --git a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/TemplateConfUtils.scala b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/TemplateConfUtils.scala index a3a7a3f317..d857305370 100644 --- a/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/TemplateConfUtils.scala +++ b/linkis-computation-governance/linkis-entrance/src/main/scala/org/apache/linkis/entrance/interceptor/impl/TemplateConfUtils.scala @@ -18,11 +18,14 @@ package org.apache.linkis.entrance.interceptor.impl import org.apache.linkis.common.conf.Configuration -import org.apache.linkis.common.utils.{Logging, Utils} +import org.apache.linkis.common.exception.LinkisCommonErrorException +import org.apache.linkis.common.log.LogUtils +import org.apache.linkis.common.utils.{CodeAndRunTypeUtils, Logging, Utils} import org.apache.linkis.governance.common.entity.TemplateConfKey import org.apache.linkis.governance.common.entity.job.JobRequest import org.apache.linkis.governance.common.protocol.conf.{TemplateConfRequest, TemplateConfResponse} import org.apache.linkis.manager.label.constant.LabelKeyConstant +import org.apache.linkis.manager.label.utils.LabelUtil import org.apache.linkis.protocol.utils.TaskUtils import org.apache.linkis.rpc.Sender @@ -69,42 +72,175 @@ object TemplateConfUtils extends Logging { }) - def dealWithStartParams(jobRequest: JobRequest, logAppender: lang.StringBuilder): JobRequest = { + private val templateCacheName: LoadingCache[String, util.List[TemplateConfKey]] = CacheBuilder + .newBuilder() + .maximumSize(1000) + .expireAfterWrite(5, TimeUnit.MINUTES) + .build(new CacheLoader[String, util.List[TemplateConfKey]]() { + + override def load(templateName: String): util.List[TemplateConfKey] = { + var templateList = Utils.tryAndWarn { + val sender: Sender = Sender + .getSender(Configuration.CLOUD_CONSOLE_CONFIGURATION_SPRING_APPLICATION_NAME.getValue) + + logger.info(s"load template configuration data templateName:$templateName") + val res = sender.ask(new TemplateConfRequest(null, templateName)) match { + case response: TemplateConfResponse => + logger + .debug(s"${response.getList()}") + response.getList + case _ => + logger + .warn(s"load template configuration data templateName:$templateName loading failed") + new util.ArrayList[TemplateConfKey](0) + } + res + } + if (templateList.size() == 0) { + logger.warn(s"template configuration data loading failed, plaese check warn log") + } + templateList + } + + }) + + /** + * Get user-defined template conf name value + * + * @param code + * :code + * @param languageType + * :SQL,PYTHON + * @return + */ + def getCustomTemplateConfName(code: String, languageType: String): String = { + var templateConfName = ""; + + var varString: String = null + var errString: String = null + var rightVarString: String = null + + languageType match { + case CodeAndRunTypeUtils.LANGUAGE_TYPE_SQL => + varString = """\s*---@set\s*.+\s*""" + rightVarString = """^\s*---@set\s*.+\s*""" + errString = """\s*---@.*""" + case CodeAndRunTypeUtils.LANGUAGE_TYPE_PYTHON | CodeAndRunTypeUtils.LANGUAGE_TYPE_SHELL => + varString = """\s*##@set\s*.+\s*""" + rightVarString = """^\s*##@set\s*.+\s*""" + errString = """\s*##@""" + case CodeAndRunTypeUtils.LANGUAGE_TYPE_SCALA => + varString = """\s*///@set\s*.+\s*""" + rightVarString = """^\s*///@set\s*.+\s*""" + errString = """\s*///@.+""" + case _ => + return templateConfName + } + + val customRegex = varString.r.unanchored + val customRightRegex = rightVarString.r.unanchored + val errRegex = errString.r.unanchored + code.split("\n").foreach { str => + { + + if (customRightRegex.unapplySeq(str).size < customRegex.unapplySeq(str).size) { + logger.warn(s"code:$str is wrong custom template conf name variable format!!!") + } + str match { + case customRegex() => + val clearStr = if (str.endsWith(";")) str.substring(0, str.length - 1) else str + val res: Array[String] = clearStr.split("=") + if (res != null && res.length == 2) { + templateConfName = res(1).trim + logger.info(s"get template conf name $templateConfName") + } else { + if (res.length > 2) { + throw new LinkisCommonErrorException( + 20044, + s"$str template conf name var defined uncorrectly" + ) + } else { + throw new LinkisCommonErrorException( + 20045, + s"template conf name var was defined uncorrectly:$str" + ) + } + } + case errRegex() => + logger.warn( + s"The template conf name var definition is incorrect:$str,if it is not used, it will not run the error, but it is recommended to use the correct specification to define" + ) + case _ => + } + } + } + templateConfName + } + + def dealWithTemplateConf(jobRequest: JobRequest, logAppender: lang.StringBuilder): JobRequest = { jobRequest match { case requestPersistTask: JobRequest => val params = requestPersistTask.getParams val startMap = TaskUtils.getStartupMap(params) - logger.info("jobRequest startMap params :{} ", startMap) - val templateUuid = startMap.getOrDefault(LabelKeyConstant.TEMPLATE_CONF_KEY, "").toString - if (StringUtils.isBlank(templateUuid)) { - logger.debug("jobRequest startMap param template id is empty") + + var templateConflist: util.List[TemplateConfKey] = new util.ArrayList[TemplateConfKey]() + var templateName: String = "" + // only for Creator:IDE, try to get template conf name from code string. eg:---@set ec.resource.name=xxxx + val (user, creator) = LabelUtil.getUserCreator(jobRequest.getLabels) + if ("IDE".equals(creator)) { + val codeType = LabelUtil.getCodeType(jobRequest.getLabels) + templateName = + TemplateConfUtils.getCustomTemplateConfName(jobRequest.getExecutionCode, codeType) + } + + // code template name > start params template uuid + if (StringUtils.isBlank(templateName)) { + logger.debug("jobRequest startMap param template name is empty") + + logger.info("jobRequest startMap params :{} ", startMap) + val templateUuid = startMap.getOrDefault(LabelKeyConstant.TEMPLATE_CONF_KEY, "").toString + + if (StringUtils.isBlank(templateUuid)) { + logger.debug("jobRequest startMap param template id is empty") + } else { + logger.info("try to get template conf list with template uid:{} ", templateUuid) + logAppender.append( + LogUtils + .generateInfo(s"try to get template conf list with template uid:$templateUuid") + ) + templateConflist = templateCache.get(templateUuid) + } + } else { - logger.info("try to get template conf list with templateUid:{} ", templateUuid) - logAppender.append(s"try to get template conf list with templateUid:$templateUuid") - val templateConflist = templateCache.get(templateUuid) - if (templateConflist != null && templateConflist.size() > 0) { - val keyList = new util.HashMap[String, AnyRef]() - templateConflist.asScala.foreach(ele => { - val key = ele.getKey - val oldValue = startMap.get(key) - if (oldValue != null && StringUtils.isNotBlank(oldValue.toString)) { - logger.info(s"key:$key value:$oldValue not empty, skip to deal") - } else { - val newValue = ele.getConfigValue - logger.info(s"key:$key value:$newValue will add to startMap params") - if (TaskUtils.isWithDebugInfo(params)) { - logAppender.append(s"add $key=$newValue\n") - } - keyList.put(key, newValue) - } + logger.info("try to get template conf list with template name:{} ", templateName) + logAppender.append( + LogUtils.generateInfo(s"try to get template conf list with template name:$templateName") + ) + templateConflist = templateCacheName.get(templateName) + } - }) - if (keyList.size() > 0) { - TaskUtils.addStartupMap(params, keyList) + if (templateConflist != null && templateConflist.size() > 0) { + val keyList = new util.HashMap[String, AnyRef]() + templateConflist.asScala.foreach(ele => { + val key = ele.getKey + val oldValue = startMap.get(key) + if (oldValue != null && StringUtils.isNotBlank(oldValue.toString)) { + logger.info(s"key:$key value:$oldValue not empty, skip to deal") + } else { + val newValue = ele.getConfigValue + logger.info(s"key:$key value:$newValue will add to startMap params") + if (TaskUtils.isWithDebugInfo(params)) { + logAppender.append(LogUtils.generateInfo(s"add $key=$newValue\n")) + } + keyList.put(key, newValue) } - } + }) + if (keyList.size() > 0) { + TaskUtils.addStartupMap(params, keyList) + } } + case _ => } jobRequest diff --git a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java index 2cb45b3cd8..1ed66173d4 100644 --- a/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java +++ b/linkis-computation-governance/linkis-manager/linkis-application-manager/src/main/java/org/apache/linkis/manager/am/restful/EMRestfulApi.java @@ -464,7 +464,7 @@ private Message executeECMOperation( ECResourceInfoRecord ecResourceInfoRecord = ecResourceInfoService.getECResourceInfoRecordByInstance(engineInstance); if (Objects.isNull(ecResourceInfoRecord)) { - return Message.error("ECM instance: " + ecmNode.getServiceInstance() + " not exist "); + return Message.error("EC instance: " + engineInstance + " not exist "); } // eg logDirSuffix -> root/20230705/io_file/6d48068a-0e1e-44b5-8eb2-835034db5b30/logs String logDirSuffix = ecResourceInfoRecord.getLogDirSuffix(); diff --git a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/constant/LabelKeyConstant.java b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/constant/LabelKeyConstant.java index 8358e43ce9..7d33b68c7c 100644 --- a/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/constant/LabelKeyConstant.java +++ b/linkis-computation-governance/linkis-manager/linkis-label-common/src/main/java/org/apache/linkis/manager/label/constant/LabelKeyConstant.java @@ -66,5 +66,7 @@ public class LabelKeyConstant { public static final String TEMPLATE_CONF_KEY = "ec.conf.templateId"; + public static final String TEMPLATE_CONF_NAME_KEY = "ec.resource.name"; + public static final String MANAGER_KEY = "manager"; } diff --git a/linkis-engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala b/linkis-engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala index b403eb74ba..931fe806b3 100644 --- a/linkis-engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala +++ b/linkis-engineconn-plugins/hive/src/main/scala/org/apache/linkis/engineplugin/hive/executor/HiveEngineConnExecutor.scala @@ -148,6 +148,9 @@ class HiveEngineConnExecutor( LOG.info(s"set mapreduce.job.tags=LINKIS_$jobId") hiveConf.set("mapreduce.job.tags", s"LINKIS_$jobId") } + + printTaskParamsLog(engineExecutorContext) + if (realCode.trim.length > 500) { engineExecutorContext.appendStdout(s"$getId >> ${realCode.trim.substring(0, 500)} ...") } else engineExecutorContext.appendStdout(s"$getId >> ${realCode.trim}") diff --git a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/dao/TemplateConfigKeyMapper.java b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/dao/TemplateConfigKeyMapper.java index 7dbaef5f02..6862650f27 100644 --- a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/dao/TemplateConfigKeyMapper.java +++ b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/dao/TemplateConfigKeyMapper.java @@ -42,5 +42,8 @@ List selectListByTemplateUuidList( List selectInfoListByTemplateUuid( @Param("templateUuid") String templateUuid); + List selectInfoListByTemplateName( + @Param("templateName") String templateName); + List selectEngineTypeByTemplateUuid(@Param("templateUuid") String templateUuid); } diff --git a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/impl/TemplateConfigKeyServiceImpl.java b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/impl/TemplateConfigKeyServiceImpl.java index b85bd9ba63..8973b683ce 100644 --- a/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/impl/TemplateConfigKeyServiceImpl.java +++ b/linkis-public-enhancements/linkis-configuration/src/main/java/org/apache/linkis/configuration/service/impl/TemplateConfigKeyServiceImpl.java @@ -464,12 +464,19 @@ public Map apply( public TemplateConfResponse queryKeyInfoList(TemplateConfRequest templateConfRequest) { TemplateConfResponse result = new TemplateConfResponse(); String templateUid = templateConfRequest.getTemplateUuid(); - if (StringUtils.isBlank(templateUid)) { + String templateName = templateConfRequest.getTemplateName(); + if (StringUtils.isBlank(templateUid) && StringUtils.isBlank(templateName)) { return result; } - List voList = - templateConfigKeyMapper.selectInfoListByTemplateUuid(templateUid); + List voList = new ArrayList<>(); + + if (StringUtils.isNotBlank(templateUid)) { + voList = templateConfigKeyMapper.selectInfoListByTemplateUuid(templateUid); + + } else { + voList = templateConfigKeyMapper.selectInfoListByTemplateName(templateName); + } List data = new ArrayList<>(); if (voList != null) { for (TemplateConfigKeyVO temp : voList) { @@ -481,7 +488,7 @@ public TemplateConfResponse queryKeyInfoList(TemplateConfRequest templateConfReq data.add(item); } } - result.setList(data); + return result; } } diff --git a/linkis-public-enhancements/linkis-configuration/src/main/resources/mapper/common/TemplateConfigKeyMapper.xml b/linkis-public-enhancements/linkis-configuration/src/main/resources/mapper/common/TemplateConfigKeyMapper.xml index cc1f4ced39..50a11607c6 100644 --- a/linkis-public-enhancements/linkis-configuration/src/main/resources/mapper/common/TemplateConfigKeyMapper.xml +++ b/linkis-public-enhancements/linkis-configuration/src/main/resources/mapper/common/TemplateConfigKeyMapper.xml @@ -139,6 +139,16 @@ + + + +