fix(项目设置): 公共脚本重名校验有误

This commit is contained in:
AgAngle 2024-02-26 10:47:10 +08:00 committed by jianxing
parent bc63de118d
commit d3c02a4264
2 changed files with 3 additions and 1 deletions

View File

@ -53,7 +53,7 @@ public abstract class ScriptProcessorConverter extends MsProcessorConverter<Scri
scriptLanguage = scriptProcessor.getCommonScriptInfo().getScriptLanguage();
script = scriptProcessor.getCommonScriptInfo().getScript();
}
if (scriptLanguage == null) {
if (scriptLanguage == null || StringUtils.equalsIgnoreCase(scriptLanguage, ScriptLanguageType.BEANSHELL_JSR233.name())) {
scriptLanguage = ScriptLanguageType.BEANSHELL.name();
}
testElement.setProperty(JmeterProperty.SCRIPT, script);

View File

@ -147,6 +147,7 @@ public class CustomFunctionService {
private void checkAddExist(CustomFunction customFunction) {
CustomFunctionExample example = new CustomFunctionExample();
example.createCriteria()
.andProjectIdEqualTo(customFunction.getProjectId())
.andNameEqualTo(customFunction.getName());
if (customFunctionMapper.countByExample(example) > 0) {
throw new MSException(ProjectResultCode.CUSTOM_FUNCTION_ALREADY_EXIST);
@ -156,6 +157,7 @@ public class CustomFunctionService {
private void checkUpdateExist(CustomFunction customFunction) {
CustomFunctionExample example = new CustomFunctionExample();
example.createCriteria()
.andProjectIdEqualTo(customFunction.getProjectId())
.andIdNotEqualTo(customFunction.getId())
.andNameEqualTo(customFunction.getName());
if (customFunctionMapper.countByExample(example) > 0) {