package com.fjhx.controller.stock;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springblade.core.tool.api.R;
import com.fjhx.entity.stock.StockArea;
import com.fjhx.params.stock.StockAreaVo;
import com.fjhx.service.stock.StockAreaService;
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-05
 */
@RestController
@RequestMapping("/stockArea")
public class StockAreaController {

    @Autowired
    private StockAreaService stockAreaService;

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

    @PostMapping("/add")
    public R add(@RequestBody StockAreaVo stockAreaVo){
        stockAreaService.add(stockAreaVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody StockAreaVo stockAreaVo){
        stockAreaService.edit(stockAreaVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody StockAreaVo stockAreaVo){
        stockAreaService.delete(stockAreaVo);
        return R.success();
    }

}

