package com.fjhx.controller.apply;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.entity.apply.ApplyPurchaseDetails;
import com.fjhx.params.apply.ApplyPurchaseDetailsVo;
import com.fjhx.service.apply.ApplyPurchaseDetailsService;
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.Map;

/**
 * <p>
 * 物料申购明细 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-09-14
 */
@RestController
@RequestMapping("/applyPurchaseDetails")
public class ApplyPurchaseDetailsController {

    @Autowired
    private ApplyPurchaseDetailsService applyPurchaseDetailsService;

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

    @PostMapping("/add")
    public R add(@RequestBody ApplyPurchaseDetailsVo applyPurchaseDetailsVo) {
        applyPurchaseDetailsService.add(applyPurchaseDetailsVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody ApplyPurchaseDetailsVo applyPurchaseDetailsVo) {
        applyPurchaseDetailsService.edit(applyPurchaseDetailsVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody ApplyPurchaseDetailsVo applyPurchaseDetailsVo) {
        applyPurchaseDetailsService.delete(applyPurchaseDetailsVo);
        return R.success();
    }

}

