Bonus-Cloud-AI-V2/bonus-modules/bonus-ai/src/main/resources/mapper/AnnotationTaskMapper.xml

83 lines
3.9 KiB
XML
Raw Normal View History

2024-11-21 10:18:13 +08:00
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.bonus.ai.mapper.AnnotationTaskMapper">
<!-- 插入标注任务 -->
<insert id="insertAnnotationTask" parameterType="com.bonus.ai.domain.dataset.AnnotationTask">
INSERT INTO ai_annotation_task (dataset_id, task_name, task_uuid, description,
annotation_scene, annotation_type, labels, is_annotation,
annotation_status, project_id, del_flag, create_by, create_time, update_by, update_time)
VALUES (#{datasetId}, #{taskName}, #{taskUuid}, #{taskDesc},
#{annotateScene}, #{annotateType}, #{labels}, #{isStartTeam},
#{annotateTaskStatus}, #{projectId}, #{delFlag}, #{createBy}, #{createTime}, #{updateBy}, #{updateTime})
</insert>
<!-- 根据任务ID更新标注任务 -->
<update id="updateAnnotationTaskById" parameterType="com.bonus.ai.domain.dataset.AnnotationTask">
UPDATE ai_annotation_task
SET dataset_id = #{datasetId},
task_name = #{taskName},
task_uuid = #{taskUuid},
description = #{taskDesc},
annotation_scene = #{annotateScene},
annotation_type = #{annotateType},
labels = #{labels},
is_annotation = #{isStartTeam},
annotation_status = #{annotateTaskStatus},
project_id = #{projectId},
del_flag = #{delFlag},
create_by = #{createBy},
create_time = #{createTime},
update_by = #{updateBy},
update_time = #{updateTime}
WHERE task_id = #{taskId}
</update>
<!-- 根据任务ID删除标注任务 (逻辑删除) -->
<update id="deleteAnnotationTaskById" parameterType="long">
UPDATE ai_annotation_task
SET del_flag = '1'
WHERE task_id = #{taskId}
</update>
<!-- 根据任务ID查询标注任务 -->
<select id="selectAnnotationTaskById" parameterType="long" resultType="com.bonus.ai.domain.dataset.AnnotationTask">
SELECT task_id AS taskId, dataset_id AS datasetId, task_name AS taskName, task_uuid AS taskUuid,
description AS taskDesc, annotation_scene AS annotateScene, annotation_type AS annotateType,
labels, is_annotation AS isStartTeam, annotation_status AS annotateTaskStatus,
project_id AS projectId, del_flag AS delFlag, create_by AS createBy, create_time AS createTime,
update_by AS updateBy, update_time AS updateTime
FROM ai_annotation_task
WHERE task_id = #{taskId} AND del_flag = '0'
</select>
<!-- 查询标注任务列表 -->
<select id="selectAnnotationTaskList" parameterType="com.bonus.ai.domain.dataset.AnnotationTask" resultType="com.bonus.ai.domain.dataset.AnnotationTask">
SELECT task_id AS taskId, dataset_id AS datasetId, task_name AS taskName, task_uuid AS taskUuid,
description AS taskDesc, annotation_scene AS annotateScene, annotation_type AS annotateType,
labels, is_annotation AS isStartTeam, annotation_status AS annotateTaskStatus,
project_id AS projectId, del_flag AS delFlag, create_by AS createBy, create_time AS createTime,
update_by AS updateBy, update_time AS updateTime
FROM ai_annotation_task
WHERE del_flag = '0'
<if test="datasetId != null">
AND dataset_id = #{datasetId}
</if>
<if test="taskName != null and taskName != ''">
AND task_name LIKE CONCAT('%', #{taskName}, '%')
</if>
<if test="annotateScene != null and annotateScene != ''">
AND annotation_scene = #{annotateScene}
</if>
<if test="annotateType != null and annotateType != ''">
AND annotation_type = #{annotateType}
</if>
<if test="annotateTaskStatus != null and annotateTaskStatus != ''">
AND annotation_status = #{annotateTaskStatus}
</if>
</select>
</mapper>