
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.OrderInvoiceSearchDTO;
import com.tmerclub.cloud.common.order.vo.EsOrderInvoiceVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.search.manager.OrderInvoiceSearchManager;
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("multishopOrderInvoiceSearchController")
@RequestMapping("/m/orderinvoiceSearch")
@Tag(name = "multishop-订单发票管理接口")
public class OrderInvoiceSearchController {

    @Autowired
    private OrderInvoiceSearchManager orderInvoiceSearchManager;

    @GetMapping("/page")
    @Operation(summary = "获取订单发票列表", description = "分页获取列表")
    public ServerResponseEntity<EsPageVO<EsOrderInvoiceVO>> page(@Valid EsPageDTO pageDTO, OrderInvoiceSearchDTO orderInvoiceSearchDTO) {
        orderInvoiceSearchDTO.setShopId(AuthUserContext.get().getTenantId());
        orderInvoiceSearchDTO.setSupplierId(null);
        EsPageVO<EsOrderInvoiceVO> page = orderInvoiceSearchManager.page(pageDTO, orderInvoiceSearchDTO);
        return ServerResponseEntity.success(page);
    }
}
