package com.jwipc.inquiry.controller.rest;

import com.jwipc.inquiry.constant.ModuleConst;
import com.jwipc.inquiry.dto.InquiryMaterialSupplierDTO;
import com.jwipc.inquiry.logic.InquiryMaterialSupplierLogic;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author shenyang.ou
 * @date 2024/2/18 15:35
 * @desc 询价供应商
 */
@RestController
@RequestMapping(ModuleConst.MODULE_ROOT + "/material/supplier/rest")
@RequiredArgsConstructor
public class InquiryMaterialSupplierRestController {
    private final InquiryMaterialSupplierLogic inquiryMaterialSupplierLogic;
    /**
     * 根据询价id查询询价物料供应商（分组）
     */
    @RequestMapping("/getGroupListByInquiryId")
    public ResponseEntity<List<InquiryMaterialSupplierDTO>> getGroupListByInquiryId(Long inquiryId,Integer bidFlag) {
        return ResponseEntity.ok(inquiryMaterialSupplierLogic.getGroupListByInquiryId(inquiryId,bidFlag));
    }

    /**
     * 根据询价id和询价物料id查询询价物料供应商
     */
    @RequestMapping("/getListByInquiryIdAndInquiryMaterialId")
    public ResponseEntity<List<InquiryMaterialSupplierDTO>> getListByInquiryIdAndInquiryMaterialId(Long inquiryId, Long inquiryMaterialId) {
        return ResponseEntity.ok(inquiryMaterialSupplierLogic.getListByInquiryIdAndInquiryMaterialId(inquiryId,inquiryMaterialId));
    }
}
