cl
2024-01-19 e0fac38b26845f25de479783e0c76cf12a5311e0
提交 | 用户 | 时间
71e81e 1 package cn.stylefeng.guns.modular.bs.workshopInfo.controller;
2
3 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
4 import cn.stylefeng.guns.modular.bs.workshopInfo.entity.WorkshopInfo;
5 import cn.stylefeng.guns.modular.bs.workshopInfo.model.params.WorkshopInfoParam;
6 import cn.stylefeng.guns.modular.bs.workshopInfo.service.WorkshopInfoService;
7 import cn.stylefeng.roses.core.base.controller.BaseController;
8 import cn.stylefeng.roses.kernel.model.response.ResponseData;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.stereotype.Controller;
11 import org.springframework.web.bind.annotation.CrossOrigin;
12 import org.springframework.web.bind.annotation.GetMapping;
13 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.ResponseBody;
15
16 import java.util.ArrayList;
17 import java.util.List;
18
19
20 /**
21  * 车间信息控制器
22  *
23  * @author cl
24  * @Date 2022-10-28 14:57:59
25  */
26 @Controller
27 @RequestMapping("/workshopInfo")
28 public class WorkshopInfoController extends BaseController {
29
30     private String PREFIX = "modular/bs/workshopInfo";
31
32     @Autowired
33     private WorkshopInfoService workshopInfoService;
34
35     /**
36      * 跳转到主页面
37      *
38      * @author cl
39      * @Date 2022-10-28
40      */
41     @RequestMapping("")
42     public String index() {
43         return PREFIX + "/workshopInfo.html";
44     }
45
46     /**
47      * 新增页面
48      *
49      * @author cl
50      * @Date 2022-10-28
51      */
52     @RequestMapping("/add")
53     public String add() {
54         return PREFIX + "/workshopInfo_add.html";
55     }
56
57     /**
58      * 编辑页面
59      *
60      * @author cl
61      * @Date 2022-10-28
62      */
63     @RequestMapping("/edit")
64     public String edit() {
65         return PREFIX + "/workshopInfo_edit.html";
66     }
67
68     /**
69      * 新增接口
70      *
71      * @author cl
72      * @Date 2022-10-28
73      */
74     @RequestMapping("/addItem")
75     @ResponseBody
76     public ResponseData addItem(WorkshopInfoParam workshopInfoParam) {
77         this.workshopInfoService.add(workshopInfoParam);
78         return ResponseData.success();
79     }
80
81     /**
82      * 编辑接口
83      *
84      * @author cl
85      * @Date 2022-10-28
86      */
87     @RequestMapping("/editItem")
88     @ResponseBody
89     public ResponseData editItem(WorkshopInfoParam workshopInfoParam) {
90         this.workshopInfoService.update(workshopInfoParam);
91         return ResponseData.success();
92     }
93
94     /**
95      * 删除接口
96      *
97      * @author cl
98      * @Date 2022-10-28
99      */
100     @RequestMapping("/delete")
101     @ResponseBody
102     public ResponseData delete(WorkshopInfoParam workshopInfoParam) {
103         this.workshopInfoService.delete(workshopInfoParam);
104         return ResponseData.success();
105     }
106
107     /**
108      * 查看详情接口
109      *
110      * @author cl
111      * @Date 2022-10-28
112      */
113     @RequestMapping("/detail")
114     @ResponseBody
115     public ResponseData detail(WorkshopInfoParam workshopInfoParam) {
116         WorkshopInfo detail = this.workshopInfoService.getById(workshopInfoParam.getId());
117         return ResponseData.success(detail);
118     }
119
120     /**
121      * 查询列表
122      *
123      * @author cl
124      * @Date 2022-10-28
125      */
126     @ResponseBody
127     @RequestMapping("/list")
128     public LayuiPageInfo list(WorkshopInfoParam workshopInfoParam) {
129         return this.workshopInfoService.findPageBySpec(workshopInfoParam);
130     }
131
132     @ResponseBody
133     @RequestMapping("/selectList")
134     public ResponseData selectList(WorkshopInfoParam workshopInfoParam) {
135         return ResponseData.success(workshopInfoService.list());
136     }
137
138     @ResponseBody
139     @CrossOrigin
140     @RequestMapping("/codeList")
141     public ResponseData codeList(WorkshopInfoParam workshopInfoParam) {
142         List l = new ArrayList();
143         for (WorkshopInfo workshopInfo : workshopInfoService.list()) {
144             l.add(workshopInfo.getWorkshopCode());
145         }
146         return ResponseData.success(l);
147     }
148
149 }
150
151