package com.fjhx.account.controller.account;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.account.entity.account.dto.AccountRequestFundsDto;
import com.fjhx.account.entity.account.dto.AccountRequestFundsSelectDto;
import com.fjhx.account.entity.account.vo.AccountRequestFundsVo;
import com.fjhx.account.service.account.AccountRequestFundsService;
import com.fjhx.common.constant.SourceConstant;
import com.ruoyi.common.core.domain.BaseSelectDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;


/**
 * <p>
 * 请款表 前端控制器
 * </p>
 *
 * @author
 * @since 2023-04-10
 */
//@DS(SourceConstant.ACCOUNT)
@RestController
@RequestMapping("/accountRequestFunds")
public class AccountRequestFundsController {

    @Autowired
    private AccountRequestFundsService accountRequestFundsService;

    /**
     * 请款表分页
     */
    @PostMapping("/page")
    public Page<AccountRequestFundsVo> page(@RequestBody AccountRequestFundsSelectDto dto) {
        return accountRequestFundsService.getPage(dto);
    }

    /**
     * 请款表明细
     */
    @PostMapping("/detail")
    public AccountRequestFundsVo detail(@RequestBody BaseSelectDto dto) {
        return accountRequestFundsService.detail(dto.getId());
    }

    /**
     * 请款表新增
     */
    @PostMapping("/add")
    public void add(@RequestBody AccountRequestFundsDto accountRequestFundsDto) {
        accountRequestFundsService.add(accountRequestFundsDto);
    }

    /**
     * 请款表编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody AccountRequestFundsDto accountRequestFundsDto) {
        accountRequestFundsService.edit(accountRequestFundsDto);
    }

    /**
     * 请款表删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        accountRequestFundsService.delete(dto.getId());
    }

    /**
     * 获取历史付款信息
     */
    @PostMapping("/getPayHistoricalInfo")
    public List<AccountRequestFundsVo> getPayHistoricalInfo(@RequestBody AccountRequestFundsSelectDto dto) {
        return accountRequestFundsService.getPayHistoricalInfo(dto);
    }

}
