package com.fjhx.controller.contract;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.tool.api.R;
import com.fjhx.entity.contract.ContractDetails;
import com.fjhx.params.contract.ContractDetailsVo;
import com.fjhx.service.contract.ContractDetailsService;
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.Map;

/**
 * <p>
 * 合同明细 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-10-25
 */
@RestController
@RequestMapping("/contractDetails")
public class ContractDetailsController {

    @Autowired
    private ContractDetailsService contractDetailsService;

    @PostMapping("/page")
    public R page(@RequestBody Map<String, String> condition){
        Page<ContractDetails> result = contractDetailsService.getPage(condition);
        return R.success(result);
    }

    @PostMapping("/add")
    public R add(@RequestBody ContractDetailsVo contractDetailsVo){
        contractDetailsService.add(contractDetailsVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody ContractDetailsVo contractDetailsVo){
        contractDetailsService.edit(contractDetailsVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody ContractDetailsVo contractDetailsVo){
        contractDetailsService.delete(contractDetailsVo);
        return R.success();
    }

}

