|
4 | 4 | **/ |
5 | 5 | package com.ligg.apiclient.controller; |
6 | 6 |
|
| 7 | +import com.ligg.common.enums.SearchSorting; |
7 | 8 | import com.ligg.common.module.entity.ProductEntity; |
8 | 9 | import com.ligg.common.enums.BusinessStates; |
9 | 10 | import com.ligg.common.service.SearchService; |
|
15 | 16 | import io.swagger.v3.oas.annotations.Operation; |
16 | 17 | import io.swagger.v3.oas.annotations.media.Schema; |
17 | 18 | import io.swagger.v3.oas.annotations.tags.Tag; |
18 | | -import jakarta.validation.constraints.NotNull; |
19 | 19 | import lombok.RequiredArgsConstructor; |
20 | 20 | import org.springframework.beans.BeanUtils; |
21 | 21 | import org.springframework.web.bind.annotation.GetMapping; |
@@ -46,9 +46,9 @@ public class SearchController { |
46 | 46 | */ |
47 | 47 | @Operation(summary = "搜索商品") |
48 | 48 | @GetMapping |
49 | | - public Response<PageVo<SearchVo>> searchCommodity(@Schema(description = "关键字") @RequestParam @NotNull String keyword, |
| 49 | + public Response<PageVo<SearchVo>> searchCommodity(@Schema(description = "关键字") @RequestParam(required = false) String keyword, |
50 | 50 | @Schema(description = "页码") @RequestParam(defaultValue = "1") Long pageNumber, |
51 | | - @Schema(description = "排序") @RequestParam(defaultValue = "1") Integer sort) { |
| 51 | + @Schema(description = "排序") @RequestParam(defaultValue = "1") SearchSorting sort) { |
52 | 52 | PageVo<ProductEntity> pageVo = searchService.searchCommodityPageList(keyword, pageNumber, 20L, sort); |
53 | 53 | List<SearchVo> pageVolist = pageVo.getList().stream().map(product -> { |
54 | 54 | SearchVo searchVo = new SearchVo(); |
|
0 commit comments