yantian yue
2023-10-17 487b2f2a353b89ab46cd9b784226b600b7b915b8
提交 | 用户 | 时间
1ac2bc 1 package cn.stylefeng.guns.modular.zsx.bs.productBomChildInfo.controller;
2
3 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
4 import cn.stylefeng.guns.modular.zsx.bs.productBomChildInfo.entity.ProductBomChildInfo;
5 import cn.stylefeng.guns.modular.zsx.bs.productBomChildInfo.model.params.ProductBomChildInfoParam;
6 import cn.stylefeng.guns.modular.zsx.bs.productBomChildInfo.service.ProductBomChildInfoService;
7 import cn.stylefeng.guns.modular.zsx.bs.productBomInfo.entity.ProductBomInfo;
8 import cn.stylefeng.guns.modular.zsx.bs.productBomInfo.service.ProductBomInfoService;
9 import cn.stylefeng.guns.sys.modular.system.entity.DictType;
10 import cn.stylefeng.roses.core.base.controller.BaseController;
11 import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;
12 import cn.stylefeng.roses.kernel.model.exception.RequestEmptyException;
13 import cn.stylefeng.roses.kernel.model.response.ResponseData;
14 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
15 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.stereotype.Controller;
17 import org.springframework.ui.Model;
18 import org.springframework.web.bind.annotation.RequestMapping;
19 import org.springframework.web.bind.annotation.RequestParam;
20 import org.springframework.web.bind.annotation.ResponseBody;
21
22
23 /**
24  * 基础BOM控制器
25  *
26  * @author ruimin
27  * @Date 2023-08-24 08:49:34
28  */
29 @Controller
30 @RequestMapping("/productBomChildInfo")
31 public class ProductBomChildInfoController extends BaseController {
32
33     private String PREFIX = "/modular/bs/productBomChildInfo";
34
35     @Autowired
36     private ProductBomChildInfoService productBomChildInfoService;
37
38     @Autowired
39     private ProductBomInfoService bomInfoService;
40
41     /**
42      * 跳转到主页面
43      *
44      * @author ruimin
45      * @Date 2023-08-24
46      */
47     @RequestMapping("")
48     @DataSource(name = "self")
49     public String index(@RequestParam("bomCode") String bomInfoCode, Model model) {
50         model.addAttribute("bomInfoCode", bomInfoCode);
51         ProductBomInfo productBomInfo = bomInfoService.getOne(new QueryWrapper<ProductBomInfo>().eq("bom_code", bomInfoCode));
52         if (productBomInfo == null) {
53             throw new RequestEmptyException();
54         }
55         model.addAttribute("bomInfoName", productBomInfo.getBomName());
56         return PREFIX + "/productBomChildInfo.html";
57     }
58
59     @RequestMapping("/bomChildHomePage")
60     public String index() {
61         return PREFIX + "/productBomChildInfo.html";
62     }
63
64     /**
65      * 新增页面
66      *
67      * @author ruimin
68      * @Date 2023-08-24
69      */
70     @RequestMapping("/add")
71     @DataSource(name = "self")
72     public String add(@RequestParam("bomInfoCode") String bomInfoCode, Model model) {
73         model.addAttribute("bomInfoCode", bomInfoCode);
74         ProductBomInfo productBomInfo = bomInfoService.getOne(new QueryWrapper<ProductBomInfo>().eq("bom_code", bomInfoCode));
75         if (productBomInfo == null) {
76             throw new RequestEmptyException();
77         }
78         return PREFIX + "/productBomChildInfo_add.html";
79     }
80
81     /**
82      * 编辑页面
83      *
84      * @author ruimin
85      * @Date 2023-08-24
86      */
87     @RequestMapping("/edit")
88     public String edit() {
89         return PREFIX + "/productBomChildInfo_edit.html";
90     }
91
92     /**
93      * 新增接口
94      *
95      * @author ruimin
96      * @Date 2023-08-24
97      */
98     @RequestMapping("/addItem")
99     @ResponseBody
100     @DataSource(name = "self")
101     public ResponseData addItem(ProductBomChildInfoParam productBomChildInfoParam) {
102         this.productBomChildInfoService.add(productBomChildInfoParam);
103         return ResponseData.success();
104     }
105
106     /**
107      * 编辑接口
108      *
109      * @author ruimin
110      * @Date 2023-08-24
111      */
112     @RequestMapping("/editItem")
113     @ResponseBody
114     @DataSource(name = "self")
115     public ResponseData editItem(ProductBomChildInfoParam productBomChildInfoParam) {
116         this.productBomChildInfoService.update(productBomChildInfoParam);
117         return ResponseData.success();
118     }
119
120     /**
121      * 删除接口
122      *
123      * @author ruimin
124      * @Date 2023-08-24
125      */
126     @RequestMapping("/delete")
127     @ResponseBody
128     @DataSource(name = "self")
129     public ResponseData delete(ProductBomChildInfoParam productBomChildInfoParam) {
130         this.productBomChildInfoService.delete(productBomChildInfoParam);
131         return ResponseData.success();
132     }
133
134     /**
135      * 查看详情接口
136      *
137      * @author ruimin
138      * @Date 2023-08-24
139      */
140     @RequestMapping("/detail")
141     @ResponseBody
142     @DataSource(name = "self")
143     public ResponseData detail(ProductBomChildInfoParam productBomChildInfoParam) {
144         ProductBomChildInfo detail = this.productBomChildInfoService.getById(productBomChildInfoParam.getId());
145         return ResponseData.success(detail);
146     }
147
148     /**
149      * 查询列表
150      *
151      * @author ruimin
152      * @Date 2023-08-24
153      */
154     @ResponseBody
155     @RequestMapping("/list")
156     @DataSource(name = "self")
157     public LayuiPageInfo list(ProductBomChildInfoParam productBomChildInfoParam) {
158         return this.productBomChildInfoService.findPageBySpec(productBomChildInfoParam);
159     }
160
161 }
162
163