package com.fjhx.stock.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.tool.api.R;
import com.fjhx.entity.stock.StockBackPlanDetails;
import com.fjhx.params.stock.StockBackPlanDetailsVo;
import com.fjhx.stock.service.StockBackPlanDetailsService;
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-02
 */
@RestController
@RequestMapping("/stockBackPlanDetails")
public class StockBackPlanDetailsController {

    @Autowired
    private StockBackPlanDetailsService stockBackPlanDetailsService;

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

    @PostMapping("/add")
    public R add(@RequestBody StockBackPlanDetailsVo stockBackPlanDetailsVo){
        stockBackPlanDetailsService.add(stockBackPlanDetailsVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody StockBackPlanDetailsVo stockBackPlanDetailsVo){
        stockBackPlanDetailsService.edit(stockBackPlanDetailsVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody StockBackPlanDetailsVo stockBackPlanDetailsVo){
        stockBackPlanDetailsService.delete(stockBackPlanDetailsVo);
        return R.success();
    }

}

