增加满足条件的任务列表和任务报表数据

This commit is contained in:
weiweiw 2024-11-26 19:03:55 +08:00
parent fb4353ca7a
commit b570de32a6
5 changed files with 63 additions and 7 deletions

View File

@ -0,0 +1,8 @@
package com.bonus.ai.domain.dataset;
public class AnnotationFileStatusCount {
private String annotationStatus;
private Long recordCount;
// Getters and Setters
}

View File

@ -13,9 +13,9 @@ public class AnnotationTaskAnnotatorEntity {
private Long taskId; // 任务ID
private Long fileId; // 文件ID
private String fileUrl; // 文件URL
private Long labelStudioTaskId; //label studio 里对应的任务id
private String description; // 描述
private String annotationStatus; // 标注状态
private Long labelStudioTaskId = 0L; //label studio 里对应的任务id
private String description = ""; // 描述
private String annotationStatus = "0"; // 标注状态
private String annotationResult; // 标注结果 (JSON串)
private String annotationResource; // 标注资源类型
private String delFlag; // 删除标记

View File

@ -58,5 +58,15 @@ public class AnnotationTaskEntity extends BaseEntity {
private String fileAnnotationStatus;
/**根据任务id 和文件id 返回审核驳回的原因*/
private Long fileId = 0L;
/**任务查询数据*/
private String datasetName;
private String ownerName;
private int status0Count;
private int status1Count;
private int status2Count;
private int status3Count;
private int totalCount;
}

View File

@ -75,13 +75,20 @@
<!-- 我参与的任务 和我创建的 或所有的-->
<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 ,
SELECT ap.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
at.update_by , at.update_time, ad.dataset_name AS datasetName, su.user_name AS ownerName,
SUM(CASE WHEN ap.annotation_status = '0' THEN 1 ELSE 0 END) AS status0Count,
SUM(CASE WHEN ap.annotation_status = '1' THEN 1 ELSE 0 END) AS status1Count,
SUM(CASE WHEN ap.annotation_status = '2' THEN 1 ELSE 0 END) AS status2Count,
SUM(CASE WHEN ap.annotation_status = '3' THEN 1 ELSE 0 END) AS status3Count,
COUNT(*) AS totalCount
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'
LEFT join ai_dataset ad on ad.dataset_id = at.dataset_id
LEFT join sys_user su on su.user_id = at.create_by
WHERE at.del_flag = '0' and ap.annotation_status IN ('0', '1', '2','3')
<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})
@ -99,6 +106,7 @@
AND (at.create_by = #{createBy} or at.create_by = #{createBy})
</when>
</choose>
GROUP BY ap.task_id
</select>
@ -304,4 +312,34 @@
where abf.del_flag = '0' and aat.del_flag = '0' and aat.task_id = #{taskId} and adfm.file_id = #{fileId}
</select>
<!-- 根据任务ID更新标注任务 -->
<update id="updateAnnotationInfo" parameterType="com.bonus.ai.domain.dataset.AnnotationTaskAnnotatorEntity">
UPDATE ai_annotation_task_annotator_map
<set>
<if test="annotation_result != null">annotation_result = #{annotationResult},</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="labelStudioProjectId != null">label_studio_project_id = #{labelStudioProjectId},</if>
<if test="delFlag != null">del_flag = #{delFlag},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</set>
WHERE task_id = #{taskId}
</update>
<!-- resultMap="statusCountResultMap"-->
<select id="countStatusByTaskId" resultType="com.bonus.ai.domain.dataset.AnnotationFileStatusCount">
SELECT annotation_status, COUNT(*) AS record_count
FROM ai_annotation_task_annotator_map
WHERE task_id = #{taskId}
AND annotation_status IN ('0', '1', '2')
GROUP BY annotation_status
</select>
</mapper>

View File

@ -36,7 +36,7 @@ create table ai_annotation_task_annotator_map
file_url varchar(200) default '' comment '文件网络路径',
label_studio_task_id bigint(20) comment "label studio 对应的taskId"
description varchar(500) default '' comment '描述',
annotation_status char(1) comment '0未标注1已标注2已审核4 审核驳回',
annotation_status char(1) comment '0未标注1已标注2已审核3 审核驳回',
annotation_result text comment '标注结果(json串)',
annotation_resource char(1) comment '0人工标注1智能标注',
del_flag char(1) default '0' comment '是否删除(0代表存在,1代表删除)',