package com.yh.saas.plugin.yiliangyiyun.controller;


import com.yh.saas.plugin.yiliangyiyun.entity.PriceConfirmationSheet;
import com.yh.saas.plugin.yiliangyiyun.service.IPriceConfirmationSheetService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 点价确认单 前端控制器
 * </p>
 *
 * @author Gongdc
 * @since 2021-08-02
 */
@RestController
@RequestMapping("/priceConfirmationSheet")
public class PriceConfirmationSheetController {
    @Autowired
    private IPriceConfirmationSheetService priceConfirmationSheetService;
    /**
     * 查看确认单
     * @param contractNo
     * @return
     */
    @GetMapping("/selectConfirmationSheet")
    public List<PriceConfirmationSheet> selectConfirmationSheet(String contractNo){
        return priceConfirmationSheetService.selectConfirmationSheet(contractNo);
    }

    /**
     * 添加点价确认单
     * @param priceConfirmationSheet
     * @return
     */
    @PostMapping("/api/addPriceConfirmationSheet")
    public String addPriceConfirmationSheet(@RequestBody PriceConfirmationSheet priceConfirmationSheet){
        return priceConfirmationSheetService.addPriceConfirmationSheet(priceConfirmationSheet);
    }

    /**
     * 编辑点价确认单
     * @param priceConfirmationSheet
     * @return
     */
    @PostMapping("/api/editPriceConfirmationSheet")
    public String editPriceConfirmationSheet(@RequestBody PriceConfirmationSheet priceConfirmationSheet){
        return priceConfirmationSheetService.editPriceConfirmationSheet(priceConfirmationSheet);
    }

    /**
     * 删除点价确认单
     * @param priceConfirmationSheet
     * @return
     */
    @PostMapping("/api/deletePriceConfirmationSheet")
    public void deletePriceConfirmationSheet(@RequestBody PriceConfirmationSheet priceConfirmationSheet){
        priceConfirmationSheetService.deletePriceConfirmationSheet(priceConfirmationSheet.getId());
    }
    /**
     * 查看确认单信息
     */
    @GetMapping("/getInfo")
    public PriceConfirmationSheet getInfo(@RequestParam String id) {
        return priceConfirmationSheetService.getInfo(id);
    }
}

