Skip to content

Commit

Permalink
Merge pull request #1575 from wangyu096/issue_1554
Browse files Browse the repository at this point in the history
bugfix: 新增/编辑脚本版本,会导致脚本上的标签丢失 #1554
  • Loading branch information
jsonwan authored Dec 2, 2022
2 parents 1e19bbd + a2a8326 commit c3aa04f
Showing 1 changed file with 4 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,6 @@ public ScriptDTO saveScript(String operator, Long appId, ScriptDTO script) throw
script.setStatus(JobResourceStatusEnum.DRAFT.getValue());

Long scriptVersionId = script.getScriptVersionId();
String scriptId = script.getId();
if (StringUtils.isNotBlank(script.getId())) {
// 更新当前版本
if (script.getScriptVersionId() != null && script.getScriptVersionId() > 0) {
Expand All @@ -314,6 +313,7 @@ public ScriptDTO saveScript(String operator, Long appId, ScriptDTO script) throw
throw new AlreadyExistsException(ErrorCode.SCRIPT_VERSION_NAME_EXIST);
}
scriptVersionId = scriptDAO.saveScriptVersion(script);
script.setScriptVersionId(scriptVersionId);
scriptDAO.updateScript(script);
}
} else {
Expand All @@ -323,17 +323,13 @@ public ScriptDTO saveScript(String operator, Long appId, ScriptDTO script) throw
log.warn("The script name:{} is exist for app:{}", script.getName(), targetAppId);
throw new AlreadyExistsException(ErrorCode.SCRIPT_NAME_DUPLICATE);
}
scriptId = JobUUID.getUUID();
script.setId(scriptId);
script.setId(JobUUID.getUUID());
scriptDAO.saveScript(script);
scriptVersionId = scriptDAO.saveScriptVersion(script);
script.setScriptVersionId(scriptVersionId);
saveScriptTags(appId, script);
}

script.setId(scriptId);
script.setScriptVersionId(scriptVersionId);

saveScriptTags(appId, script);

return scriptDAO.getScriptVersionById(scriptVersionId);
}

Expand Down

0 comments on commit c3aa04f

Please sign in to comment.