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.StockBackDetails;
import com.fjhx.params.stock.StockBackDetailsVo;
import com.fjhx.stock.service.StockBackDetailsService;
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-08-31
 */
@RestController
@RequestMapping("/stockBackDetails")
public class StockBackDetailsController {

    @Autowired
    private StockBackDetailsService stockBackDetailsService;

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

    @PostMapping("/add")
    public R add(@RequestBody StockBackDetailsVo stockBackDetailsVo){
        stockBackDetailsService.add(stockBackDetailsVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody StockBackDetailsVo stockBackDetailsVo){
        stockBackDetailsService.edit(stockBackDetailsVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody StockBackDetailsVo stockBackDetailsVo){
        stockBackDetailsService.delete(stockBackDetailsVo);
        return R.success();
    }

}

