package org.springblade.gateway.active_gateway.controller;

import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.gateway.active_gateway.service.ProductSearchService;
import org.springblade.sing.active.vo.ActiveProductRecordVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("app/active/product")
@AllArgsConstructor
@Api(value = "搜索", tags = "搜索接口")
@Slf4j
public class ProductSearchController {

	@Autowired
	private ProductSearchService productSearchService;

	@GetMapping("/search")
	@ApiOperationSupport(order = 1)
	@ApiOperation(value = "作品搜索", notes = "传入keyword")
	public R<List<ActiveProductRecordVO>> productSearch(@ApiParam(value = "搜索条件",required = true) String keyword,
														@ApiParam(value = "搜索活动id",required = true) Long activeId){
		return R.data(productSearchService.search(keyword,activeId));
	}
}
