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.StockTag;
import com.fjhx.params.stock.StockTagVo;
import com.fjhx.stock.service.StockTagService;
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-11-14
 */
@RestController
@RequestMapping("/stockTag")
public class StockTagController {

    @Autowired
    private StockTagService stockTagService;

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

    @PostMapping("/add")
    public R add(@RequestBody StockTagVo stockTagVo){
        stockTagService.add(stockTagVo);
        return R.success();
    }

    @PostMapping("/edit")
    public R edit(@RequestBody StockTagVo stockTagVo){
        stockTagService.edit(stockTagVo);
        return R.success();
    }

    @PostMapping("/delete")
    public R delete(@RequestBody StockTagVo stockTagVo){
        stockTagService.delete(stockTagVo);
        return R.success();
    }

}

