lishenao
18 小时以前 fbc53e77f994f15c3ebcd4fa07dfd23671c0ce26
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
package com.ruoyi.inventory.controller;
 
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ruoyi.basic.dto.SupplierManageDto;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.inventory.dto.StockManagementDto;
import com.ruoyi.inventory.dto.StockoutDto;
import com.ruoyi.inventory.pojo.StockManagement;
import com.ruoyi.inventory.service.StockManagementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.CollectionUtils;
import org.springframework.web.bind.annotation.*;
 
import javax.servlet.http.HttpServletResponse;
import java.util.List;
 
import static com.ruoyi.framework.web.domain.AjaxResult.error;
import static com.ruoyi.framework.web.domain.AjaxResult.success;
 
@RestController
@RequestMapping("/stockmanagement")
public class StockManagementController {
    @Autowired
    private StockManagementService stockManagementService;
//    根据id查询
    @RequestMapping("/{id}")
    public AjaxResult getStockManageById(@PathVariable Long id) {
        return success(stockManagementService.getStockManageById(id));
    }
 
//    更新库存
    @PutMapping("/update")
    public AjaxResult updateStockManagement(@RequestBody StockManagement stockManagement) {
        stockManagementService.updateStockManagement(stockManagement);
        return AjaxResult.success();
    }
    @DeleteMapping("/del")
    public AjaxResult delStockManage(@RequestBody List<Integer> ids) {
        if(CollectionUtils.isEmpty(ids)){
            return AjaxResult.error("请选择至少一条数据");
        }
        stockManagementService.delStockManage(ids);
        return AjaxResult.success();
    }
//    分页查询
    @GetMapping("/page")
    public AjaxResult getStockManagementPage(Page page, StockManagementDto stockManagementdto) {
        return success(stockManagementService.selectStockManagePage(page, stockManagementdto));
    }
//    导出
    @PostMapping("/export")
    public void stockmanageExport(HttpServletResponse response, StockManagementDto stockManagementDto) {
        stockManagementService.stockManageExport(response, stockManagementDto);
    }
    @RequestMapping("/stockout")
    public AjaxResult stockout(@RequestBody StockManagement stockManagement) {
        return success(stockManagementService.stockout(stockManagement));
    }
 
}