ContractPaymentController.java 920 Bytes
package vion.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import io.github.linpeilie.Converter;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import vion.dto.ContractPaymentDTO;
import vion.model.ContractPayment;
import vion.service.IContractPaymentService;

import java.util.List;

/**
 * 合同收款方式
 */
@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class ContractPaymentController {

    private final IContractPaymentService contractPaymentService;
    private final Converter converter;

    @PostMapping("/contractPayment")
    @SaCheckPermission(value = "contractPayment:edit", orRole="admin")
    public String updPayment(@RequestBody List<ContractPaymentDTO> dtoList) {
        return contractPaymentService.saveBatch(converter.convert(dtoList, ContractPayment.class)) ? "更新成功" : "更新失败";
    }

}