lishenao
9 小时以前 5c1a58d067512df6099f9cc95f577c9991128163
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
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;
 
//    更新库存
    @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);
    }
}