
package com.tmerclub.cloud.search.controller.multishop;

import com.tmerclub.cloud.api.dto.EsPageDTO;
import com.tmerclub.cloud.api.vo.EsPageVO;
import com.tmerclub.cloud.common.order.dto.PurchaseOrderSearchDTO;
import com.tmerclub.cloud.common.order.vo.EsPurchaseOrderVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.search.manager.PurchaseOrderSearchManager;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
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;

/**
 * 商品搜索
 *
 * @author tmerclub
 * @date 2020/11/16
 */
@RestController("multishopPurchaseOrderSearchController")
@RequestMapping("/m/purchaseOrderSearch")
@Tag(name = "multishop-采购订单管理接口")
public class PurchaseOrderSearchController {

    @Autowired
    private PurchaseOrderSearchManager purchaseOrderSearchManager;

    @GetMapping("/page")
    @Operation(summary = "商品信息列表", description = "商品信息列表")
    public ServerResponseEntity<EsPageVO<EsPurchaseOrderVO>> page(@Valid EsPageDTO pageDTO, PurchaseOrderSearchDTO purchaseOrderDTO) {
        purchaseOrderDTO.setShopId(AuthUserContext.get().getTenantId());
        EsPageVO<EsPurchaseOrderVO> page = purchaseOrderSearchManager.page(pageDTO, purchaseOrderDTO);
        return ServerResponseEntity.success(page);

    }
}
