|
@@ -96,6 +96,7 @@ public class ProductController {
|
|
|
public ApiDTO pageQuery(@RequestBody QueryParamForProduct param) {
|
|
|
|
|
|
List<Product> resultByType = productService.findAll(QueryParamExp.eq("snType",param.getType()));
|
|
|
+
|
|
|
resultByType.sort(Comparator.comparing(Product::getAddTime).reversed());
|
|
|
int resultSize = resultByType.size();
|
|
|
int startIndex = (param.getIndex() - 1) * param.getLength();
|
|
@@ -111,7 +112,9 @@ public class ProductController {
|
|
|
}catch(IllegalArgumentException e){
|
|
|
return ApiDTO.error("分页索引越界!");
|
|
|
}
|
|
|
- return ApiDTO.ok("搜索成功!",resultByTypeAndPage);
|
|
|
+ ApiPageDTO result = new ApiPageDTO("搜索成功!",resultByTypeAndPage);
|
|
|
+ result.setTotal(resultByTypeAndPage.size());
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
}
|