SettlementDiffController.java 1.73 KB
package vion.controller;

import cn.dev33.satoken.annotation.SaCheckPermission;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import lombok.RequiredArgsConstructor;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.*;
import vion.dto.SettlementDiffDTO;
import vion.service.ISettlementDiffService;
import vion.vo.SettlementDiffVO;


@RestController
@RequestMapping("/api")
@RequiredArgsConstructor
public class SettlementDiffController {

    private final ISettlementDiffService settlementDiffService;

    @GetMapping("/settlementDiff/list/{no}")
    @SaCheckPermission(value = "settlementDiff:list", orRole = "admin")
    public Page<SettlementDiffVO> list(@PathVariable String no, SettlementDiffDTO dto) {
        return settlementDiffService.list(no, dto);
    }

    @GetMapping("/settlementDiff/{id}")
    public SettlementDiffVO getVOById(@PathVariable Long id) {
        return settlementDiffService.getVOById(id);
    }

    @PostMapping("/settlementDiff")
    @SaCheckPermission(value = "settlementDiff:save", orRole = "admin")
    public String save(SettlementDiffDTO dto) {
        return settlementDiffService.save(dto);
    }

    @PostMapping("/settlementDiff/{id}")
    @SaCheckPermission(value = "settlementDiff:edit", orRole = "admin")
    public String update(@PathVariable Long id, SettlementDiffDTO dto) {
        dto.setId(id);
        return settlementDiffService.update(id, dto);
    }

    @DeleteMapping("/settlementDiff/{id}")
    @SaCheckPermission(value = "settlementDiff:remove", orRole = "admin")
    @Transactional(rollbackFor = Exception.class)
    public String delById(@PathVariable Long id) {
        return settlementDiffService.delById(id);
    }

}