package com.jwipc.finance.controller.rest;

import com.jwipc.finance.dto.PaymentChangeParamDTO;
import com.jwipc.finance.logic.PaymentChangeLogic;
import com.jwipc.finance.model.query.PaymentChangeQuery;
import com.jwipc.page.PageView;
import com.jwipc.sys.model.query.TaxQuery;
import lombok.RequiredArgsConstructor;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RestController;

import static com.jwipc.finance.constant.ModuleConst.MODULE_ROOT;

/**
 * <p>
 * 付款申请变更表 前端控制器
 * </p>
 *
 * @author shenyang.ou
 * @since 2025-11-25
 */
@RestController
@RequestMapping(MODULE_ROOT + "/payment/change/rest")
@RequiredArgsConstructor
public class PaymentChangeRestController {
    private final PaymentChangeLogic paymentChangeLogic;
    @PostMapping("/saveOrUpdate")
    public ResponseEntity saveOrUpdate(@RequestBody PaymentChangeParamDTO param) {
        paymentChangeLogic.saveOrUpdate(param);
        return ResponseEntity.ok(true);
    }

    /**
     * 列表
     *
     * @param query
     * @return
     */
    @RequestMapping("/list")
    public PageView list(PaymentChangeQuery query) {
        return paymentChangeLogic.findByPage(query);
    }
}
