Commit df2518ab authored by alex yao's avatar alex yao

fix: 修复接口 [BizAgentApplicationMallRest#getList] 分页问题

parent 91e08228
......@@ -11,10 +11,12 @@ select
baap.agent_id
from
biz_agent_application_mall baam
left join biz_agent_application_publish baap on baap.id = baam.agent_publish_id and baap.is_deleted = 'N'
left join biz_agent_application_publish baap
on baap.id = baam.agent_publish_id
where baam.is_deleted ='N'
and baam.is_sale = 'Y'
and baap.is_deleted = 'N'
<<and baam.is_sale = :isSale>>
<<and baam.agent_type = :agentType>>
<<and baam.category_id = :categoryId>>
<<and LOCATE(:query, baap.agent_title)>>
order by baam.CREATED_TIME desc
\ No newline at end of file
order by baam.popularity desc
\ No newline at end of file
......@@ -39,4 +39,14 @@ public class MallAgentApplicationQueryCondition implements Serializable{
public void setQuery(String query) {
this.query = query;
}
private java.lang.String isSale;
public String getIsSale() {
return isSale;
}
public void setIsSale(String isSale) {
this.isSale = isSale;
}
}
\ No newline at end of file
......@@ -102,9 +102,13 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
return null;
}
@Override
//todo 分页问题
public List<BizAgentApplicationMallDto> getList(AgentApplicationMallQueryDto dto, PagingInfo pagingInfo) throws Exception {
List<BizAgentApplicationMallDto> resultList = new ArrayList<>();
//查询应用广场的应用
MallAgentApplicationQueryCondition mallAgentApplicationQueryCondition = new MallAgentApplicationQueryCondition();
mallAgentApplicationQueryCondition.setIsSale(CommonConstant.YOrN.Y);
if (dto != null) {
if (StringUtils.isNotBlank(dto.getSearch())) {
mallAgentApplicationQueryCondition.setQuery(dto.getSearch());
......@@ -117,20 +121,19 @@ public class BizAgentApplicationMallRestImpl implements BizAgentApplicationMallR
}
}
List<MallAgentApplicationQueryItem> items = bizAgentApplicationMallService.mallAgentApplicationQuery(mallAgentApplicationQueryCondition, pagingInfo);
//查询当前用户的收藏情况
MemberCollectQueryCondition collectQueryCondition = new MemberCollectQueryCondition();
collectQueryCondition.setMemberId(BlContext.getCurrentUserNotException().getUserId());
collectQueryCondition.setIsCollect(CommonConstant.YOrN.Y);
List<MemberCollectQueryItem> memberCollectQueryItems = bizMemberAgentApplicationCollectService.queryMemberCollect(collectQueryCondition, null);
// 把查询结果封装到DTO中
for (MallAgentApplicationQueryItem item : items) {
BizAgentApplicationMallDto mallDto = BizAgentApplicationMallConvert.itemToDto(item);
// 如果应用上架了
if (mallDto.getBaseInfo() != null && CommonConstant.YOrN.Y.equals(mallDto.getIsSale())) {
// 设置当前用户是否收藏了
String agentId = mallDto.getBaseInfo().getAgentId();
mallDto.setIsCollect(memberCollectQueryItems.stream().anyMatch(v -> agentId.equals(v.getAgentId())) ? CommonConstant.YOrN.Y : CommonConstant.YOrN.N);
resultList.add(mallDto);
}
String agentId = mallDto.getBaseInfo().getAgentId();
mallDto.setIsCollect(memberCollectQueryItems.stream().anyMatch(v -> agentId.equals(v.getAgentId())) ? CommonConstant.YOrN.Y : CommonConstant.YOrN.N);
resultList.add(mallDto);
}
return resultList;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment