提交 db20ddd4 authored 作者: Whispa's avatar Whispa

commit

上级 95bad3ae
...@@ -50,18 +50,19 @@ public class GoodsTypeController { ...@@ -50,18 +50,19 @@ public class GoodsTypeController {
pageSize = 6; pageSize = 6;
} }
if( categoryId != null){ Page<TbCfStationItem> all;
itemRepository.findByItemCategory(categoryId,PageRequest.of(pageNum, pageSize,sort(order)));
}
Page<TbCfStationItem> all = itemRepository.findAll(PageRequest.of(pageNum, pageSize,sort(order))); if (categoryId != null)
all = itemRepository.findByItemCategory(categoryId, PageRequest.of(pageNum, pageSize, sort(order)));
else
all = itemRepository.findAll(PageRequest.of(pageNum, pageSize, sort(order)));
return new Result<>(all); return new Result<>(all);
} }
private Sort sort(String order){ private Sort sort(String order) {
String col = "discountPrice"; String col = "discountPrice";
return Sort.by( "desc".equals(order) ? desc(col) : asc(col)); return Sort.by("desc".equals(order) ? desc(col) : asc(col));
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论