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