feat():后台分页加排序
parent
d4475c3c17
commit
38a1dad094
|
@ -44,6 +44,14 @@ public class ProductListReq {
|
|||
*接口地址
|
||||
*/
|
||||
private String productAddress;
|
||||
/**
|
||||
* 页码,从1开始
|
||||
*/
|
||||
private Integer pageNum=1;
|
||||
/**
|
||||
* 每页大小
|
||||
*/
|
||||
private Integer pageSize=9;
|
||||
|
||||
@Schema(description = "创建人",defaultValue = "muyu",type = "String")
|
||||
private String createBy;
|
||||
|
|
|
@ -30,11 +30,15 @@ public class ProductApiServiceImpl extends ServiceImpl<ProductApiMapper, Product
|
|||
*/
|
||||
@Override
|
||||
public List<ProductListResp> selectList(ProductListReq productListReq) {
|
||||
Integer pageNum = productListReq.getPageNum();
|
||||
Integer pageSize = productListReq.getPageSize();
|
||||
LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.like(StringUtils.isNotEmpty(productListReq.getProductName()),
|
||||
Product::getProductName,productListReq.getProductName());
|
||||
queryWrapper.eq(StringUtils.isNotEmpty(productListReq.getProductState()),
|
||||
Product::getProductState,productListReq.getProductState());
|
||||
queryWrapper.orderByDesc(Product::getProductSales);
|
||||
queryWrapper.last("LIMIT " + ((pageNum - 1) * pageSize) + ", " + pageSize);
|
||||
List<Product> productList = this.list(queryWrapper);
|
||||
return productList.stream()
|
||||
.map(product -> ProductListResp.productListRespbuild(product))
|
||||
|
|
Loading…
Reference in New Issue