package com.dayou.controller;

import com.dayou.vo.FinanceRealFundVO;
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.IFinanceRealFundService;
import com.dayou.entity.FinanceRealFund;
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 2023-12-08
 */
@RestController
@RequestMapping("financeRealFund")
@Slf4j
public class FinanceRealFundController extends BaseController {
    @Autowired
    private IFinanceRealFundService financeRealFundService;

    /**
    * 财务实收款列表
    */
    @GetMapping("")
    public RestResponse<Page<FinanceRealFundVO>> page(FinanceRealFund financeRealFund, Page page,String keyword){
        Page<FinanceRealFundVO> pages=financeRealFundService.selectPage(page,financeRealFund,keyword);
        return RestResponse.data(pages);
    }

    /**
     * 财务实收款详情
     */
    @GetMapping("/{id}")
    public RestResponse<FinanceRealFund> detail(@PathVariable Long id){
        FinanceRealFund xFinanceRealFund =financeRealFundService.detail(id);
        return RestResponse.data(xFinanceRealFund);
     }

    /**
     * 财务实收款新增
     */
    @PostMapping("")
    public RestResponse<Boolean> save(@RequestBody FinanceRealFund financeRealFund) {
        Boolean ret = financeRealFundService.add(financeRealFund);
        return RestResponse.data(ret);
    }

    /**
     * 财务实收款更新
     */
    @PutMapping("")
    public RestResponse<Boolean> update(@RequestBody FinanceRealFund financeRealFund) {
        Boolean ret = financeRealFundService.update(financeRealFund);
        return RestResponse.data(ret);
    }

    /**
     * 财务实收款删除
     */
    @DeleteMapping("/{id}")
    public RestResponse<Boolean> delete(@PathVariable Long id) {
        Boolean ret = financeRealFundService.delete(id);
        return RestResponse.data(ret);
    }


}

