fix: 知识库文档管理搜索条件修改
This commit is contained in:
parent
996bb9481a
commit
e29ac67a91
|
|
@ -37,15 +37,21 @@
|
|||
FROM t_dataset_files
|
||||
WHERE dify_dataset_id = #{difyDatasetId}
|
||||
AND is_deleted = false
|
||||
<choose>
|
||||
<when test="fileName != null and fileName != ''">
|
||||
<!-- 当 fileName 不为空时,忽略 parentId 条件 -->
|
||||
AND name ILIKE CONCAT('%', #{fileName}, '%')
|
||||
</when>
|
||||
<otherwise>
|
||||
<!-- 当 fileName 为空时,应用 parentId 条件 -->
|
||||
<if test="parentId != null">
|
||||
AND parent_id = #{parentId}
|
||||
</if>
|
||||
<if test="parentId == null">
|
||||
AND parent_id IS NULL
|
||||
</if>
|
||||
<if test="fileName != null and fileName != ''">
|
||||
AND name ILIKE CONCAT('%', #{fileName}, '%')
|
||||
</if>
|
||||
</otherwise>
|
||||
</choose>
|
||||
<if test="orderBy != null and orderBy != ''">
|
||||
ORDER BY
|
||||
CASE WHEN type = 'folder' THEN 0 ELSE 1 END,
|
||||
|
|
@ -64,6 +70,9 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<!-- 根据知识库id和parent_id 查询总数 -->
|
||||
<select id="countByDatasetIdAndParentId" resultType="int">
|
||||
SELECT COUNT(*)
|
||||
|
|
@ -81,6 +90,8 @@
|
|||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<!-- 根据知识库id和name查询 文件/文件夹 -->
|
||||
<select id="selectByDatasetIdAndName" resultMap="TDatasetFilesResultMap">
|
||||
SELECT <include refid="Base_Column_List"/>
|
||||
|
|
|
|||
Loading…
Reference in New Issue