package com.fjhx.wms.controller.stock;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.fjhx.common.constant.SourceConstant;
import com.fjhx.wms.entity.stock.dto.StockJournalDetailsDto;
import com.fjhx.wms.entity.stock.dto.StockJournalDetailsSelectDto;
import com.fjhx.wms.entity.stock.dto.StockJournalSelectDto;
import com.fjhx.wms.entity.stock.vo.StockJournalVo;
import org.springframework.web.bind.annotation.*;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.fjhx.wms.entity.stock.vo.StockJournalDetailsVo;
import com.ruoyi.common.core.domain.BaseSelectDto;
import com.fjhx.wms.service.stock.StockJournalDetailsService;
import org.springframework.beans.factory.annotation.Autowired;


/**
 * <p>
 * 出入库记录明细 前端控制器
 * </p>
 *
 * @author 
 * @since 2023-03-20
 */
@DS(SourceConstant.WMS)
@RestController
@RequestMapping("/stockJournalDetails")
public class StockJournalDetailsController {

    @Autowired
    private StockJournalDetailsService stockJournalDetailsService;

    /**
     * 出入库记录明细分页
     */
    @PostMapping("/page")
    public Page<StockJournalDetailsVo> page(@RequestBody StockJournalSelectDto dto) {
        return stockJournalDetailsService.getPage(dto);
    }

    /**
     * 出入库记录明细分页 维多利亚
     */
    @PostMapping("/pageByWdly")
    public Page<StockJournalDetailsVo> pageByWdly(@RequestBody StockJournalSelectDto dto) {
        return stockJournalDetailsService.getPageByWdly(dto);
    }

    /**
     * 出入库记录明细明细
     */
    @PostMapping("/detail")
    public StockJournalDetailsVo detail(@RequestBody BaseSelectDto dto) {
        return stockJournalDetailsService.detail(dto.getId());
    }

    /**
     * 出入库记录明细新增
     */
    @PostMapping("/add")
    public void add(@RequestBody StockJournalDetailsDto stockJournalDetailsDto) {
        stockJournalDetailsService.add(stockJournalDetailsDto);
    }

    /**
     * 出入库记录明细编辑
     */
    @PostMapping("/edit")
    public void edit(@RequestBody StockJournalDetailsDto stockJournalDetailsDto) {
        stockJournalDetailsService.edit(stockJournalDetailsDto);
    }

    /**
     * 出入库记录明细删除
     */
    @PostMapping("/delete")
    public void delete(@RequestBody BaseSelectDto dto) {
        stockJournalDetailsService.delete(dto.getId());
    }

}
