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.IOrderFundAllotService;
import com.dayou.entity.OrderFundAllot;
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-29
 */
@RestController
@RequestMapping("orderFundAllot")
@Slf4j
public class OrderFundAllotController extends BaseController {
    @Autowired
    private IOrderFundAllotService orderFundAllotService;

    /**
    * 订单收款分配表列表
    */
    @GetMapping("")
    public RestResponse<Page<OrderFundAllot>> page(OrderFundAllot orderFundAllot, Page page){
        Page<OrderFundAllot> pages=orderFundAllotService.selectPage(page,orderFundAllot);
        return RestResponse.data(pages);
    }

    /**
     * 订单收款分配表详情
     */
    @GetMapping("/{id}")
    public RestResponse<OrderFundAllot> detail(@PathVariable Long id){
        OrderFundAllot xOrderFundAllot =orderFundAllotService.detail(id);
        return RestResponse.data(xOrderFundAllot);
     }

    /**
     * 订单收款分配表新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody OrderFundAllot orderFundAllot) {
        Boolean ret = orderFundAllotService.add(orderFundAllot);
        return RestResponse.data(ret);
    }

    /**
     * 订单收款分配表更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody OrderFundAllot orderFundAllot) {
        Boolean ret = orderFundAllotService.update(orderFundAllot);
        return RestResponse.data(ret);
    }

    /**
     * 订单收款分配表删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = orderFundAllotService.delete(id);
        return RestResponse.data(ret);
    }


}

