package com.fjhx.controller.stock;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.base.Condition;
import com.fjhx.entity.stock.StockTransfer;
import com.fjhx.params.stock.StockTransferAddVo;
import com.fjhx.service.stock.StockTransferService;
import org.springblade.core.tool.api.R;
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-14
 */
@RestController
@RequestMapping("/stockTransfer")
public class StockTransferController {

    @Autowired
    private StockTransferService stockTransferService;

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

    @PostMapping("/add")
    public R add(@RequestBody StockTransferAddVo stockTransferAddVo) {
        stockTransferService.add(stockTransferAddVo);
        return R.success();
    }

    /**
     * 接收
     */
    @PostMapping("/receive")
    public R receive(@RequestBody StockTransfer stockTransfer) {
        stockTransferService.receive(stockTransfer);
        return R.success();
    }

}

