package com.yh.saas.plugin.yiliangyiyun.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.yh.saas.plugin.yiliangyiyun.entity.NonContractExpenses;
import com.yh.saas.plugin.yiliangyiyun.service.INonContractExpensesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * <p>
 * 合同外费用 前端控制器
 * </p>
 *
 * @author Gdc
 * @since 2022-03-03
 */
@RestController
@RequestMapping("/nonContractExpenses")
public class NonContractExpensesController {
    @Autowired
    private INonContractExpensesService nonContractExpensesService;

    /**
     * 新增合同外费用信息
     */
    @PostMapping("/api/addInfo")
    public String addInfo(@RequestBody @Valid NonContractExpenses nonContractExpenses) {
        return nonContractExpensesService.addInfo(nonContractExpenses);
    }

    /**
     * 编辑
     */
    @PostMapping("/editInfo")
    public String editInfo(@RequestBody NonContractExpenses nonContractExpenses) {
        return nonContractExpensesService.editInfo(nonContractExpenses);
    }

    /**
     * 查看合同外费用信息
     */
    @GetMapping("/getInfo")
    public NonContractExpenses getInfo(@RequestParam String id) {
        return nonContractExpensesService.getInfo(id);
    }

    /**
     * 信息分页列表查询
     *
     * @param nonContractExpenses
     * @return
     */
    @GetMapping("/selectInfo")
    public Page<NonContractExpenses> selectInfo(NonContractExpenses nonContractExpenses) {
        return nonContractExpensesService.selectInfo(nonContractExpenses);
    }

    /**
     * 删除
     *
     * @param example
     * @return
     */
    @PostMapping("/deleteInfo")
    public void deleteInfo(@RequestBody  NonContractExpenses example) {
        nonContractExpensesService.deleteInfo(example.getId());
    }

    /**
     * 付款
     */
    @PostMapping("/payment")
    public String payment(@RequestBody NonContractExpenses nonContractExpenses) {
        return nonContractExpensesService.payment(nonContractExpenses);
    }

}

