提交 | 用户 | 时间
|
fd2207
|
1 |
package com.jcdm.main.bs.material.controller; |
懒 |
2 |
|
|
3 |
import java.util.List; |
|
4 |
import javax.servlet.http.HttpServletResponse; |
|
5 |
|
|
6 |
import com.jcdm.common.utils.DateUtils; |
|
7 |
import com.jcdm.main.bs.material.domain.BsMaterialInfo; |
|
8 |
import com.jcdm.main.bs.material.service.IBsMaterialInfoService; |
|
9 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
10 |
import org.springframework.beans.factory.annotation.Autowired; |
|
11 |
import org.springframework.web.bind.annotation.GetMapping; |
|
12 |
import org.springframework.web.bind.annotation.PostMapping; |
|
13 |
import org.springframework.web.bind.annotation.PutMapping; |
|
14 |
import org.springframework.web.bind.annotation.DeleteMapping; |
|
15 |
import org.springframework.web.bind.annotation.PathVariable; |
|
16 |
import org.springframework.web.bind.annotation.RequestBody; |
|
17 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
18 |
import org.springframework.web.bind.annotation.RestController; |
|
19 |
import com.jcdm.common.annotation.Log; |
|
20 |
import com.jcdm.common.core.controller.BaseController; |
|
21 |
import com.jcdm.common.core.domain.AjaxResult; |
|
22 |
import com.jcdm.common.enums.BusinessType; |
|
23 |
import com.jcdm.common.utils.poi.ExcelUtil; |
|
24 |
import com.jcdm.common.core.page.TableDataInfo; |
|
25 |
import com.jcdm.common.utils.DateUtils; |
|
26 |
|
|
27 |
/** |
|
28 |
* 物料信息Controller |
|
29 |
* |
|
30 |
* @author yyt |
|
31 |
* @date 2023-12-09 |
|
32 |
*/ |
|
33 |
@RestController |
|
34 |
@RequestMapping("/bs/material") |
|
35 |
public class BsMaterialInfoController extends BaseController |
|
36 |
{ |
|
37 |
@Autowired |
|
38 |
private IBsMaterialInfoService bsMaterialInfoService; |
|
39 |
|
|
40 |
/** |
|
41 |
* 查询物料信息列表 |
|
42 |
*/ |
|
43 |
@PreAuthorize("@ss.hasPermi('bs:material:list')") |
|
44 |
@GetMapping("/list") |
|
45 |
public TableDataInfo list(BsMaterialInfo bsMaterialInfo) |
|
46 |
{ |
|
47 |
startPage(); |
|
48 |
List<BsMaterialInfo> list = bsMaterialInfoService.selectBsMaterialInfoList(bsMaterialInfo); |
|
49 |
return getDataTable(list); |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* 导出物料信息列表 |
|
54 |
*/ |
|
55 |
@PreAuthorize("@ss.hasPermi('bs:material:export')") |
|
56 |
@Log(title = "物料信息", businessType = BusinessType.EXPORT) |
|
57 |
@PostMapping("/export") |
|
58 |
public void export(HttpServletResponse response, BsMaterialInfo bsMaterialInfo) |
|
59 |
{ |
|
60 |
List<BsMaterialInfo> list = bsMaterialInfoService.selectBsMaterialInfoList(bsMaterialInfo); |
|
61 |
ExcelUtil<BsMaterialInfo> util = new ExcelUtil<BsMaterialInfo>(BsMaterialInfo.class); |
|
62 |
util.exportExcel(response, list, "物料信息数据"); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* 获取物料信息详细信息 |
|
67 |
*/ |
|
68 |
@PreAuthorize("@ss.hasPermi('bs:material:query')") |
|
69 |
@GetMapping(value = "/{id}") |
|
70 |
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
71 |
{ |
|
72 |
return success(bsMaterialInfoService.selectBsMaterialInfoById(id)); |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* 新增物料信息 |
|
77 |
*/ |
|
78 |
@PreAuthorize("@ss.hasPermi('bs:material:add')") |
|
79 |
@Log(title = "物料信息", businessType = BusinessType.INSERT) |
|
80 |
@PostMapping |
|
81 |
public AjaxResult add(@RequestBody BsMaterialInfo bsMaterialInfo) |
|
82 |
{ |
|
83 |
bsMaterialInfo.setCreateBy(getUsername()); |
|
84 |
bsMaterialInfo.setCreateTime(DateUtils.getNowDate()); |
|
85 |
return toAjax(bsMaterialInfoService.insertBsMaterialInfo(bsMaterialInfo)); |
|
86 |
} |
|
87 |
|
|
88 |
/** |
|
89 |
* 修改物料信息 |
|
90 |
*/ |
|
91 |
@PreAuthorize("@ss.hasPermi('bs:material:edit')") |
|
92 |
@Log(title = "物料信息", businessType = BusinessType.UPDATE) |
|
93 |
@PutMapping |
|
94 |
public AjaxResult edit(@RequestBody BsMaterialInfo bsMaterialInfo) |
|
95 |
{ |
|
96 |
bsMaterialInfo.setUpdateBy(getUsername()); |
|
97 |
bsMaterialInfo.setUpdateTime(DateUtils.getNowDate()); |
|
98 |
return toAjax(bsMaterialInfoService.updateBsMaterialInfo(bsMaterialInfo)); |
|
99 |
} |
|
100 |
|
|
101 |
/** |
|
102 |
* 删除物料信息 |
|
103 |
*/ |
|
104 |
@PreAuthorize("@ss.hasPermi('bs:material:remove')") |
|
105 |
@Log(title = "物料信息", businessType = BusinessType.DELETE) |
|
106 |
@DeleteMapping("/{ids}") |
|
107 |
public AjaxResult remove(@PathVariable Long[] ids) |
|
108 |
{ |
|
109 |
return toAjax(bsMaterialInfoService.deleteBsMaterialInfoByIds(ids)); |
|
110 |
} |
|
111 |
} |