package com.dayou.controller;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.RestController;
import com.dayou.service.IMajorProductionAllotService;
import com.dayou.entity.MajorProductionAllot;
import com.dayou.common.RestResponse;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 大中型产品绩效分配
 *
 * @author wucl
 * @since 2024-02-19
 */
@RestController
@RequestMapping("majorProductionAllot")
@Slf4j
public class MajorProductionAllotController extends BaseController {
    @Autowired
    private IMajorProductionAllotService majorProductionAllotService;

    /**
    * 大中型产品绩效分配列表
    */
    @GetMapping("/list/{productionId}")
    public RestResponse<List<MajorProductionAllot>> getList(@PathVariable("productionId") Long productionId){
        List<MajorProductionAllot> list =majorProductionAllotService.getList(productionId);
        return RestResponse.data(list);
    }


    /**
     * 保存绩效分配
     * @param list
     * @return
     */
    @PostMapping("/save")
    public RestResponse<Boolean> saveAllot(@RequestBody List<MajorProductionAllot> list){
        Boolean ret = majorProductionAllotService.saveAllot(list);
        return RestResponse.data(ret);
    }


}

