fix issues

This commit is contained in:
weiweiw 2024-11-29 17:09:26 +08:00
parent ff38597b16
commit b110880fe3
2 changed files with 16 additions and 8 deletions

View File

@ -109,8 +109,13 @@ public class DataSetLabelsServiceImpl implements DataSetLabelsService
try{
Set<Long> childIds = new HashSet<>();
for (Long labelId : labelIds){
childIds.addAll(getFileWithChildren(labelId));
childIds.add(labelId);
Set <Long> childSet = getFileWithChildren(labelId);
if (!childSet.isEmpty()){
return AjaxResult.error("节点下存在子节点,不能删除");
}
else {
childIds.add(labelId);
}
}
// 转换 Set<Long> Long[]
Long[] longArray = childIds.toArray(new Long[0]);

View File

@ -14,25 +14,28 @@
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="createTime" column="create_time" />
<result property="parentName" column="parentName" />
</resultMap>
<sql id="selectDataSetLabelsVo">
select label_id, ancestors, parent_id, label_name, del_flag, create_by, update_by, update_time, create_time from ai_labels
select a.label_id, a.ancestors, a.parent_id, a.label_name, a.del_flag, a.create_by, a.update_by, a.update_time, a.create_time, b.label_name AS parentName
from ai_labels a
LEFT JOIN ai_labels b ON a.parent_id = b.label_id
</sql>
<select id="selectDataSetLabelsList" parameterType="com.bonus.ai.domain.DataSetLabels" resultMap="DataSetLabelsResult">
<include refid="selectDataSetLabelsVo"/>
<where>
del_flag ='0'
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
<if test="parentId != null "> and parent_id = #{parentId}</if>
<if test="labelName != null "> and label_name like concat('%', #{labelName}, '%')</if>
a.del_flag ='0'
<if test="ancestors != null and ancestors != ''"> and a.ancestors = #{ancestors}</if>
<if test="parentId != null "> and a.parent_id = #{parentId}</if>
<if test="labelName != null "> and a.label_name like concat('%', #{labelName}, '%')</if>
</where>
</select>
<select id="selectDataSetLabelsByLabelId" parameterType="Long" resultMap="DataSetLabelsResult">
<include refid="selectDataSetLabelsVo"/>
where label_id = #{labelId}
where a.label_id = #{labelId}
</select>
<insert id="insertDataSetLabels" parameterType="com.bonus.ai.domain.DataSetLabels" useGeneratedKeys="true" keyProperty="labelId">