Commit d3e322a159006fef944f38eece285a02bbc9df6f

Authored by dengj
1 parent 3cac59c9

商品分页

src/main/java/com/diligrp/xtrade/product/domain/dto/ProductQueryRequestDto.java
... ... @@ -24,7 +24,9 @@ public class ProductQueryRequestDto {
24 24 //商品状态
25 25 private ProductStatus status;
26 26  
27   -
  27 + private Integer pageSize = 20;
  28 +
  29 + private Integer currentPage;
28 30  
29 31  
30 32 public Long getProductId() {
... ... @@ -83,5 +85,21 @@ public class ProductQueryRequestDto {
83 85 public void setStatus(ProductStatus status) {
84 86 this.status = status;
85 87 }
  88 +
  89 + public Integer getPageSize() {
  90 + return pageSize;
  91 + }
  92 +
  93 + public void setPageSize(Integer pageSize) {
  94 + this.pageSize = pageSize;
  95 + }
  96 +
  97 + public Integer getCurrentPage() {
  98 + return currentPage;
  99 + }
  100 +
  101 + public void setCurrentPage(Integer currentPage) {
  102 + this.currentPage = currentPage;
  103 + }
86 104  
87 105 }
... ...
src/main/java/com/diligrp/xtrade/product/service/impl/ProductServiceImpl.java
... ... @@ -17,6 +17,7 @@ import com.diligrp.xtrade.product.domain.emuns.IKeyGeneratorKeys;
17 17 import com.diligrp.xtrade.product.domain.entity.ProductDo;
18 18 import com.diligrp.xtrade.product.service.ProductService;
19 19 import com.diligrp.xtrade.shared.domain.Page;
  20 +import com.diligrp.xtrade.shared.mybatis.PageHelper;
20 21 import com.diligrp.xtrade.shared.sequence.KeyGeneratorManager;
21 22  
22 23 @Service("productService")
... ... @@ -35,7 +36,7 @@ public class ProductServiceImpl implements ProductService {
35 36  
36 37 @Override
37 38 public Page<ProductQueryResponseDto> productLists(ProductQueryRequestDto queryDto) {
38   - Page<ProductQueryResponseDto> productPage = new Page<ProductQueryResponseDto>();
  39 + Page<ProductQueryResponseDto> productPage = PageHelper.startPage(queryDto.getCurrentPage(), queryDto.getPageSize());
39 40 List<ProductQueryResponseDto> productList = new ArrayList<ProductQueryResponseDto>();
40 41 ProductDo product = new ProductDo();
41 42 BeanUtils.copyProperties(queryDto, product);
... ... @@ -49,7 +50,6 @@ public class ProductServiceImpl implements ProductService {
49 50 BeanUtils.copyProperties(productDo, productQueryResponseDto);
50 51 productList.add(productQueryResponseDto);
51 52 }
52   - productPage.setTotal(total);
53 53 productPage.setData(productList);
54 54 return productPage;
55 55 }
... ...