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