|
|
@@ -25,6 +25,7 @@ import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
import javax.annotation.Resource;
|
|
|
import javax.validation.Valid;
|
|
|
import java.util.List;
|
|
|
@@ -55,7 +56,7 @@ public class ProductController extends BaseController {
|
|
|
*
|
|
|
* @param page 分页对象
|
|
|
* @param product 商品实体
|
|
|
- * @return R<Page<Product>> 所有数据
|
|
|
+ * @return R<Page < Product>> 所有数据
|
|
|
*/
|
|
|
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
|
|
@ApiOperation("PC查询商品管理列表")
|
|
|
@@ -87,19 +88,21 @@ public class ProductController extends BaseController {
|
|
|
*
|
|
|
* @param page 分页对象
|
|
|
* @param product 商品实体
|
|
|
+ * @param name 商品名称
|
|
|
* @param sortField 排序字段(price:价格, sales:销量)
|
|
|
* @param sortOrder 排序方式(asc:升序, desc:降序)
|
|
|
- * @return R<Page<H5ProductVo>> 所有数据
|
|
|
+ * @return R<Page < H5ProductVo>> 所有数据
|
|
|
*/
|
|
|
@RequestMapping(value = "/h5List", method = RequestMethod.GET)
|
|
|
@ApiOperation("H5查询商品管理列表")
|
|
|
- public R<Page<H5ProductVo>> selectH5All(Page<H5ProductVo> page, Product product, @RequestParam(required = false) String sortField, @RequestParam(required = false) String sortOrder) {
|
|
|
+ public R<Page<H5ProductVo>> selectH5All(Page<H5ProductVo> page, Product product, @RequestParam(required = false) String name, @RequestParam(required = false) String sortField, @RequestParam(required = false) String sortOrder) {
|
|
|
try {
|
|
|
- Page<H5ProductVo> pageResult = productService.selectH5Page(page, product, sortField, sortOrder);
|
|
|
+ Page<H5ProductVo> pageResult = productService.selectH5Page(page, product, name, sortField, sortOrder);
|
|
|
//根据分类ID查询分类的名称
|
|
|
for (H5ProductVo record : pageResult.getRecords()) {
|
|
|
ProductCategory productCategory = this.productCategoryService.getById(record.getCategoryId());
|
|
|
if (productCategory != null) {
|
|
|
+ // 设置分类名称
|
|
|
record.setCategoryName(productCategory.getName());
|
|
|
}
|
|
|
//根据商品ID查询库存的最低价格
|