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

72 lines
2.9 KiB
XML
Raw Normal View History

2024-11-25 10:56:55 +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.ReleaseVersionMapper">
2024-12-03 09:07:47 +08:00
<insert id="release" useGeneratedKeys="true" keyProperty="versionId">
2024-11-25 10:56:55 +08:00
INSERT INTO ai_dataset_version (version_name, version_description, dataset_id, task_id, create_by)
VALUES (#{versionName}, #{versionDesc}, #{datasetId}, #{taskId}, #{createBy});
</insert>
2024-12-03 09:07:47 +08:00
<insert id="releaseMap">
INSERT INTO ai_version_file_map (version_id, file_id, annotation_result)
VALUES
<foreach collection="taskBasicFile" item="item" index="index" separator=",">
(#{versionId}, #{item.fileId}, #{item.annotationResult})
</foreach>
</insert>
2024-11-25 10:56:55 +08:00
<update id="delete">
update ai_dataset_version set del_flag='1' where version_id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</update>
2024-12-03 09:07:47 +08:00
<delete id="deleteMap">
delete from ai_version_file_map where version_id = #{versionId}
</delete>
2024-11-25 10:56:55 +08:00
<select id="getAllReleaseVersions" resultType="com.bonus.ai.domain.dataset.ReleaseVersionEntity">
2024-12-03 09:07:47 +08:00
SELECT
adv.version_id AS versionId,
ad.dataset_name AS datasetName,
adv.version_name AS versionName,
2024-11-27 13:35:02 +08:00
su.user_name AS releaseUserName,
2024-12-03 09:07:47 +08:00
adv.create_time AS createTime,
aat.task_name AS taskName,
aat.annotation_type AS annotationType,
COUNT(avfm.version_id) AS totalCount
FROM
ai_dataset_version adv
LEFT JOIN ai_dataset ad ON adv.dataset_id = ad.dataset_id
LEFT JOIN sys_user su ON adv.create_by = su.user_id
LEFT JOIN ai_annotation_task aat ON adv.task_id = aat.task_id
LEFT JOIN ai_version_file_map avfm ON adv.version_id = avfm.version_id
WHERE adv.dataset_id =#{datasetId} AND adv.del_flag='0'
2024-11-27 12:19:34 +08:00
<if test="versionName != null and versionName != ''">
2024-12-03 09:07:47 +08:00
AND adv.version_name LIKE CONCAT('%', #{versionName}, '%')
2024-11-27 12:19:34 +08:00
</if>
2024-12-03 09:07:47 +08:00
GROUP BY
adv.version_id,
ad.dataset_name,
adv.version_name,
su.user_name,
adv.create_time,
aat.task_name,
aat.annotation_type
ORDER BY
adv.create_time DESC
2024-11-27 12:51:18 +08:00
2024-11-25 10:56:55 +08:00
</select>
2024-12-03 09:07:47 +08:00
<select id="getReleaseMapList" resultType="com.bonus.ai.domain.DataSetBasicFileEntity">
SELECT
adf.file_name AS fileName,
adf.file_url AS fileUrl,
avfm.annotation_result AS annotationResult
from ai_version_file_map avfm
LEFT JOIN ai_basic_file adf ON avfm.file_id = adf.file_id AND adf.del_flag = '0'
WHERE avfm.version_id =#{versionId}
</select>
2024-12-16 21:42:19 +08:00
<select id="selectVersionName" resultType="java.lang.Integer">
SELECT COUNT(*)
FROM ai_dataset_version
WHERE version_name = #{versionName}
</select>
2024-11-25 10:56:55 +08:00
</mapper>