(improvement)(chat) opt page query for show case (#278)

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2023-10-23 22:14:04 +08:00
committed by GitHub
parent 4fbc3c8533
commit b9895d541b
4 changed files with 7 additions and 4 deletions

View File

@@ -13,4 +13,8 @@ public class PageQueryInfoReq {
private String userName; private String userName;
private List<Long> ids; private List<Long> ids;
public Integer getLimitStart() {
return this.pageSize * (this.current - 1);
}
} }

View File

@@ -79,7 +79,7 @@ public class ChatQueryRepositoryImpl implements ChatQueryRepository {
@Override @Override
public List<QueryResp> queryShowCase(PageQueryInfoReq pageQueryInfoReq, int agentId) { public List<QueryResp> queryShowCase(PageQueryInfoReq pageQueryInfoReq, int agentId) {
return showCaseCustomMapper.queryShowCase(pageQueryInfoReq.getCurrent(), return showCaseCustomMapper.queryShowCase(pageQueryInfoReq.getLimitStart(),
pageQueryInfoReq.getPageSize(), agentId, pageQueryInfoReq.getUserName()) pageQueryInfoReq.getPageSize(), agentId, pageQueryInfoReq.getUserName())
.stream().map(this::convertTo) .stream().map(this::convertTo)
.collect(Collectors.toList()); .collect(Collectors.toList());

View File

@@ -169,8 +169,7 @@ public class ChatServiceImpl implements ChatService {
}); });
queryResps = new ArrayList<>(queryResps.stream() queryResps = new ArrayList<>(queryResps.stream()
.collect(Collectors.toMap(QueryResp::getQueryText, Function.identity(), .collect(Collectors.toMap(QueryResp::getQueryText, Function.identity(),
(existing, replacement) -> existing, LinkedHashMap::new)) (existing, replacement) -> existing, LinkedHashMap::new)).values());
.values());
fillParseInfo(queryResps); fillParseInfo(queryResps);
Map<Long, List<QueryResp>> showCaseMap = queryResps.stream() Map<Long, List<QueryResp>> showCaseMap = queryResps.stream()
.collect(Collectors.groupingBy(QueryResp::getChatId)); .collect(Collectors.groupingBy(QueryResp::getChatId));

View File

@@ -61,7 +61,7 @@
from ( from (
select * select *
from s2_chat_query from s2_chat_query
where query_state = 1 and agent_id = ${agentId} where query_state = 1 and agent_id = ${agentId} and (score is null or score > 1)
<if test="userName != null and userName != ''"> <if test="userName != null and userName != ''">
and user_name = #{userName} and user_name = #{userName}
</if> </if>