Merge remote-tracking branch 'origin/master'

This commit is contained in:
2026-04-16 10:20:03 +08:00
2 changed files with 19 additions and 3 deletions

View File

@@ -247,9 +247,23 @@ public class BehaviortreeProcessor {
//获取行为树重复名称个数
Integer num = behaviortreeService.getCountName(newName);
if(num > 0){
Integer count = num + 1;
behaviortree.setName(newName + count);
behaviortree.setEnglishName(newEnglishName + count);
// 从2开始尝试因为基础名称已经存在
int count = 2;
String finalName;
String finalEnglishName;
do {
finalName = newName + "_" + count;
finalEnglishName = newEnglishName + "_" + count;
// 检查当前生成的名称是否存在
num = behaviortreeService.getCountName(finalName);
count++;
} while(num > 0);
behaviortree.setName(finalName);
behaviortree.setEnglishName(finalEnglishName);
} else {
behaviortree.setName(newName);
behaviortree.setEnglishName(newEnglishName);
}
return this.create(behaviortree);
}

View File

@@ -72,6 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="englishName != null and englishName != ''">english_name,</if>
<if test="xmlContent != null">xml_content,</if>
<if test="platformId != null">platform_id,</if>
<if test="scenarioId != null">scenario_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="name != null and name != ''">#{name},</if>
@@ -81,6 +82,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="englishName != null and englishName != ''">#{englishName},</if>
<if test="xmlContent != null">#{xmlContent},</if>
<if test="platformId != null">#{platformId},</if>
<if test="scenarioId != null">#{scenarioId},</if>
</trim>
</insert>