Commit b417649c authored by jennie chen's avatar jennie chen

1.获取用户创建应用列表中增加是否收藏的查询条件

parent 9ffb8e4a
......@@ -6,6 +6,8 @@ public class AgentApplicationInfoSearchDto {
private String publishStatus;
private String isCollect;
public String getPublishStatus() {
return publishStatus;
}
......@@ -21,4 +23,12 @@ public class AgentApplicationInfoSearchDto {
public void setQuery(String query) {
this.query = query;
}
public String getIsCollect() {
return isCollect;
}
public void setIsCollect(String isCollect) {
this.isCollect = isCollect;
}
}
......@@ -75,13 +75,33 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
List<AgentApplicationInfoDto> resultList = new ArrayList<>();
for(BizAgentApplicationInfoEntity entity : bizAgentApplicationInfoEntities){
AgentApplicationInfoDto infoDto = AgentApplicationInfoConvert.entityToDto(entity);
// 设置当前用户是否收藏了
if(infoDto.getBaseInfo() != null){
BizMemberAgentApplicationCollectEntity collect = bizMemberAgentApplicationCollectService.getByAgentId(infoDto.getBaseInfo().getAgentId());
if(collect != null){
infoDto.setIsCollect(collect.getIsCollect());
// 先判断有没有收藏的查询条件
if(StringUtils.isNotBlank(dto.getIsCollect())){
// 如果有查询条件,则判断符不符合条件
if(infoDto.getBaseInfo() != null){
BizMemberAgentApplicationCollectEntity collect = bizMemberAgentApplicationCollectService.getByAgentId(infoDto.getBaseInfo().getAgentId());
// 如果符合条件,则把值加入
if(collect != null && collect.getIsCollect().equals(dto.getIsCollect())){
infoDto.setIsCollect(collect.getIsCollect());
} else if ((collect == null && CommonConstant.IsDeleted.N.equals(dto.getIsCollect()))) {
infoDto.setIsCollect(CommonConstant.IsDeleted.N);
} else {
// 如果不符合条件,则continue
continue;
}
}else {
infoDto.setIsCollect(CommonConstant.IsDeleted.N);
continue;
}
}else {
// 如何没有查询条件,则直接按照原来的逻辑走
// 设置当前用户是否收藏了
if(infoDto.getBaseInfo() != null){
BizMemberAgentApplicationCollectEntity collect = bizMemberAgentApplicationCollectService.getByAgentId(infoDto.getBaseInfo().getAgentId());
if(collect != null){
infoDto.setIsCollect(collect.getIsCollect());
}else {
infoDto.setIsCollect(CommonConstant.IsDeleted.N);
}
}
}
// 判断是否发布了,若发布则设置agentPublishId
......@@ -98,7 +118,6 @@ public class AgentApplicationInfoRestImpl implements AgentApplicationInfoRest {
}else{
infoDto.setAgentPublishId(null);
}
resultList.add(infoDto);
}
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