feat: 新增获取所有商品接口(包括下架)用于商品管理
All checks were successful
continuous-integration/drone/push Build is passing
All checks were successful
continuous-integration/drone/push Build is passing
This commit is contained in:
@@ -37,6 +37,11 @@ public interface ProductService {
|
||||
*/
|
||||
Page<Product> getProducts(String categoryId, String keyword, Integer page, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取所有商品(包括下架的)
|
||||
*/
|
||||
Page<Product> getAllProducts(String categoryId, String keyword, Integer page, Integer pageSize);
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
*/
|
||||
|
||||
@@ -99,6 +99,20 @@ public class ProductServiceImpl implements ProductService {
|
||||
return productMapper.selectPage(pageParam, wrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Page<Product> getAllProducts(String categoryId, String keyword, Integer page, Integer pageSize) {
|
||||
Page<Product> pageParam = new Page<>(page, pageSize);
|
||||
LambdaQueryWrapper<Product> wrapper = new LambdaQueryWrapper<>();
|
||||
if (StringUtils.hasText(categoryId)) {
|
||||
wrapper.eq(Product::getCategoryId, categoryId);
|
||||
}
|
||||
if (StringUtils.hasText(keyword)) {
|
||||
wrapper.like(Product::getName, keyword);
|
||||
}
|
||||
wrapper.orderByDesc(Product::getCreatedAt);
|
||||
return productMapper.selectPage(pageParam, wrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取商品详情
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user