提交代码实现v1.0

This commit is contained in:
wh
2026-04-27 10:27:57 +08:00
parent 849e78658d
commit 5662c1fda9
67 changed files with 2343 additions and 5 deletions

View File

@@ -34,6 +34,17 @@ labelsys:
session:
ttl: PT2H
store-type: redis
annotation:
auto-archive-timeout: PT2H
object-storage:
endpoint: ${OBJECT_STORAGE_ENDPOINT:http://127.0.0.1:9000}
region: ${OBJECT_STORAGE_REGION:us-east-1}
access-key: ${OBJECT_STORAGE_ACCESS_KEY:demo-access-key}
secret-key: ${OBJECT_STORAGE_SECRET_KEY:demo-secret-key}
path-style-access: ${OBJECT_STORAGE_PATH_STYLE:true}
source-bucket: ${OBJECT_STORAGE_SOURCE_BUCKET:source-data}
artifact-bucket: ${OBJECT_STORAGE_ARTIFACT_BUCKET:annotation-artifacts}
export-bucket: ${OBJECT_STORAGE_EXPORT_BUCKET:finetune-export}
logging:
level:

View File

@@ -0,0 +1,50 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.labelsys.backend.mapper.AnnotationResultMapper">
<resultMap id="AnnotationResultResultMap" type="com.labelsys.backend.entity.AnnotationResult">
<id column="id" property="id"/>
<result column="company_id" property="companyId"/>
<result column="creator_id" property="creatorId"/>
<result column="creator_role" property="creatorRole"/>
<result column="task_id" property="taskId"/>
<result column="resource_id" property="resourceId"/>
<result column="qa_content_json" property="qaContentJson"/>
<result column="qa_content_storage_mode" property="qaContentStorageMode"/>
<result column="qa_content_file_path" property="qaContentFilePath"/>
<result column="diff_summary" property="diffSummary"/>
<result column="requires_manual_review" property="requiresManualReview"/>
<result column="is_deleted" property="isDeleted"/>
<result column="reviewer_id" property="reviewerId"/>
<result column="review_comment" property="reviewComment"/>
<result column="reviewed_at" property="reviewedAt"/>
<result column="created_at" property="createdAt"/>
<result column="updated_at" property="updatedAt"/>
</resultMap>
<sql id="AnnotationResultColumns">
id, company_id, creator_id, creator_role, task_id, resource_id, qa_content_json,
qa_content_storage_mode, qa_content_file_path, diff_summary, requires_manual_review,
is_deleted, reviewer_id, review_comment, reviewed_at, created_at, updated_at
</sql>
<select id="findActiveByIdAndCompanyId" resultMap="AnnotationResultResultMap">
select <include refid="AnnotationResultColumns"/>
from annotation_result
where id = #{id}
and company_id = #{companyId}
and is_deleted = false
limit 1
</select>
<update id="markArchived">
update annotation_result
set is_deleted = true,
reviewer_id = #{reviewerId},
review_comment = #{reviewComment},
reviewed_at = #{reviewedAt},
updated_at = #{reviewedAt}
where id = #{id}
and company_id = #{companyId}
and is_deleted = false
</update>
</mapper>

View File

@@ -0,0 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.labelsys.backend.mapper.AnnotationTaskMapper">
<resultMap id="AnnotationTaskResultMap" type="com.labelsys.backend.entity.AnnotationTask">
<id column="id" property="id"/>
<result column="company_id" property="companyId"/>
<result column="creator_id" property="creatorId"/>
<result column="creator_role" property="creatorRole"/>
<result column="task_name" property="taskName"/>
<result column="industry_type" property="industryType"/>
<result column="task_type" property="taskType"/>
<result column="extract_model_config_id" property="extractModelConfigId"/>
<result column="extract_model_name" property="extractModelName"/>
<result column="extract_model_url" property="extractModelUrl"/>
<result column="extract_model_api_key" property="extractModelApiKey"/>
<result column="verify_model_config_id" property="verifyModelConfigId"/>
<result column="verify_model_name" property="verifyModelName"/>
<result column="verify_model_url" property="verifyModelUrl"/>
<result column="verify_model_api_key" property="verifyModelApiKey"/>
<result column="extract_prompt_config_id" property="extractPromptConfigId"/>
<result column="extract_prompt" property="extractPrompt"/>
<result column="verify_prompt_config_id" property="verifyPromptConfigId"/>
<result column="verify_prompt" property="verifyPrompt"/>
<result column="task_status" property="taskStatus"/>
<result column="is_deleted" property="isDeleted"/>
<result column="started_at" property="startedAt"/>
<result column="finished_at" property="finishedAt"/>
<result column="error_message" property="errorMessage"/>
<result column="created_at" property="createdAt"/>
<result column="updated_at" property="updatedAt"/>
</resultMap>
<sql id="AnnotationTaskColumns">
id, company_id, creator_id, creator_role, task_name, industry_type, task_type,
extract_model_config_id, extract_model_name, extract_model_url, extract_model_api_key,
verify_model_config_id, verify_model_name, verify_model_url, verify_model_api_key,
extract_prompt_config_id, extract_prompt, verify_prompt_config_id, verify_prompt,
task_status, is_deleted, started_at, finished_at, error_message, created_at, updated_at
</sql>
<select id="findByIdAndCompanyId" resultMap="AnnotationTaskResultMap">
select <include refid="AnnotationTaskColumns"/>
from annotation_task
where id = #{id}
and company_id = #{companyId}
and is_deleted = false
limit 1
</select>
</mapper>

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.labelsys.backend.mapper.AnnotationTaskResourceMapper">
<resultMap id="AnnotationTaskResourceResultMap" type="com.labelsys.backend.entity.AnnotationTaskResource">
<id column="id" property="id"/>
<result column="company_id" property="companyId"/>
<result column="task_id" property="taskId"/>
<result column="resource_id" property="resourceId"/>
<result column="created_at" property="createdAt"/>
</resultMap>
<select id="listResourceIdsByTaskId" resultType="java.lang.Long">
select resource_id
from annotation_task_resource
where task_id = #{taskId}
order by resource_id
</select>
<delete id="deleteByTaskId">
delete from annotation_task_resource where task_id = #{taskId}
</delete>
<select id="countByResourceId" resultType="int">
select count(1)
from annotation_task_resource
where resource_id = #{resourceId}
</select>
</mapper>

View File

@@ -0,0 +1,35 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.labelsys.backend.mapper.SourceResourceMapper">
<resultMap id="SourceResourceResultMap" type="com.labelsys.backend.entity.SourceResource">
<id column="id" property="id"/>
<result column="company_id" property="companyId"/>
<result column="creator_id" property="creatorId"/>
<result column="creator_role" property="creatorRole"/>
<result column="resource_name" property="resourceName"/>
<result column="resource_type" property="resourceType"/>
<result column="bucket_name" property="bucketName"/>
<result column="file_path" property="filePath"/>
<result column="file_size" property="fileSize"/>
<result column="source_status" property="sourceStatus"/>
<result column="storage_provider" property="storageProvider"/>
<result column="remark" property="remark"/>
<result column="created_at" property="createdAt"/>
<result column="updated_at" property="updatedAt"/>
</resultMap>
<sql id="SourceResourceColumns">
id, company_id, creator_id, creator_role, resource_name, resource_type, bucket_name, file_path,
file_size, source_status, storage_provider, remark, created_at, updated_at
</sql>
<select id="selectByCompanyIdAndIds" resultMap="SourceResourceResultMap">
select <include refid="SourceResourceColumns"/>
from source_resource
where company_id = #{companyId}
and id in
<foreach collection="resourceIds" item="resourceId" open="(" separator="," close=")">
#{resourceId}
</foreach>
</select>
</mapper>

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "https://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.labelsys.backend.mapper.SysConfigMapper">
<resultMap id="SysConfigResultMap" type="com.labelsys.backend.entity.SysConfig">
<id column="id" property="id"/>
<result column="company_id" property="companyId"/>
<result column="config_type" property="configType"/>
<result column="config_name" property="configName"/>
<result column="config_value" property="configValue"/>
<result column="status" property="status"/>
<result column="creator_id" property="creatorId"/>
<result column="created_at" property="createdAt"/>
<result column="updated_at" property="updatedAt"/>
</resultMap>
<sql id="SysConfigColumns">
id, company_id, config_type, config_name, config_value, status, creator_id, created_at, updated_at
</sql>
<select id="findByCompanyIdAndConfigName" resultMap="SysConfigResultMap">
select <include refid="SysConfigColumns"/>
from sys_config
where company_id = #{companyId}
and config_name = #{configName}
limit 1
</select>
<select id="findByCompanyIdAndConfigNameAndType" resultMap="SysConfigResultMap">
select <include refid="SysConfigColumns"/>
from sys_config
where company_id = #{companyId}
and config_name = #{configName}
and config_type = #{configType}
limit 1
</select>
</mapper>