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


import com.baomidou.mybatisplus.plugins.Page;
import com.yh.saas.plugin.yiliangyiyun.entity.GrainDeliveryRegistration;
import com.yh.saas.plugin.yiliangyiyun.service.IGrainDeliveryRegistrationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 送粮登记管理 前端控制器
 * </p>
 *
 * @author Gdc
 * @since 2021-11-26
 */
@RestController
@RequestMapping("/grainDeliveryRegistration")
public class GrainDeliveryRegistrationController {

    @Autowired
    private IGrainDeliveryRegistrationService grainDeliveryRegistrationService;

    /**
     * 送粮登记
     */
    @PostMapping("/api/insertInfo")
    public String insertInfo(@RequestBody GrainDeliveryRegistration grainDeliveryRegistration){
        return grainDeliveryRegistrationService.insertInfo(grainDeliveryRegistration);
    }

    /**
     * 送粮记录列表
     * @param commonId
     * @return
     */
    @GetMapping("/selectGrainDeliveryRegistration")
    public List<GrainDeliveryRegistration> selectGrainDeliveryRegistration(String commonId){
        return grainDeliveryRegistrationService.selectGrainDeliveryRegistration(commonId);
    }

    /**
     * 删除送粮记录
     * @param grainDeliveryRegistration
     */
    @PostMapping("/api/deleteInfo")
    public void deleteInfo(@RequestBody GrainDeliveryRegistration grainDeliveryRegistration) {
        grainDeliveryRegistrationService.deleteInfo(grainDeliveryRegistration.getId());
    }

    /**
     *
     * 登记客户下拉列表
     * @param grainDeliveryRegistration
     */
    @GetMapping("/grainDeliveryRegistrationCustomer")
    public List<GrainDeliveryRegistration> grainDeliveryRegistrationCustomer(GrainDeliveryRegistration grainDeliveryRegistration){
        return grainDeliveryRegistrationService.grainDeliveryRegistrationCustomer(grainDeliveryRegistration);
    }
}

