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.IOrderFundService;
import com.dayou.entity.OrderFund;
import com.dayou.common.RestResponse;
import org.springframework.web.bind.annotation.*;
/**
 * 订单应收款
 *
 * @author wucl
 * @since 2023-12-14
 */
@RestController
@RequestMapping("orderFund")
@Slf4j
public class OrderFundController extends BaseController {
    @Autowired
    private IOrderFundService orderFundService;

    /**
    * 订单应收款列表
    */
    @GetMapping("")
    public RestResponse<Page<OrderFund>> page(OrderFund orderFund, Page page){
        Page<OrderFund> pages=orderFundService.selectPage(page,orderFund);
        return RestResponse.data(pages);
    }

    /**
     * 订单应收款详情
     */
    @GetMapping("/{id}")
    public RestResponse<OrderFund> detail(@PathVariable Long id){
        OrderFund xOrderFund =orderFundService.detail(id);
        return RestResponse.data(xOrderFund);
     }

    /**
     * 订单应收款新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody OrderFund orderFund) {
        Boolean ret = orderFundService.add(orderFund);
        return RestResponse.data(ret);
    }

    /**
     * 订单应收款更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody OrderFund orderFund) {
        Boolean ret = orderFundService.update(orderFund);
        return RestResponse.data(ret);
    }

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


}

