package org.dromara.erp.controller;

import lombok.RequiredArgsConstructor;
import org.dromara.common.core.domain.R;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.erp.domain.query.GoodsStockQuery;
import org.dromara.erp.domain.vo.GoodsStockVo;
import org.dromara.erp.service.IGoodsStockService;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 成品库存控制器
 *
 * @Author: Antigravity
 */
@Validated
@RequiredArgsConstructor
@RestController
@RequestMapping("/erp/goodsStock")
public class GoodsStockController {

    private final IGoodsStockService goodsStockService;

    /**
     * 分页查询成品库存列表
     */
    @GetMapping("/page")
    public TableDataInfo<GoodsStockVo> page(GoodsStockQuery query, PageQuery pageQuery) {
        return goodsStockService.queryPageList(query, pageQuery);
    }

    /**
     * 查询成品库存列表（不分页）
     */
    @GetMapping("/list")
    public R<List<GoodsStockVo>> list(GoodsStockQuery query) {
        return R.ok(goodsStockService.queryList(query));
    }
}