package com.fjhx.controller.contract;

import com.fjhx.entity.contract.ContractEnclosure;
import com.fjhx.params.contract.ContractEnclosureVo;
import com.fjhx.service.contract.ContractEnclosureService;
import org.springblade.core.tool.api.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 合同附件 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-10-21
 */
@RestController
@RequestMapping("/contractEnclosure")
public class ContractEnclosureController {

    @Autowired
    private ContractEnclosureService contractEnclosureService;

    @PostMapping("/list")
    public R page(@RequestBody ContractEnclosure contractEnclosure) {
        List<ContractEnclosure> result = contractEnclosureService.getPage(contractEnclosure);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody ContractEnclosureVo contractEnclosureVo) {
        contractEnclosureService.add(contractEnclosureVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody ContractEnclosureVo contractEnclosureVo) {
        contractEnclosureService.edit(contractEnclosureVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody ContractEnclosureVo contractEnclosureVo) {
        contractEnclosureService.delete(contractEnclosureVo);
        return R.success();
    }

}

