package com.dayou.controller;

import org.apache.poi.xssf.usermodel.XSSFWorkbook;
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 com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.web.bind.annotation.RestController;
import com.dayou.controller.BaseController;
import com.dayou.service.IBusinessProductionChoiceLogService;
import com.dayou.entity.BusinessProductionChoiceLog;
import com.dayou.common.RestResponse;
import org.springframework.web.bind.annotation.*;
import com.dayou.utils.ConvertUtil;
import com.dayou.utils.HttpKit;
import com.dayou.exception.ErrorCode;
import java.util.Date;
import java.util.List;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.http.MediaType;
import org.springframework.web.multipart.MultipartFile;
/**
 * 产品选择记录
 *
 * @author wucl
 * @since 2024-05-16
 */
@RestController
@RequestMapping("businessProductionChoiceLog")
@Slf4j
public class BusinessProductionChoiceLogController extends BaseController {
    @Autowired
    private IBusinessProductionChoiceLogService businessProductionChoiceLogService;

    /**
    * 产品选择记录列表
    */
    @GetMapping("")
    public RestResponse<Page<BusinessProductionChoiceLog>> page(BusinessProductionChoiceLog businessProductionChoiceLog, Page page){
        Page<BusinessProductionChoiceLog> pages=businessProductionChoiceLogService.selectPage(page,businessProductionChoiceLog);
        return RestResponse.data(pages);
    }

    /**
     * 产品选择记录详情
     */
    @GetMapping("/{id}")
    public RestResponse<BusinessProductionChoiceLog> detail(@PathVariable Long id){
        BusinessProductionChoiceLog xBusinessProductionChoiceLog =businessProductionChoiceLogService.detail(id);
        return RestResponse.data(xBusinessProductionChoiceLog);
     }

    /**
     * 产品选择记录新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody BusinessProductionChoiceLog businessProductionChoiceLog) {
        Boolean ret = businessProductionChoiceLogService.add(businessProductionChoiceLog);
        return RestResponse.data(ret);
    }

    /**
     * 产品选择记录更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody BusinessProductionChoiceLog businessProductionChoiceLog) {
        Boolean ret = businessProductionChoiceLogService.update(businessProductionChoiceLog);
        return RestResponse.data(ret);
    }

    /**
     * 产品选择记录删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = businessProductionChoiceLogService.delete(id);
        return RestResponse.data(ret);
    }

    /**
     * 查询产品选择记录
     * @param selectDto 查询条件
     * @return BusinessProductionChoiceLog
     */
    @GetMapping("/getChoiceLog")
    public RestResponse<BusinessProductionChoiceLog> getChoiceLog(BusinessProductionChoiceLog selectDto) {
        return RestResponse.data(businessProductionChoiceLogService.getChoiceLog(selectDto));
    }


}

