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