58 lines
2.4 KiB
XML
58 lines
2.4 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="org.xyzh.ai.mapper.AiUploadFileMapper">
|
||
|
|
|
||
|
|
<!-- 基础结果映射 -->
|
||
|
|
<resultMap id="BaseResultMap" type="org.xyzh.common.dto.ai.TbAiUploadFile">
|
||
|
|
<id column="id" property="id" jdbcType="VARCHAR"/>
|
||
|
|
<result column="user_id" property="userID" jdbcType="VARCHAR"/>
|
||
|
|
<result column="conversation_id" property="conversationID" jdbcType="VARCHAR"/>
|
||
|
|
<result column="file_name" property="fileName" jdbcType="VARCHAR"/>
|
||
|
|
<result column="file_path" property="filePath" jdbcType="VARCHAR"/>
|
||
|
|
<result column="file_size" property="fileSize" jdbcType="BIGINT"/>
|
||
|
|
<result column="file_type" property="fileType" jdbcType="VARCHAR"/>
|
||
|
|
<result column="mime_type" property="mimeType" jdbcType="VARCHAR"/>
|
||
|
|
<result column="extracted_text" property="extractedText" jdbcType="LONGVARCHAR"/>
|
||
|
|
<result column="status" property="status" jdbcType="INTEGER"/>
|
||
|
|
<result column="create_time" property="createTime" jdbcType="TIMESTAMP"/>
|
||
|
|
<result column="update_time" property="updateTime" jdbcType="TIMESTAMP"/>
|
||
|
|
</resultMap>
|
||
|
|
|
||
|
|
<!-- 基础字段 -->
|
||
|
|
<sql id="Base_Column_List">
|
||
|
|
id, user_id, conversation_id, file_name, file_path, file_size,
|
||
|
|
file_type, mime_type, extracted_text, status, create_time, update_time
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<!-- 通用条件 -->
|
||
|
|
<sql id="Where_Clause">
|
||
|
|
<where>
|
||
|
|
<if test="userID != null and userID != ''">
|
||
|
|
AND user_id = #{userID}
|
||
|
|
</if>
|
||
|
|
<if test="conversationID != null and conversationID != ''">
|
||
|
|
AND conversation_id = #{conversationID}
|
||
|
|
</if>
|
||
|
|
<if test="fileName != null and fileName != ''">
|
||
|
|
AND file_name LIKE CONCAT('%', #{fileName}, '%')
|
||
|
|
</if>
|
||
|
|
<if test="fileType != null and fileType != ''">
|
||
|
|
AND file_type = #{fileType}
|
||
|
|
</if>
|
||
|
|
<if test="status != null">
|
||
|
|
AND status = #{status}
|
||
|
|
</if>
|
||
|
|
</where>
|
||
|
|
</sql>
|
||
|
|
|
||
|
|
<!-- selectAiUploadFiles -->
|
||
|
|
<select id="selectAiUploadFiles" resultMap="BaseResultMap">
|
||
|
|
SELECT
|
||
|
|
<include refid="Base_Column_List"/>
|
||
|
|
FROM tb_ai_upload_file
|
||
|
|
<include refid="Where_Clause"/>
|
||
|
|
ORDER BY create_time DESC
|
||
|
|
</select>
|
||
|
|
|
||
|
|
</mapper>
|