|
|
|
|
@ -19,10 +19,10 @@ import com.yami.shop.bean.dto.SearchProdDto;
|
|
|
|
|
import com.yami.shop.common.util.PageParam;
|
|
|
|
|
import com.yami.shop.service.HotSearchService;
|
|
|
|
|
import com.yami.shop.service.ProductService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Parameters;
|
|
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
|
import lombok.AllArgsConstructor;
|
|
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
|
|
@ -34,7 +34,7 @@ import java.util.List;
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequestMapping("/search")
|
|
|
|
|
@Api(tags = "搜索接口")
|
|
|
|
|
@Tag(name = "搜索接口")
|
|
|
|
|
@AllArgsConstructor
|
|
|
|
|
public class SearchController {
|
|
|
|
|
|
|
|
|
|
@ -43,11 +43,11 @@ public class SearchController {
|
|
|
|
|
private final ProductService productService;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/hotSearchByShopId")
|
|
|
|
|
@ApiOperation(value = "查看店铺热搜", notes = "根据店铺id,热搜数量获取热搜")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "shopId", value = "店铺id", required = true, dataType = "Long"),
|
|
|
|
|
@ApiImplicitParam(name = "number", value = "取数", required = true, dataType = "Integer"),
|
|
|
|
|
@ApiImplicitParam(name = "sort", value = "是否按照顺序(0 否 1是)", required = false, dataType = "Integer"),
|
|
|
|
|
@Operation(summary = "查看店铺热搜" , description = "根据店铺id,热搜数量获取热搜")
|
|
|
|
|
@Parameters({
|
|
|
|
|
@Parameter(name = "shopId", description = "店铺id" , required = true),
|
|
|
|
|
@Parameter(name = "number", description = "取数" , required = true),
|
|
|
|
|
@Parameter(name = "sort", description = "是否按照顺序(0 否 1是)"),
|
|
|
|
|
})
|
|
|
|
|
public ResponseEntity<List<HotSearchDto>> hotSearchByShopId(Long shopId,Integer number,Integer sort) {
|
|
|
|
|
List<HotSearchDto> list = hotSearchService.getHotSearchDtoByshopId(shopId);
|
|
|
|
|
@ -56,10 +56,10 @@ public class SearchController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/hotSearch")
|
|
|
|
|
@ApiOperation(value = "查看全局热搜", notes = "根据店铺id,热搜数量获取热搜")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "number", value = "取数", required = true, dataType = "Integer"),
|
|
|
|
|
@ApiImplicitParam(name = "sort", value = "是否按照顺序(0 否 1是)", required = false, dataType = "Integer"),
|
|
|
|
|
@Operation(summary = "查看全局热搜" , description = "根据店铺id,热搜数量获取热搜")
|
|
|
|
|
@Parameters({
|
|
|
|
|
@Parameter(name = "number", description = "取数" , required = true),
|
|
|
|
|
@Parameter(name = "sort", description = "是否按照顺序(0 否 1是)", required = false ),
|
|
|
|
|
})
|
|
|
|
|
public ResponseEntity<List<HotSearchDto>> hotSearch(Integer number,Integer sort) {
|
|
|
|
|
List<HotSearchDto> list = hotSearchService.getHotSearchDtoByshopId(0L);
|
|
|
|
|
@ -77,12 +77,12 @@ public class SearchController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/searchProdPage")
|
|
|
|
|
@ApiOperation(value = "分页排序搜索商品", notes = "根据商品名搜索")
|
|
|
|
|
@ApiImplicitParams({
|
|
|
|
|
@ApiImplicitParam(name = "prodName", value = "商品名", required = true, dataType = "String"),
|
|
|
|
|
@ApiImplicitParam(name = "sort", value = "排序(0 默认排序 1销量排序 2价格排序)", required = false, dataType = "Integer"),
|
|
|
|
|
@ApiImplicitParam(name = "orderBy", value = "排序(0升序 1降序)", required = false, dataType = "Integer"),
|
|
|
|
|
@ApiImplicitParam(name = "shopId", value = "店铺id", required = true, dataType = "Long"),
|
|
|
|
|
@Operation(summary = "分页排序搜索商品" , description = "根据商品名搜索")
|
|
|
|
|
@Parameters({
|
|
|
|
|
@Parameter(name = "prodName", description = "商品名" , required = true),
|
|
|
|
|
@Parameter(name = "sort", description = "排序(0 默认排序 1销量排序 2价格排序)"),
|
|
|
|
|
@Parameter(name = "orderBy", description = "排序(0升序 1降序)"),
|
|
|
|
|
@Parameter(name = "shopId", description = "店铺id" , required = true),
|
|
|
|
|
})
|
|
|
|
|
public ResponseEntity<IPage<SearchProdDto>> searchProdPage(PageParam page, String prodName, Integer sort, Integer orderBy, Long shopId) {
|
|
|
|
|
|
|
|
|
|
|