package com.fjhx.wms.controller.warehouse;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.fjhx.common.constant.SourceConstant;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.wms.entity.warehouse.vo.WarehouseVo;
import com.fjhx.wms.entity.warehouse.dto.WarehouseSelectDto;
import com.fjhx.wms.entity.warehouse.dto.WarehouseDto;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.wms.service.warehouse.WarehouseService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 仓库 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-03-20
 */
//@DS(SourceConstant.WMS)
@RestController
@RequestMapping("/warehouse")
public class WarehouseController {

    @Autowired
    private WarehouseService warehouseService;

    /**
     * 仓库分页
     */
    @PostMapping("/page")
    public Page<WarehouseVo> page(@RequestBody WarehouseSelectDto dto) {
        return warehouseService.getPage(dto);
    }

    /**
     * 仓库明细
     */
    @PostMapping("/detail")
    public WarehouseVo detail(@RequestBody BaseSelectDto dto) {
        return warehouseService.detail(dto.getId());
    }

    /**
     * 仓库新增
     */
    @PostMapping("/add")
    public void add(@RequestBody WarehouseDto warehouseDto) {
        warehouseService.add(warehouseDto);
    }

    /**
     * 仓库编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody WarehouseDto warehouseDto) {
        warehouseService.edit(warehouseDto);
    }

    /**
     * 仓库删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        warehouseService.delete(dto.getId());
    }

}
