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


import com.tmerclub.cloud.api.auth.constant.SysTypeEnum;
import com.tmerclub.cloud.common.database.dto.PageDTO;
import com.tmerclub.cloud.common.database.vo.PageVO;
import com.tmerclub.cloud.common.response.ServerResponseEntity;
import com.tmerclub.cloud.common.security.AuthUserContext;
import com.tmerclub.cloud.supplier.dto.SupplierDetailDTO;
import com.tmerclub.cloud.supplier.service.SupplierDetailService;
import com.tmerclub.cloud.supplier.vo.SupplierDetailVO;
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 lth
 */
@RestController("supplierShopDetailController")
@RequestMapping("/m/supplier_detail")
@Tag(name = "supplier-供应商")
public class SupplierDetailController {

    @Autowired
    private SupplierDetailService supplierDetailService;

    @GetMapping("/page_supplier")
    @Operation(summary = "供应商列表", description = "供应商列表")
    public ServerResponseEntity<PageVO<SupplierDetailVO>> pageSupplier(@Valid PageDTO pageDTO, SupplierDetailDTO supplierDetailDTO) {
        Long shopId = AuthUserContext.get().getTenantId();
        supplierDetailDTO.setSysType(SysTypeEnum.MULTISHOP.value());
        return ServerResponseEntity.success(supplierDetailService.pageSupplier(pageDTO, supplierDetailDTO, shopId));
    }


}
