107 lines
6.0 KiB
XML
107 lines
6.0 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.ruoyi.ai.vector.mapper.KnowledgeFileMapper">
|
|
|
|
<resultMap type="KnowledgeFile" id="KnowledgeFileResult">
|
|
<result property="id" column="id" />
|
|
<result property="knowledgeBaseId" column="knowledge_base_id" />
|
|
<result property="fileName" column="file_name" />
|
|
<result property="filePath" column="file_path" />
|
|
<result property="fileSize" column="file_size" />
|
|
<result property="fileType" column="file_type" />
|
|
<result property="description" column="description" />
|
|
<result property="isVectorized" column="is_vectorized" />
|
|
<result property="vectorizedTime" column="vectorized_time" />
|
|
<result property="uploadTime" column="upload_time" />
|
|
<result property="updatedAt" column="updated_at" />
|
|
<result property="isDeleted" column="is_deleted" />
|
|
</resultMap>
|
|
|
|
<sql id="selectKnowledgeFileVo">
|
|
select id, knowledge_base_id, file_name, file_path, file_size, file_type, description, is_vectorized, vectorized_time, upload_time, updated_at, is_deleted from knowledge_file
|
|
</sql>
|
|
|
|
<select id="selectKnowledgeFileList" parameterType="KnowledgeFile" resultMap="KnowledgeFileResult">
|
|
<include refid="selectKnowledgeFileVo"/>
|
|
<where>
|
|
<if test="knowledgeBaseId != null "> and knowledge_base_id like concat('%', #{knowledgeBaseId}, '%')</if>
|
|
<if test="fileName != null and fileName != ''"> and file_name like concat('%', #{fileName}, '%')</if>
|
|
<if test="filePath != null and filePath != ''"> and file_path like concat('%', #{filePath}, '%')</if>
|
|
<if test="fileSize != null "> and file_size like concat('%', #{fileSize}, '%')</if>
|
|
<if test="fileType != null and fileType != ''"> and file_type like concat('%', #{fileType}, '%')</if>
|
|
<if test="description != null and description != ''"> and description like concat('%', #{description}, '%')</if>
|
|
<if test="isVectorized != null "> and is_vectorized like concat('%', #{isVectorized}, '%')</if>
|
|
<if test="vectorizedTime != null "> and vectorized_time like concat('%', #{vectorizedTime}, '%')</if>
|
|
<if test="uploadTime != null "> and upload_time like concat('%', #{uploadTime}, '%')</if>
|
|
<if test="updatedAt != null "> and updated_at like concat('%', #{updatedAt}, '%')</if>
|
|
<if test="isDeleted != null "> and is_deleted like concat('%', #{isDeleted}, '%')</if>
|
|
</where>
|
|
</select>
|
|
|
|
<select id="selectKnowledgeFileById" parameterType="Long" resultMap="KnowledgeFileResult">
|
|
<include refid="selectKnowledgeFileVo"/>
|
|
where id = #{id}
|
|
</select>
|
|
|
|
<insert id="insertKnowledgeFile" parameterType="KnowledgeFile" useGeneratedKeys="true" keyProperty="id">
|
|
insert into knowledge_file
|
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
|
<if test="knowledgeBaseId != null">knowledge_base_id,</if>
|
|
<if test="fileName != null and fileName != ''">file_name,</if>
|
|
<if test="filePath != null and filePath != ''">file_path,</if>
|
|
<if test="fileSize != null">file_size,</if>
|
|
<if test="fileType != null">file_type,</if>
|
|
<if test="description != null">description,</if>
|
|
<if test="isVectorized != null">is_vectorized,</if>
|
|
<if test="vectorizedTime != null">vectorized_time,</if>
|
|
<if test="uploadTime != null">upload_time,</if>
|
|
<if test="updatedAt != null">updated_at,</if>
|
|
<if test="isDeleted != null">is_deleted,</if>
|
|
</trim>
|
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
|
<if test="knowledgeBaseId != null">#{knowledgeBaseId},</if>
|
|
<if test="fileName != null and fileName != ''">#{fileName},</if>
|
|
<if test="filePath != null and filePath != ''">#{filePath},</if>
|
|
<if test="fileSize != null">#{fileSize},</if>
|
|
<if test="fileType != null">#{fileType},</if>
|
|
<if test="description != null">#{description},</if>
|
|
<if test="isVectorized != null">#{isVectorized},</if>
|
|
<if test="vectorizedTime != null">#{vectorizedTime},</if>
|
|
<if test="uploadTime != null">#{uploadTime},</if>
|
|
<if test="updatedAt != null">#{updatedAt},</if>
|
|
<if test="isDeleted != null">#{isDeleted},</if>
|
|
</trim>
|
|
</insert>
|
|
|
|
<update id="updateKnowledgeFile" parameterType="KnowledgeFile">
|
|
update knowledge_file
|
|
<trim prefix="SET" suffixOverrides=",">
|
|
<if test="knowledgeBaseId != null">knowledge_base_id = #{knowledgeBaseId},</if>
|
|
<if test="fileName != null and fileName != ''">file_name = #{fileName},</if>
|
|
<if test="filePath != null and filePath != ''">file_path = #{filePath},</if>
|
|
<if test="fileSize != null">file_size = #{fileSize},</if>
|
|
<if test="fileType != null">file_type = #{fileType},</if>
|
|
<if test="description != null">description = #{description},</if>
|
|
<if test="isVectorized != null">is_vectorized = #{isVectorized},</if>
|
|
<if test="vectorizedTime != null">vectorized_time = #{vectorizedTime},</if>
|
|
<if test="uploadTime != null">upload_time = #{uploadTime},</if>
|
|
<if test="updatedAt != null">updated_at = #{updatedAt},</if>
|
|
<if test="isDeleted != null">is_deleted = #{isDeleted},</if>
|
|
</trim>
|
|
where id = #{id}
|
|
</update>
|
|
|
|
<delete id="deleteKnowledgeFileById" parameterType="Long">
|
|
delete from knowledge_file where id = #{id}
|
|
</delete>
|
|
|
|
<delete id="deleteKnowledgeFileByIds" parameterType="String">
|
|
delete from knowledge_file where id in
|
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
|
#{id}
|
|
</foreach>
|
|
</delete>
|
|
</mapper>
|