ContractPaymentController.java
1.27 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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 vion.vo.ContractPaymentVO;
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<ContractPaymentVO> getPaymentById(@PathVariable Long id) {
return converter.convert(contractPaymentService.lambdaQuery().eq(ContractPayment::getContractId, id).list(), ContractPaymentVO.class);
}
@PostMapping("/contractPayment")
@SaCheckPermission(value = "contractPayment:edit", orRole = "admin")
public String updPayment(@RequestBody List<ContractPaymentDTO> dtoList) {
return contractPaymentService.saveBatch(converter.convert(dtoList, ContractPayment.class)) ? "更新成功" : "更新失败";
}
}