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