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">
|
|
|
|
|
|
|
2024-11-24 11:03:01 +08:00
|
|
|
|
<!-- ResultMap映射 -->
|
|
|
|
|
|
<resultMap id="BaseResultMap" type="com.bonus.ai.domain.dataset.AnnotationTaskEntity">
|
|
|
|
|
|
<id column="task_id" property="taskId" jdbcType="BIGINT"/>
|
|
|
|
|
|
<result column="dataset_id" property="datasetId" jdbcType="BIGINT"/>
|
|
|
|
|
|
<result column="task_name" property="taskName" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="task_uuid" property="taskUuid" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="description" property="taskDesc" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="annotation_scene" property="annotateScene" jdbcType="CHAR"/>
|
|
|
|
|
|
<result column="annotation_type" property="annotateType" jdbcType="CHAR"/>
|
|
|
|
|
|
<result column="labels" property="labels" jdbcType="VARCHAR"/>
|
2024-11-25 18:10:02 +08:00
|
|
|
|
<result column="label_studio_project_id" property="labelStudioProjectId" jdbcType="BIGINT"/>
|
2024-11-25 15:08:17 +08:00
|
|
|
|
<result column="isStartTeam" property="isStartTeam" jdbcType="CHAR"/>
|
2024-11-24 11:03:01 +08:00
|
|
|
|
<result column="annotation_status" property="annotateTaskStatus" jdbcType="CHAR"/>
|
|
|
|
|
|
<result column="del_flag" property="delFlag" jdbcType="CHAR"/>
|
|
|
|
|
|
<result column="create_by" property="createBy" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="update_by" property="updateBy" jdbcType="VARCHAR"/>
|
|
|
|
|
|
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
|
|
|
|
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
|
|
|
|
|
</resultMap>
|
2024-11-21 10:18:13 +08:00
|
|
|
|
|
2024-11-25 15:08:17 +08:00
|
|
|
|
|
2024-11-24 11:03:01 +08:00
|
|
|
|
<sql id="selectTaskDetailVo">
|
|
|
|
|
|
select distinct t.task_id, t.task_uuid, t.task_name, t.description, t.annotation_scene, t.annotation_type,
|
|
|
|
|
|
FROM ai_annotation_task t
|
|
|
|
|
|
left join ai_annotation_task_annotator_map a on t.task_id = a.task_id
|
|
|
|
|
|
</sql>
|
2024-11-24 15:45:25 +08:00
|
|
|
|
<update id="deleteTaskById">
|
|
|
|
|
|
UPDATE ai_annotation_task
|
|
|
|
|
|
SET del_flag = '1'
|
|
|
|
|
|
WHERE task_id = #{taskId}
|
|
|
|
|
|
</update>
|
|
|
|
|
|
<update id="deleteAnnotator">
|
|
|
|
|
|
UPDATE ai_annotation_task_annotator_map
|
|
|
|
|
|
SET del_flag = '1'
|
|
|
|
|
|
WHERE task_id = #{taskId}
|
|
|
|
|
|
</update>
|
2024-11-21 10:18:13 +08:00
|
|
|
|
|
2024-11-24 11:03:01 +08:00
|
|
|
|
<!-- TODO 根据标注人id,查询所有标注文件列表-->
|
2024-11-21 10:18:13 +08:00
|
|
|
|
|
2024-11-24 11:03:01 +08:00
|
|
|
|
<!-- TODO 根据审核人id,查询所有需要审核文件列表-->
|
2024-11-21 10:18:13 +08:00
|
|
|
|
|
2024-11-25 15:08:17 +08:00
|
|
|
|
<!-- 根据条件查询标注任务列表 -->
|
|
|
|
|
|
<select id="selectAnnotationTaskList" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskEntity" resultMap="BaseResultMap">
|
|
|
|
|
|
SELECT task_id , dataset_id , task_name , task_uuid, description, annotation_scene, annotation_type ,
|
2024-11-24 11:03:01 +08:00
|
|
|
|
labels, is_annotation_team AS isStartTeam, annotation_status,
|
2024-11-25 18:10:02 +08:00
|
|
|
|
label_studio_project_id, del_flag, create_by , create_time,
|
2024-11-24 11:03:01 +08:00
|
|
|
|
update_by , update_time
|
2024-11-21 10:18:13 +08:00
|
|
|
|
FROM ai_annotation_task
|
|
|
|
|
|
WHERE del_flag = '0'
|
2024-11-25 15:08:17 +08:00
|
|
|
|
<if test="taskId != null">
|
|
|
|
|
|
AND task_id = #{taskId}
|
|
|
|
|
|
</if>
|
2024-11-21 10:18:13 +08:00
|
|
|
|
<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>
|
2024-11-26 14:45:07 +08:00
|
|
|
|
|
|
|
|
|
|
<!-- 我参与的任务 和我创建的 或所有的-->
|
|
|
|
|
|
<select id="selectMyAnnotationTaskList" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskEntity" resultMap="BaseResultMap">
|
|
|
|
|
|
SELECT distinct at.task_id , at.dataset_id , at.task_name , at.task_uuid, at.description, at.annotation_scene, at.annotation_type ,
|
|
|
|
|
|
at.labels, at.is_annotation_team AS isStartTeam, at.annotation_status,
|
|
|
|
|
|
at.label_studio_project_id, at.del_flag, at.create_by , at.create_time,
|
|
|
|
|
|
at.update_by , at.update_time
|
|
|
|
|
|
FROM ai_annotation_task at
|
|
|
|
|
|
left join ai_annotation_task_annotator_map ap on at.task_id = ap.task_id
|
|
|
|
|
|
WHERE at.del_flag = '0'
|
|
|
|
|
|
<choose>
|
|
|
|
|
|
<when test="annotatorId != null and annotatorId != 0 and reviewerId != null and reviewerId != 0 and createBy != null and createBy != 0">
|
|
|
|
|
|
AND (ap.annotator_id = #{annotatorId} or ap.reviewer_id = #{reviewerId} or at.create_by = #{createBy})
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<when test="annotatorId != null and annotatorId != 0 and reviewerId != null and reviewerId != 0 ">
|
|
|
|
|
|
AND (ap.annotator_id = #{annotatorId} or ap.reviewer_id = #{reviewerId})
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<when test="reviewerId != null and reviewerId != 0 and createBy != null and createBy != 0">
|
|
|
|
|
|
AND (ap.reviewer_id = #{reviewerId} or at.create_by = #{createBy})
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<when test="annotatorId != null and annotatorId != 0 and createBy != null and createBy != 0">
|
|
|
|
|
|
AND (ap.annotatorId = #{annotatorId} or at.create_by = #{createBy})
|
|
|
|
|
|
</when>
|
|
|
|
|
|
<when test="createBy != null and createBy != 0">
|
|
|
|
|
|
AND (at.create_by = #{createBy} or at.create_by = #{createBy})
|
|
|
|
|
|
</when>
|
|
|
|
|
|
</choose>
|
|
|
|
|
|
</select>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- <select id="getDatasetList" parameterType="com.bonus.ai.domain.dataset.DataSetEntity" resultMap="DatasetResult">-->
|
|
|
|
|
|
<!-- <include refid="selectDatasetVo"/>-->
|
|
|
|
|
|
<!-- <where>-->
|
|
|
|
|
|
<!-- and ad.del_flag = '0'-->
|
|
|
|
|
|
<!-- <if test="datasetName != null and datasetName != ''">-->
|
|
|
|
|
|
<!-- AND ad.dataset_name like concat('%', #{datasetName}, '%')-->
|
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
|
<!-- <if test="dataType != null and dataType != ''">-->
|
|
|
|
|
|
<!-- AND ad.data_type = #{dataType}-->
|
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
|
<!-- <if test="annotationStatus != null and annotationStatus != ''">-->
|
|
|
|
|
|
<!-- AND ad.annotation_status = #{annotationStatus}-->
|
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
|
<!-- <if test="isPublic != null and isPublic != ''">-->
|
|
|
|
|
|
<!-- AND ad.is_public = #{isPublic}-->
|
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
|
<!-- <if test="createBy != null and createBy != ''">-->
|
|
|
|
|
|
<!-- AND ad.create_by = #{createBy}-->
|
|
|
|
|
|
<!-- </if>-->
|
|
|
|
|
|
<!-- </where>-->
|
|
|
|
|
|
<!-- order by create_time desc-->
|
|
|
|
|
|
<!-- </select>-->
|
|
|
|
|
|
|
2024-11-25 15:08:17 +08:00
|
|
|
|
<!-- <select id="selectAnnotationTaskListUUID" resultType="com.bonus.ai.domain.dataset.AnnotationTaskEntity">-->
|
2024-11-25 18:10:02 +08:00
|
|
|
|
<!-- SELECT label_studio_project_id, task_id, task_uuid FROM ai_annotation_task where del_flag = 0-->
|
2024-11-25 15:08:17 +08:00
|
|
|
|
<!-- </select>-->
|
2024-11-21 10:18:13 +08:00
|
|
|
|
|
2024-11-24 11:03:01 +08:00
|
|
|
|
<!-- 插入标注任务 -->
|
2024-11-26 12:44:17 +08:00
|
|
|
|
<insert id="insertAnnotationTask" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskEntity" useGeneratedKeys="true" keyProperty="taskId">
|
2024-11-24 11:03:01 +08:00
|
|
|
|
INSERT INTO ai_annotation_task
|
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
<if test="datasetId != null">dataset_id,</if>
|
|
|
|
|
|
<if test="taskName != null">task_name,</if>
|
|
|
|
|
|
<if test="taskUuid != null">task_uuid,</if>
|
|
|
|
|
|
<if test="taskDesc != null">description,</if>
|
|
|
|
|
|
<if test="annotateScene != null">annotation_scene,</if>
|
|
|
|
|
|
<if test="annotateType != null">annotation_type,</if>
|
|
|
|
|
|
<if test="labels != null">labels,</if>
|
|
|
|
|
|
<if test="isStartTeam != null">is_annotation_team,</if>
|
|
|
|
|
|
<if test="annotateTaskStatus != null">annotation_status,</if>
|
2024-11-25 18:10:02 +08:00
|
|
|
|
<if test="labelStudioProjectId != null">label_studio_project_id,</if>
|
2024-11-24 11:03:01 +08:00
|
|
|
|
<if test="delFlag != null">del_flag,</if>
|
|
|
|
|
|
<if test="createBy != null">create_by,</if>
|
|
|
|
|
|
create_time,
|
|
|
|
|
|
<if test="updateBy != null">update_by,</if>
|
|
|
|
|
|
<if test="updateTime != null">update_time,</if>
|
|
|
|
|
|
</trim>
|
|
|
|
|
|
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
<if test="datasetId != null">#{datasetId},</if>
|
|
|
|
|
|
<if test="taskName != null">#{taskName},</if>
|
|
|
|
|
|
<if test="taskUuid != null">#{taskUuid},</if>
|
|
|
|
|
|
<if test="taskDesc != null">#{taskDesc},</if>
|
|
|
|
|
|
<if test="annotateScene != null">#{annotateScene},</if>
|
|
|
|
|
|
<if test="annotateType != null">#{annotateType},</if>
|
|
|
|
|
|
<if test="labels != null">#{labels},</if>
|
|
|
|
|
|
<if test="isStartTeam != null">#{isStartTeam},</if>
|
|
|
|
|
|
<if test="annotateTaskStatus != null">#{annotateTaskStatus},</if>
|
2024-11-25 18:10:02 +08:00
|
|
|
|
<if test="labelStudioProjectId != null">#{labelStudioProjectId},</if>
|
2024-11-24 11:03:01 +08:00
|
|
|
|
<if test="delFlag != null">#{delFlag},</if>
|
|
|
|
|
|
<if test="createBy != null">#{createBy},</if>
|
|
|
|
|
|
sysdate(),
|
|
|
|
|
|
<if test="updateBy != null">#{updateBy},</if>
|
|
|
|
|
|
<if test="updateTime != null">#{updateTime},</if>
|
|
|
|
|
|
</trim>
|
|
|
|
|
|
</insert>
|
2024-11-26 12:44:17 +08:00
|
|
|
|
<insert id="insertAnnotTaskannotator" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskAnnotatorEntity">
|
2024-11-24 15:45:25 +08:00
|
|
|
|
INSERT INTO ai_annotation_task_annotator_map
|
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
<if test="taskId != null">
|
|
|
|
|
|
task_id ,
|
2024-11-25 18:10:02 +08:00
|
|
|
|
</if>
|
2024-11-26 12:44:17 +08:00
|
|
|
|
<if test="fileId != null">
|
|
|
|
|
|
file_id ,
|
2024-11-25 18:10:02 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="fileUrl != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
file_url ,
|
2024-11-25 18:10:02 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="labelStudioTaskId != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
label_studio_task_id,
|
2024-11-25 18:10:02 +08:00
|
|
|
|
</if>
|
2024-11-24 15:45:25 +08:00
|
|
|
|
<if test="annotatorId != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
annotator_id ,
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="reviewerId != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
reviewer_id ,
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="description != null and description != ''">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
description ,
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="annotationStatus != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
annotation_status ,
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="annotationResult != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
annotation_result ,
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="annotationResource != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
annotation_resource ,
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
</trim>
|
2024-11-26 12:44:17 +08:00
|
|
|
|
VALUES
|
|
|
|
|
|
<!-- <foreach collection="list" index="index" item="entity" separator=",">-->
|
|
|
|
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
|
|
|
|
<if test="taskId != null">
|
|
|
|
|
|
#{taskId},
|
|
|
|
|
|
</if>
|
2024-11-25 18:10:02 +08:00
|
|
|
|
<if test="fileId != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
#{fileId},
|
2024-11-25 18:10:02 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="fileUrl != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
#{fileUrl},
|
2024-11-25 18:10:02 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="labelStudioTaskId != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
#{labelStudioTaskId},
|
2024-11-25 18:10:02 +08:00
|
|
|
|
</if>
|
2024-11-24 15:45:25 +08:00
|
|
|
|
<if test="annotatorId != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
#{annotatorId},
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="reviewerId != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
#{reviewerId},
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
2024-11-26 12:44:17 +08:00
|
|
|
|
<if test="description != null and entity.description != ''">
|
|
|
|
|
|
#{description} ,
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="annotationStatus != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
#{annotationStatus},
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="annotationResult != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
#{annotationResult},
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
<if test="annotationResource != null">
|
2024-11-26 12:44:17 +08:00
|
|
|
|
#{annotationResource},
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</if>
|
|
|
|
|
|
</trim>
|
2024-11-26 12:44:17 +08:00
|
|
|
|
<!-- </foreach>-->
|
2024-11-24 15:45:25 +08:00
|
|
|
|
</insert>
|
2024-11-24 11:03:01 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据任务ID更新标注任务 -->
|
|
|
|
|
|
<update id="updateAnnotationTaskById" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskEntity">
|
|
|
|
|
|
UPDATE ai_annotation_task
|
|
|
|
|
|
<set>
|
|
|
|
|
|
<if test="datasetId != null">dataset_id = #{datasetId},</if>
|
|
|
|
|
|
<if test="taskName != null">task_name = #{taskName},</if>
|
|
|
|
|
|
<if test="taskUuid != null">task_uuid = #{taskUuid},</if>
|
|
|
|
|
|
<if test="taskDesc != null">description = #{taskDesc},</if>
|
|
|
|
|
|
<if test="annotateScene != null">annotation_scene = #{annotateScene},</if>
|
|
|
|
|
|
<if test="annotateType != null">annotation_type = #{annotateType},</if>
|
|
|
|
|
|
<if test="labels != null">labels = #{labels},</if>
|
|
|
|
|
|
<if test="isStartTeam != null">is_annotation_team = #{isStartTeam},</if>
|
|
|
|
|
|
<if test="annotateTaskStatus != null">annotation_status = #{annotateTaskStatus},</if>
|
2024-11-25 18:10:02 +08:00
|
|
|
|
<if test="labelStudioProjectId != null">label_studio_project_id = #{labelStudioProjectId},</if>
|
2024-11-24 11:03:01 +08:00
|
|
|
|
<if test="delFlag != null">del_flag = #{delFlag},</if>
|
|
|
|
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
|
|
|
|
|
update_time = sysdate(),
|
|
|
|
|
|
</set>
|
|
|
|
|
|
WHERE task_id = #{taskId}
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
<!-- 根据任务ID删除标注任务 (逻辑删除) -->
|
|
|
|
|
|
<update id="deleteAnnotationTaskById" parameterType="long">
|
|
|
|
|
|
UPDATE ai_annotation_task
|
|
|
|
|
|
SET del_flag = '1'
|
|
|
|
|
|
WHERE task_id = #{taskId}
|
|
|
|
|
|
</update>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-11-21 10:18:13 +08:00
|
|
|
|
</mapper>
|