feat: 统一列表模糊搜索行为

- 统一管理端和用户中心搜索参数及多字段包含匹配

- 修复聊天搜索竞态并优化部门重名路径展示

- 补充部门展开、模型空白词和聊天查询回归测试
This commit is contained in:
2026-08-13 22:29:59 +08:00
parent 765006747a
commit 64a85c6a5b
83 changed files with 1134 additions and 208 deletions

View File

@@ -69,6 +69,27 @@ public class ChatSessionQueryServiceImplTest {
Assert.assertEquals("AGENT", sessionRepository.capturedCountAssistantCode);
}
/**
* 会话关键词必须同时下推到列表和计数查询,保证分页总数一致。
*/
@Test
public void pageSessionsShouldPassKeywordToListAndCountQueries() {
FakeSessionRepository sessionRepository = new FakeSessionRepository();
ChatSessionQueryServiceImpl service = new ChatSessionQueryServiceImpl(
sessionRepository,
new FakeLogRepository(),
new FakeTableManager(List.of()),
new FakeHotStateService()
);
ChatPageQuery query = new ChatPageQuery();
query.setKeyword("最近消息");
service.pageSessions(BigInteger.valueOf(7), null, query);
Assert.assertSame(query, sessionRepository.capturedListQuery);
Assert.assertSame(query, sessionRepository.capturedCountQuery);
}
/**
* 工作台消息分页必须走 MySQL 热表主线查询,并保持分页参数语义。
*/
@@ -147,6 +168,8 @@ public class ChatSessionQueryServiceImplTest {
private int listSessionsCalls;
private String capturedListAssistantCode;
private String capturedCountAssistantCode;
private ChatPageQuery capturedListQuery;
private ChatPageQuery capturedCountQuery;
private ChatSessionSummary summary;
private List<ChatSessionSummary> sessions = new ArrayList<>();
@@ -163,6 +186,7 @@ public class ChatSessionQueryServiceImplTest {
public List<ChatSessionSummary> listSessions(BigInteger userId, BigInteger assistantId, String assistantCode, ChatPageQuery query) {
listSessionsCalls += 1;
capturedListAssistantCode = assistantCode;
capturedListQuery = query;
return sessions;
}
@@ -173,8 +197,15 @@ public class ChatSessionQueryServiceImplTest {
@Override
public long countSessions(BigInteger userId, BigInteger assistantId, String assistantCode) {
return countSessions(userId, assistantId, assistantCode, null);
}
@Override
public long countSessions(BigInteger userId, BigInteger assistantId,
String assistantCode, ChatPageQuery query) {
countSessionsCalls += 1;
capturedCountAssistantCode = assistantCode;
capturedCountQuery = query;
return count;
}