InventoryController.java
2.77 KB
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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package com.ruoyi.service.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysDictData;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.core.domain.model.LoginUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.service.domain.Inventory;
import com.ruoyi.service.service.DepotService;
import com.ruoyi.service.service.InventoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.List;
/**
* 库房盘点
*
* @author ym
*/
@RestController
@RequestMapping("/service/inventory")
public class InventoryController extends BaseController
{
@Resource
private InventoryService inventoryService;
@PreAuthorize("@ss.hasPermi('service:inventory:add')")
@Log(title = "库房盘点", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody Inventory inventory)
{
String selectType1=inventory.getSelectType1()==null?"":inventory.getSelectType1();
String selectType2=inventory.getSelectType2()==null?"":inventory.getSelectType2();
String selectType3=inventory.getSelectType3()==null?"":inventory.getSelectType3();
String factory=selectType1+"&"+selectType2+"&"+selectType3;
inventory.setFactor(factory);
return toAjax(inventoryService.insert(inventory));
}
@PreAuthorize("@ss.hasPermi('service:inventory:edit')")
@Log(title = "库房盘点", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody Inventory inventory)
{
if (inventoryService.update(inventory) > 0)
{
return AjaxResult.success();
}
return AjaxResult.error("编辑失败,请联系管理员");
}
@PreAuthorize("@ss.hasPermi('service:inventory:remove')")
@Log(title = "库房盘点", businessType = BusinessType.DELETE)
@DeleteMapping("/{ids}")
public AjaxResult remove(@PathVariable Long[] ids)
{
inventoryService.delete(ids);
return success();
}
@PreAuthorize("@ss.hasPermi('service:inventory:list')")
@GetMapping("/list")
public TableDataInfo list(Inventory inventory)
{
startPage();
List<Inventory> list = inventoryService.selectList(inventory);
return getDataTable(list);
}
}