package com.fjhx.material.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.tool.api.R;
import com.fjhx.entity.material.MaterialReceivingDetails;
import com.fjhx.params.material.MaterialReceivingDetailsVo;
import com.fjhx.material.service.MaterialReceivingDetailsService;
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-11
 */
@RestController
@RequestMapping("/materialReceivingDetails")
public class MaterialReceivingDetailsController {

    @Autowired
    private MaterialReceivingDetailsService materialReceivingDetailsService;

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

    @PostMapping("/add")
    public R add(@RequestBody MaterialReceivingDetailsVo materialReceivingDetailsVo){
        materialReceivingDetailsService.add(materialReceivingDetailsVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody MaterialReceivingDetailsVo materialReceivingDetailsVo){
        materialReceivingDetailsService.edit(materialReceivingDetailsVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody MaterialReceivingDetailsVo materialReceivingDetailsVo){
        materialReceivingDetailsService.delete(materialReceivingDetailsVo);
        return R.success();
    }

}

