DepotStatesController.java
2.83 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
84
85
86
87
88
89
package com.ruoyi.service.controller;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.service.domain.Depot;
import com.ruoyi.service.domain.DepotStatus;
import com.ruoyi.service.service.DepotService;
import com.ruoyi.service.service.DepotStatusService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
/**
* 库房状态 控制层
*
* @author ym
*/
@RestController
@RequestMapping("/service/depotStatus")
public class DepotStatesController extends BaseController
{
@Resource
private DepotStatusService depotStatusService;
@Resource
private DepotService depotService;
@PreAuthorize("@ss.hasPermi('service:depotStatus:add')")
@Log(title = "库房状态", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@Validated @RequestBody DepotStatus depotStatus)
{
return toAjax(depotStatusService.insert(depotStatus));
}
@PreAuthorize("@ss.hasPermi('service:depotStatus:edit')")
@Log(title = "库房状态", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@Validated @RequestBody DepotStatus depotStatus)
{
if (depotStatusService.update(depotStatus) > 0)
{
return AjaxResult.success();
}
return AjaxResult.error("编辑失败,请联系管理员");
}
@PreAuthorize("@ss.hasPermi('service:depotStatus:remove')")
@Log(title = "库房状态", businessType = BusinessType.DELETE)
@DeleteMapping("/{id}")
public AjaxResult remove(@PathVariable Long id)
{
depotStatusService.delete(id);
return success();
}
@PreAuthorize("@ss.hasPermi('service:depotStatus:list')")
@GetMapping("/list")
public TableDataInfo list(DepotStatus depotStatus)
{
startPage();
List<DepotStatus> list = depotStatusService.selectList(depotStatus);
return getDataTable(list);
}
@Log(title = "库房状态", businessType = BusinessType.EXPORT)
@PreAuthorize("@ss.hasPermi('service:depotStatus:export')")
@PostMapping("/export")
public void export(HttpServletResponse response, DepotStatus depotStatus)
{
List<DepotStatus> list = depotStatusService.selectList(depotStatus);
ExcelUtil<DepotStatus> util = new ExcelUtil<>(DepotStatus.class);
util.exportExcel(response, list, "库房状态");
}
}