195 lines
8.7 KiB
XML
195 lines
8.7 KiB
XML
<?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">
|
||
|
||
<!-- 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"/>
|
||
<result column="project_id" property="projectId" jdbcType="BIGINT"/>
|
||
<result column="isStartTeam" property="isStartTeam" jdbcType="CHAR"/>
|
||
<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>
|
||
|
||
|
||
<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>
|
||
<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>
|
||
|
||
<!-- TODO 根据标注人id,查询所有标注文件列表-->
|
||
|
||
<!-- TODO 根据审核人id,查询所有需要审核文件列表-->
|
||
|
||
<!-- 根据条件查询标注任务列表 -->
|
||
<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 ,
|
||
labels, is_annotation_team AS isStartTeam, annotation_status,
|
||
project_id, del_flag, create_by , create_time,
|
||
update_by , update_time
|
||
FROM ai_annotation_task
|
||
WHERE del_flag = '0'
|
||
<if test="taskId != null">
|
||
AND task_id = #{taskId}
|
||
</if>
|
||
<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>
|
||
<!-- <select id="selectAnnotationTaskListUUID" resultType="com.bonus.ai.domain.dataset.AnnotationTaskEntity">-->
|
||
<!-- SELECT project_id, task_id, task_uuid FROM ai_annotation_task where del_flag = 0-->
|
||
<!-- </select>-->
|
||
|
||
<!-- 插入标注任务 -->
|
||
<insert id="insertAnnotationTask" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskEntity">
|
||
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>
|
||
<if test="projectId != null">project_id,</if>
|
||
<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>
|
||
<if test="projectId != null">#{projectId},</if>
|
||
<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>
|
||
<insert id="insertAnnotTaskannotator">
|
||
INSERT INTO ai_annotation_task_annotator_map
|
||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||
task_id
|
||
<if test="annotatorId != null">
|
||
, annotator_id
|
||
</if>
|
||
<if test="reviewerId != null">
|
||
, reviewer_id
|
||
</if>
|
||
<if test="description != null and description != ''">
|
||
, description
|
||
</if>
|
||
<if test="annotationStatus != null">
|
||
, annotation_status
|
||
</if>
|
||
<if test="annotationResult != null">
|
||
, annotation_result
|
||
</if>
|
||
<if test="annotationResource != null">
|
||
, annotation_resource
|
||
</if>
|
||
</trim>
|
||
<trim prefix="VALUES (" suffix=")" suffixOverrides=",">
|
||
#{taskId}
|
||
<if test="annotatorId != null">
|
||
, #{annotatorId}
|
||
</if>
|
||
<if test="reviewerId != null">
|
||
, #{reviewerId}
|
||
</if>
|
||
<if test="description != null and description != ''">
|
||
, #{description}
|
||
</if>
|
||
<if test="annotationStatus != null">
|
||
, #{annotationStatus}
|
||
</if>
|
||
<if test="annotationResult != null">
|
||
, #{annotationResult}
|
||
</if>
|
||
<if test="annotationResource != null">
|
||
, #{annotationResource}
|
||
</if>
|
||
</trim>
|
||
</insert>
|
||
|
||
|
||
<!-- 根据任务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>
|
||
<if test="projectId != null">project_id = #{projectId},</if>
|
||
<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>
|
||
|
||
|
||
|
||
</mapper>
|