ContractPaymentController.java
1.19 KB
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;
@GetMapping("/contractPayment/{id}")
@SaCheckPermission(value = "contractPayment:query", orRole = "admin")
public List<ContractPayment> getPaymentById(@PathVariable Long id) {
return contractPaymentService.lambdaQuery().eq(ContractPayment::getContractId, id).list();
}
@PostMapping("/contractPayment")
@SaCheckPermission(value = "contractPayment:edit", orRole = "admin")
public String updPayment(@RequestBody List<ContractPaymentDTO> dtoList) {
return contractPaymentService.saveBatch(converter.convert(dtoList, ContractPayment.class)) ? "更新成功" : "更新失败";
}
}