feat: 新增获取所有商品接口(包括下架)用于商品管理
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Agent
2026-04-01 15:18:41 +00:00
parent 0a62e19d51
commit ed0138c777
4 changed files with 31 additions and 4 deletions

View File

@@ -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);
/**
* 获取商品详情
*/

View File

@@ -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);
}
/**
* 获取商品详情
*/