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