(improvement)(chat) show case filter by user name (#245)

Co-authored-by: jolunoluo
This commit is contained in:
LXW
2023-10-17 17:52:27 +08:00
committed by GitHub
parent a9bb1c1f68
commit 968d50e071
6 changed files with 19 additions and 18 deletions

View File

@@ -7,6 +7,6 @@ import java.util.List;
@Mapper
public interface ShowCaseCustomMapper {
List<ChatQueryDO> queryShowCase(int start, int limit, int agentId);
List<ChatQueryDO> queryShowCase(int start, int limit, int agentId, String userName);
}

View File

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

View File

@@ -137,14 +137,14 @@ public class ChatServiceImpl implements ChatService {
}
@Override
public ShowCaseResp queryShowCase(PageQueryInfoReq pageQueryInfoCommend, int agentId) {
public ShowCaseResp queryShowCase(PageQueryInfoReq pageQueryInfoReq, int agentId) {
ShowCaseResp showCaseResp = new ShowCaseResp();
List<QueryResp> queryResps = chatQueryRepository.queryShowCase(pageQueryInfoCommend, agentId);
List<QueryResp> queryResps = chatQueryRepository.queryShowCase(pageQueryInfoReq, agentId);
Map<Long, List<QueryResp>> showCaseMap = queryResps.stream()
.collect(Collectors.groupingBy(QueryResp::getChatId));
showCaseResp.setShowCaseMap(showCaseMap);
showCaseResp.setCurrent(pageQueryInfoCommend.getCurrent());
showCaseResp.setPageSize(pageQueryInfoCommend.getPageSize());
showCaseResp.setCurrent(pageQueryInfoReq.getCurrent());
showCaseResp.setPageSize(pageQueryInfoReq.getPageSize());
return showCaseResp;
}

View File

@@ -60,6 +60,9 @@
select distinct chat_id
from s2_chat_query
where query_state = 1 and agent_id = ${agentId}
<if test="userName != null and userName != ''">
and user_name = #{userName}
</if>
order by chat_id desc
limit #{start}, #{limit}
) q2