mitao
2 天以前 a9f2a7f4fac47c7a5b1302db2e0c363a55459f84
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
61
62
63
64
65
66
67
68
69
package com.ruoyi.web.controller.api;
 
 
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ruoyi.common.core.domain.R;
import com.ruoyi.system.dto.asset.AssetWarehouseDTO;
import com.ruoyi.system.query.AssetWarehousePageQuery;
import com.ruoyi.system.service.AssetWarehouseService;
import com.ruoyi.system.vo.asset.AssetWarehouseVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
 
import javax.validation.Valid;
 
/**
 * <p>
 * 仓库信息表 前端控制器
 * </p>
 *
 * @author WuGuanFengYue
 * @since 2025-09-15
 */
@Api(tags = {"资产-仓库管理相关接口"})
@Validated
@RestController
@RequestMapping("/asset-warehouse")
@RequiredArgsConstructor
public class AssetWarehouseController {
    private final AssetWarehouseService assetWarehouseService;
 
    @ApiOperation("获取仓库分页列表")
    @PostMapping("/page-list")
    public R<IPage<AssetWarehouseVO>> getPageList(@RequestBody AssetWarehousePageQuery pageQuery) {
        IPage<AssetWarehouseVO> page = assetWarehouseService.getPageList(pageQuery);
        return R.ok(page);
    }
 
    @ApiOperation("新增仓库")
    @PostMapping("/add")
    public R<Void> addWarehouse(@Valid @RequestBody AssetWarehouseDTO dto) {
        assetWarehouseService.add(dto);
        return R.ok();
    }
 
    @ApiOperation("编辑仓库")
    @PutMapping("/add")
    public R<Void> editWarehouse(@Valid @RequestBody AssetWarehouseDTO dto) {
        assetWarehouseService.edit(dto);
        return R.ok();
    }
 
    @ApiOperation("删除仓库")
    @DeleteMapping("/{id}")
    public R<Void> deleteWarehouse(@ApiParam(name = "id", value = "仓库ID", required = true) @PathVariable Integer id) {
        assetWarehouseService.delete(id);
        return R.ok();
    }
 
}