156 lines
6.7 KiB
XML
156 lines
6.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.DatasetMapper">
|
||
|
|
|
||
|
|
<resultMap id="DatasetResult" type="com.bonus.ai.domain.dataset.DataSetEntity">
|
||
|
|
<id property="datasetId" column="dataset_id"/>
|
||
|
|
<result property="datasetUuid" column="dataset_uuid"/>
|
||
|
|
<result property="datasetName" column="dataset_name"/>
|
||
|
|
<result property="datasetDesc" column="description"/>
|
||
|
|
<result property="dataType" column="data_type"/>
|
||
|
|
<result property="dataSource" column="data_source"/>
|
||
|
|
<result property="inputPath" column="input_path"/>
|
||
|
|
<result property="outputPath" column="output_path"/>
|
||
|
|
<result property="annotationStatus" column="annotation_status"/>
|
||
|
|
<result property="isPublic" column="is_public"/>
|
||
|
|
<result property="delFlag" column="del_flag"/>
|
||
|
|
<result property="createBy" column="create_by"/>
|
||
|
|
<result property="createTime" column="create_time"/>
|
||
|
|
<result property="updateBy" column="update_by"/>
|
||
|
|
<result property="updateTime" column="update_time"/>
|
||
|
|
<result property="isAnnotated" column="is_annotated"/>
|
||
|
|
<!-- <result property="projectId" column="project_id"/>-->
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<sql id="selectDatasetVo">
|
||
|
|
select dataset_id, dataset_uuid, dataset_name, description, data_type, data_source, input_path,
|
||
|
|
output_path, annotation_status, is_annotated, is_public, del_flag, create_by, create_time,
|
||
|
|
update_by, update_time
|
||
|
|
from ai_dataset
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<insert id="insert" parameterType="com.bonus.ai.domain.dataset.DataSetEntity" useGeneratedKeys="true" keyProperty="datasetId">
|
||
|
|
insert into ai_dataset (
|
||
|
|
dataset_uuid, dataset_name, description, data_type, data_source, input_path, output_path,
|
||
|
|
annotation_status, is_annotated, is_public, project_id, del_flag, create_by, create_time, update_by, update_time
|
||
|
|
) values (
|
||
|
|
#{datasetUuid}, #{datasetName}, #{datasetDesc}, #{dataType},#{dataSource}, #{inputPath},
|
||
|
|
#{outputPath}, #{annotationStatus}, #{isAnnotated}, #{isPublic}, #{delFlag}, #{createBy},
|
||
|
|
#{createTime}, #{updateBy}, #{updateTime}
|
||
|
|
)
|
||
|
|
</insert>
|
||
|
|
|
||
|
|
<update id="update" parameterType="com.bonus.ai.domain.dataset.DataSetEntity">
|
||
|
|
update ai_dataset
|
||
|
|
<set>
|
||
|
|
<if test="datasetName != null">dataset_name = #{datasetName},</if>
|
||
|
|
<if test="datasetDesc != null">description = #{datasetDesc},</if>
|
||
|
|
<if test="dataType != null">data_type = #{dataType},</if>
|
||
|
|
<if test="dataSource != null">data_source = #{dataSource},</if>
|
||
|
|
<if test="inputPath != null">input_path = #{inputPath},</if>
|
||
|
|
<if test="outputPath != null">output_path = #{outputPath},</if>
|
||
|
|
<if test="annotationStatus != null">annotation_status = #{annotationStatus},</if>
|
||
|
|
<if test="isPublic != null">is_public = #{isPublic},</if>
|
||
|
|
<if test="isAnnotated != null">is_annotated = #{isAnnotated},</if>
|
||
|
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||
|
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||
|
|
</set>
|
||
|
|
where dataset_id = #{datasetId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<delete id="deleteById">
|
||
|
|
update ai_dataset set del_flag = '1'
|
||
|
|
where dataset_id = #{datasetId}
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<delete id="deleteByIds">
|
||
|
|
update ai_dataset set del_flag = '1'
|
||
|
|
where dataset_id in
|
||
|
|
<foreach collection="datasetIds" item="datasetId" open="(" separator="," close=")">
|
||
|
|
#{datasetId}
|
||
|
|
</foreach>
|
||
|
|
</delete>
|
||
|
|
|
||
|
|
<select id="selectById" resultMap="DatasetResult">
|
||
|
|
select d.dataset_id, d.dataset_uuid, d.dataset_name, d.description, d.data_type, d.data_source, d.input_path,
|
||
|
|
d.output_path, d.annotation_status, d.is_annotated, d.is_public, d.create_by, d.create_time, bf.file_id,
|
||
|
|
bf.file_name, bf.file_url, bf.file_size,bf.is_directory, bf.is_public
|
||
|
|
from ai_dataset d
|
||
|
|
left join ai_dataset_file_map fp on fp.dataset_id = d.dataset_id
|
||
|
|
left join ai_basic_file bf on bf.file_id = fp.file_id
|
||
|
|
where dataset_id = #{datasetId}
|
||
|
|
and del_flag = '0'
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectByUuid" resultMap="DatasetResult">
|
||
|
|
<include refid="selectDatasetVo"/>
|
||
|
|
where dataset_uuid = #{datasetUuid}
|
||
|
|
and del_flag = '0'
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectList" parameterType="com.bonus.ai.domain.dataset.DataSetEntity" resultMap="DatasetResult">
|
||
|
|
<include refid="selectDatasetVo"/>
|
||
|
|
<where>
|
||
|
|
and del_flag = '0'
|
||
|
|
<if test="datasetName != null and datasetName != ''">
|
||
|
|
AND dataset_name like concat('%', #{datasetName}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="dataType != null and dataType != ''">
|
||
|
|
AND data_type = #{dataType}
|
||
|
|
</if>
|
||
|
|
<if test="annotationStatus != null and annotationStatus != ''">
|
||
|
|
AND annotation_status = #{annotationStatus}
|
||
|
|
</if>
|
||
|
|
<if test="isPublic != null and isPublic != ''">
|
||
|
|
AND is_public = #{isPublic}
|
||
|
|
</if>
|
||
|
|
<if test="createBy != null and createBy != ''">
|
||
|
|
AND create_by = #{createBy}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
order by create_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectPublicList" resultMap="DatasetResult">
|
||
|
|
<include refid="selectDatasetVo"/>
|
||
|
|
where is_public = '1'
|
||
|
|
and del_flag = '0'
|
||
|
|
order by create_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectMyList" resultMap="DatasetResult">
|
||
|
|
<include refid="selectDatasetVo"/>
|
||
|
|
where del_flag = '0'
|
||
|
|
and create_by = #{createBy}
|
||
|
|
order by create_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<select id="selectAllList" resultMap="DatasetResult">
|
||
|
|
<include refid="selectDatasetVo"/>
|
||
|
|
where del_flag = '0'
|
||
|
|
and (create_by = #{createBy} or is_public = '1')
|
||
|
|
order by create_time desc
|
||
|
|
</select>
|
||
|
|
|
||
|
|
<update id="updatePublicStatus">
|
||
|
|
update ai_dataset
|
||
|
|
set is_public = #{isPublic},
|
||
|
|
update_time = sysdate()
|
||
|
|
where dataset_id = #{datasetId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<update id="updateAnnotationStatus">
|
||
|
|
update ai_dataset
|
||
|
|
set annotation_status = #{annotationStatus},
|
||
|
|
update_time = sysdate()
|
||
|
|
where dataset_id = #{datasetId}
|
||
|
|
</update>
|
||
|
|
|
||
|
|
<select id="checkDatasetNameUnique" parameterType="String" resultMap="DatasetResult">
|
||
|
|
select dataset_id, dataset_name
|
||
|
|
from ai_dataset
|
||
|
|
where dataset_name = #{datasetName}
|
||
|
|
and del_flag = '0' limit 1
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|