提交 | 用户 | 时间
|
fd2207
|
1 |
package com.jcdm.main.bs.workshop.controller; |
懒 |
2 |
|
|
3 |
import java.util.List; |
|
4 |
import javax.servlet.http.HttpServletResponse; |
|
5 |
|
b6c635
|
6 |
import com.jcdm.common.core.domain.entity.SysUser; |
fd2207
|
7 |
import com.jcdm.main.bs.workshop.service.IBsWorkshopInfoService; |
懒 |
8 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
9 |
import org.springframework.beans.factory.annotation.Autowired; |
|
10 |
import org.springframework.web.bind.annotation.GetMapping; |
|
11 |
import org.springframework.web.bind.annotation.PostMapping; |
|
12 |
import org.springframework.web.bind.annotation.PutMapping; |
|
13 |
import org.springframework.web.bind.annotation.DeleteMapping; |
|
14 |
import org.springframework.web.bind.annotation.PathVariable; |
|
15 |
import org.springframework.web.bind.annotation.RequestBody; |
|
16 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
17 |
import org.springframework.web.bind.annotation.RestController; |
|
18 |
import com.jcdm.common.annotation.Log; |
|
19 |
import com.jcdm.common.core.controller.BaseController; |
|
20 |
import com.jcdm.common.core.domain.AjaxResult; |
|
21 |
import com.jcdm.common.enums.BusinessType; |
|
22 |
import com.jcdm.main.bs.workshop.domain.BsWorkshopInfo; |
|
23 |
import com.jcdm.common.utils.poi.ExcelUtil; |
|
24 |
import com.jcdm.common.core.page.TableDataInfo; |
b6c635
|
25 |
import org.springframework.web.multipart.MultipartFile; |
fd2207
|
26 |
|
懒 |
27 |
/** |
7a46a6
|
28 |
* 车间信息Controller123 |
fd2207
|
29 |
* |
懒 |
30 |
* @author jc |
|
31 |
* @date 2023-12-06 |
|
32 |
*/ |
|
33 |
@RestController |
|
34 |
@RequestMapping("/bs/workshop") |
|
35 |
public class BsWorkshopInfoController extends BaseController |
|
36 |
{ |
|
37 |
@Autowired |
|
38 |
private IBsWorkshopInfoService bsWorkshopInfoService; |
|
39 |
|
|
40 |
/** |
|
41 |
* 查询车间信息列表 |
|
42 |
*/ |
|
43 |
@PreAuthorize("@ss.hasPermi('bs:workshop:list')") |
|
44 |
@GetMapping("/list") |
|
45 |
public TableDataInfo list(BsWorkshopInfo bsWorkshopInfo) |
|
46 |
{ |
|
47 |
startPage(); |
|
48 |
List<BsWorkshopInfo> list = bsWorkshopInfoService.selectBsWorkshopInfoList(bsWorkshopInfo); |
|
49 |
return getDataTable(list); |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* 导出车间信息列表 |
|
54 |
*/ |
|
55 |
@PreAuthorize("@ss.hasPermi('bs:workshop:export')") |
|
56 |
@Log(title = "车间信息", businessType = BusinessType.EXPORT) |
|
57 |
@PostMapping("/export") |
|
58 |
public void export(HttpServletResponse response, BsWorkshopInfo bsWorkshopInfo) |
|
59 |
{ |
|
60 |
List<BsWorkshopInfo> list = bsWorkshopInfoService.selectBsWorkshopInfoList(bsWorkshopInfo); |
|
61 |
ExcelUtil<BsWorkshopInfo> util = new ExcelUtil<BsWorkshopInfo>(BsWorkshopInfo.class); |
|
62 |
util.exportExcel(response, list, "车间信息数据"); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* 获取车间信息详细信息 |
|
67 |
*/ |
|
68 |
@PreAuthorize("@ss.hasPermi('bs:workshop:query')") |
|
69 |
@GetMapping(value = "/{id}") |
|
70 |
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
71 |
{ |
|
72 |
return success(bsWorkshopInfoService.selectBsWorkshopInfoById(id)); |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* 新增车间信息 |
|
77 |
*/ |
|
78 |
@PreAuthorize("@ss.hasPermi('bs:workshop:add')") |
|
79 |
@Log(title = "车间信息", businessType = BusinessType.INSERT) |
|
80 |
@PostMapping |
|
81 |
public AjaxResult add(@RequestBody BsWorkshopInfo bsWorkshopInfo) |
|
82 |
{ |
|
83 |
return toAjax(bsWorkshopInfoService.insertBsWorkshopInfo(bsWorkshopInfo)); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* 修改车间信息 |
|
88 |
*/ |
|
89 |
@PreAuthorize("@ss.hasPermi('bs:workshop:edit')") |
|
90 |
@Log(title = "车间信息", businessType = BusinessType.UPDATE) |
|
91 |
@PutMapping |
|
92 |
public AjaxResult edit(@RequestBody BsWorkshopInfo bsWorkshopInfo) |
|
93 |
{ |
|
94 |
return toAjax(bsWorkshopInfoService.updateBsWorkshopInfo(bsWorkshopInfo)); |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* 删除车间信息 |
|
99 |
*/ |
|
100 |
@PreAuthorize("@ss.hasPermi('bs:workshop:remove')") |
|
101 |
@Log(title = "车间信息", businessType = BusinessType.DELETE) |
|
102 |
@DeleteMapping("/{ids}") |
|
103 |
public AjaxResult remove(@PathVariable Long[] ids) |
|
104 |
{ |
|
105 |
return toAjax(bsWorkshopInfoService.deleteBsWorkshopInfoByIds(ids)); |
|
106 |
} |
b6c635
|
107 |
|
懒 |
108 |
@PostMapping("/importTemplate") |
|
109 |
public void importTemplate(HttpServletResponse response) |
|
110 |
{ |
|
111 |
ExcelUtil<BsWorkshopInfo> util = new ExcelUtil<>(BsWorkshopInfo.class); |
|
112 |
util.importTemplateExcel(response, "车间数据"); |
|
113 |
} |
|
114 |
|
|
115 |
@PostMapping("/importData") |
|
116 |
public AjaxResult importData(MultipartFile file, boolean updateSupport) throws Exception |
|
117 |
{ |
|
118 |
ExcelUtil<BsWorkshopInfo> util = new ExcelUtil<BsWorkshopInfo>(BsWorkshopInfo.class); |
|
119 |
List<BsWorkshopInfo> workshopList = util.importExcel(file.getInputStream()); |
|
120 |
String operName = getUsername(); |
|
121 |
String message = bsWorkshopInfoService.importWrokshop(workshopList, updateSupport, operName); |
|
122 |
return success(message); |
|
123 |
} |
fd2207
|
124 |
} |