package com.fjhx.controller.stock;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.base.Condition;
import com.fjhx.service.stock.StockService;
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.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * <p>
 * 库存表 前端控制器
 * </p>
 *
 * @author ${author}
 * @since 2022-09-22
 */
@RestController
@RequestMapping("/stock")
public class StockController {

    @Autowired
    private StockService stockService;

    /**
     * 今日剩余统计
     */
    @PostMapping("/statistics")
    public R statistics() {
        Map<String, Object> result = stockService.statistics();
        return R.success(result);
    }

    /**
     * 今日剩余分页
     */
    @PostMapping("/page")
    public R page(Condition condition) {
        Page<Map<String, Object>> result = stockService.getPage(condition);
        return R.success(result);
    }

}

