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.StockWaterdetial;
import com.fjhx.params.stock.StockWaterdetialVo;
import com.fjhx.stock.service.StockWaterdetialService;
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-12-12
 */
@RestController
@RequestMapping("/stockWaterdetial")
public class StockWaterdetialController {

    @Autowired
    private StockWaterdetialService stockWaterdetialService;

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

    @PostMapping("/add")
    public R add(@RequestBody StockWaterdetialVo stockWaterdetialVo){
        stockWaterdetialService.add(stockWaterdetialVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody StockWaterdetialVo stockWaterdetialVo){
        stockWaterdetialService.edit(stockWaterdetialVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody StockWaterdetialVo stockWaterdetialVo){
        stockWaterdetialService.delete(stockWaterdetialVo);
        return R.success();
    }

}

