yantian yue
2023-10-17 487b2f2a353b89ab46cd9b784226b600b7b915b8
提交 | 用户 | 时间
ffeba3 1 package cn.stylefeng.guns.modular.zsx.bs.formulaChild.controller;
2
3 import cn.stylefeng.guns.base.pojo.page.LayuiPageInfo;
4 import cn.stylefeng.guns.modular.zsx.bs.formula.entity.FormulaInfo;
5 import cn.stylefeng.guns.modular.zsx.bs.formula.service.FormulaInfoService;
6 import cn.stylefeng.guns.modular.zsx.bs.formulaChild.entity.FormulaChildInfo;
7 import cn.stylefeng.guns.modular.zsx.bs.formulaChild.model.params.FormulaChildInfoParam;
8 import cn.stylefeng.guns.modular.zsx.bs.formulaChild.service.FormulaChildInfoService;
9 import cn.stylefeng.guns.modular.zsx.bs.productBomInfo.entity.ProductBomInfo;
10 import cn.stylefeng.roses.core.base.controller.BaseController;
11 import cn.stylefeng.roses.kernel.model.exception.RequestEmptyException;
12 import cn.stylefeng.roses.kernel.model.response.ResponseData;
13 import cn.stylefeng.roses.core.mutidatasource.annotion.DataSource;
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 /**
25  * 配方配置子信息控制器
26  *
27  * @author ruimin
28  * @Date 2023-10-09 15:45:10
29  */
30 @Controller
31 @RequestMapping("/formulaChildInfo")
32 public class FormulaChildInfoController extends BaseController {
33
34     private String PREFIX = "/modular/bs/formulaChildInfo";
35
36     @Autowired
37     private FormulaChildInfoService formulaChildInfoService;
38
39     @Autowired
40     private FormulaInfoService formulaInfoService;
41
42     /**
43      * 跳转到主页面
44      *
45      * @author ruimin
46      * @Date 2023-10-09
47      */
48     @RequestMapping("")
49     @DataSource(name = "self")
50     public String index(@RequestParam("formulaCode") String formulaCode, Model model) {
51         model.addAttribute("formulaInfoCode", formulaCode);
52         FormulaInfo formulaInfo = formulaInfoService.getOne(new QueryWrapper<FormulaInfo>().eq("formula_code", formulaCode));
53         if (formulaInfo == null) {
54             throw new RequestEmptyException();
55         }
56         return PREFIX + "/formulaChildInfo.html";
57     }
58
59     /**
60      * 新增页面
61      *
62      * @author ruimin
63      * @Date 2023-10-09
64      */
65     @RequestMapping("/add")
66     @DataSource(name = "self")
67     public String add(@RequestParam("formulaInfoCode") String formulaCode, Model model) {
68         model.addAttribute("formulaInfoCode", formulaCode);
69         FormulaInfo formulaInfo = formulaInfoService.getOne(new QueryWrapper<FormulaInfo>().eq("formula_code", formulaCode));
70         if (formulaInfo == null) {
71             throw new RequestEmptyException();
72         }
73         return PREFIX + "/formulaChildInfo_add.html";
74     }
75
76     /**
77      * 编辑页面
78      *
79      * @author ruimin
80      * @Date 2023-10-09
81      */
82     @RequestMapping("/edit")
83     public String edit() {
84         return PREFIX + "/formulaChildInfo_edit.html";
85     }
86
87     /**
88      * 新增接口
89      *
90      * @author ruimin
91      * @Date 2023-10-09
92      */
93     @RequestMapping("/addItem")
94     @ResponseBody
95     @DataSource(name = "self")
96     public ResponseData addItem(FormulaChildInfoParam formulaChildInfoParam) {
97         this.formulaChildInfoService.add(formulaChildInfoParam);
98         return ResponseData.success();
99     }
100
101     /**
102      * 编辑接口
103      *
104      * @author ruimin
105      * @Date 2023-10-09
106      */
107     @RequestMapping("/editItem")
108     @ResponseBody
109     @DataSource(name = "self")
110     public ResponseData editItem(FormulaChildInfoParam formulaChildInfoParam) {
111         this.formulaChildInfoService.update(formulaChildInfoParam);
112         return ResponseData.success();
113     }
114
115     /**
116      * 删除接口
117      *
118      * @author ruimin
119      * @Date 2023-10-09
120      */
121     @RequestMapping("/delete")
122     @ResponseBody
123     @DataSource(name = "self")
124     public ResponseData delete(FormulaChildInfoParam formulaChildInfoParam) {
125         this.formulaChildInfoService.delete(formulaChildInfoParam);
126         return ResponseData.success();
127     }
128
129     /**
130      * 查看详情接口
131      *
132      * @author ruimin
133      * @Date 2023-10-09
134      */
135     @RequestMapping("/detail")
136     @ResponseBody
137     @DataSource(name = "self")
138     public ResponseData detail(FormulaChildInfoParam formulaChildInfoParam) {
139         FormulaChildInfo detail = this.formulaChildInfoService.getById(formulaChildInfoParam.getId());
140         return ResponseData.success(detail);
141     }
142
143     /**
144      * 查询列表
145      *
146      * @author ruimin
147      * @Date 2023-10-09
148      */
149     @ResponseBody
150     @RequestMapping("/list")
151     @DataSource(name = "self")
152     public LayuiPageInfo list(FormulaChildInfoParam formulaChildInfoParam) {
153         return this.formulaChildInfoService.findPageBySpec(formulaChildInfoParam);
154     }
155
156 }
157
158