Commit 1b71e74a by fanjiaxin

商品列表检索为空,返回参处理

parent 60e2ba88
Pipeline #71670 passed with stages
in 1 minute 12 seconds
package com.netease.yanxuan.wx.store.sharer.biz.meta.page; package com.netease.yanxuan.wx.store.sharer.biz.meta.page;
import lombok.Data; import lombok.Data;
import org.springframework.util.CollectionUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
...@@ -26,4 +28,8 @@ public class PageVO<T> implements Serializable { ...@@ -26,4 +28,8 @@ public class PageVO<T> implements Serializable {
* 列表数据 * 列表数据
*/ */
private List<T> list; private List<T> list;
public void setList(List<T> list) {
this.list = CollectionUtils.isEmpty(list) ? Collections.emptyList() : list;
}
} }
...@@ -129,8 +129,8 @@ public class ProductServiceImpl implements IProductService { ...@@ -129,8 +129,8 @@ public class ProductServiceImpl implements IProductService {
.filter(Objects::nonNull) .filter(Objects::nonNull)
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
pageVO.setList(productList);
boolean isEmpty = CollectionUtils.isEmpty(productList); boolean isEmpty = CollectionUtils.isEmpty(productList);
pageVO.setList(isEmpty ? new ArrayList<>(0) : productList);
pageVO.setHasMore(!isEmpty && productList.size() >= pageQuery.getPageSize()); pageVO.setHasMore(!isEmpty && productList.size() >= pageQuery.getPageSize());
pageVO.setNextKey(productListVO.getNext_key()); pageVO.setNextKey(productListVO.getNext_key());
log.info("商品列表查询返回:{}", System.currentTimeMillis()); log.info("商品列表查询返回:{}", System.currentTimeMillis());
......
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