fix issues
This commit is contained in:
parent
ff38597b16
commit
b110880fe3
|
|
@ -109,8 +109,13 @@ public class DataSetLabelsServiceImpl implements DataSetLabelsService
|
||||||
try{
|
try{
|
||||||
Set<Long> childIds = new HashSet<>();
|
Set<Long> childIds = new HashSet<>();
|
||||||
for (Long labelId : labelIds){
|
for (Long labelId : labelIds){
|
||||||
childIds.addAll(getFileWithChildren(labelId));
|
Set <Long> childSet = getFileWithChildren(labelId);
|
||||||
childIds.add(labelId);
|
if (!childSet.isEmpty()){
|
||||||
|
return AjaxResult.error("节点下存在子节点,不能删除");
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
childIds.add(labelId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// 转换 Set<Long> 为 Long[]
|
// 转换 Set<Long> 为 Long[]
|
||||||
Long[] longArray = childIds.toArray(new Long[0]);
|
Long[] longArray = childIds.toArray(new Long[0]);
|
||||||
|
|
|
||||||
|
|
@ -14,25 +14,28 @@
|
||||||
<result property="updateBy" column="update_by" />
|
<result property="updateBy" column="update_by" />
|
||||||
<result property="updateTime" column="update_time" />
|
<result property="updateTime" column="update_time" />
|
||||||
<result property="createTime" column="create_time" />
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="parentName" column="parentName" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectDataSetLabelsVo">
|
<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>
|
</sql>
|
||||||
|
|
||||||
<select id="selectDataSetLabelsList" parameterType="com.bonus.ai.domain.DataSetLabels" resultMap="DataSetLabelsResult">
|
<select id="selectDataSetLabelsList" parameterType="com.bonus.ai.domain.DataSetLabels" resultMap="DataSetLabelsResult">
|
||||||
<include refid="selectDataSetLabelsVo"/>
|
<include refid="selectDataSetLabelsVo"/>
|
||||||
<where>
|
<where>
|
||||||
del_flag ='0'
|
a.del_flag ='0'
|
||||||
<if test="ancestors != null and ancestors != ''"> and ancestors = #{ancestors}</if>
|
<if test="ancestors != null and ancestors != ''"> and a.ancestors = #{ancestors}</if>
|
||||||
<if test="parentId != null "> and parent_id = #{parentId}</if>
|
<if test="parentId != null "> and a.parent_id = #{parentId}</if>
|
||||||
<if test="labelName != null "> and label_name like concat('%', #{labelName}, '%')</if>
|
<if test="labelName != null "> and a.label_name like concat('%', #{labelName}, '%')</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectDataSetLabelsByLabelId" parameterType="Long" resultMap="DataSetLabelsResult">
|
<select id="selectDataSetLabelsByLabelId" parameterType="Long" resultMap="DataSetLabelsResult">
|
||||||
<include refid="selectDataSetLabelsVo"/>
|
<include refid="selectDataSetLabelsVo"/>
|
||||||
where label_id = #{labelId}
|
where a.label_id = #{labelId}
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<insert id="insertDataSetLabels" parameterType="com.bonus.ai.domain.DataSetLabels" useGeneratedKeys="true" keyProperty="labelId">
|
<insert id="insertDataSetLabels" parameterType="com.bonus.ai.domain.DataSetLabels" useGeneratedKeys="true" keyProperty="labelId">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue