懒羊羊
2024-01-29 a36b834b2957440a755652ff17d067b18f4e9250
提交 | 用户 | 时间
4e2a0c 1 package com.jcdm.main.bs.formulaChild.controller;
2
3 import java.util.List;
4 import javax.servlet.http.HttpServletResponse;
5 import org.springframework.security.access.prepost.PreAuthorize;
6 import org.springframework.beans.factory.annotation.Autowired;
7 import org.springframework.web.bind.annotation.GetMapping;
8 import org.springframework.web.bind.annotation.PostMapping;
9 import org.springframework.web.bind.annotation.PutMapping;
10 import org.springframework.web.bind.annotation.DeleteMapping;
11 import org.springframework.web.bind.annotation.PathVariable;
12 import org.springframework.web.bind.annotation.RequestBody;
13 import org.springframework.web.bind.annotation.RequestMapping;
14 import org.springframework.web.bind.annotation.RestController;
15 import com.jcdm.common.annotation.Log;
16 import com.jcdm.common.core.controller.BaseController;
17 import com.jcdm.common.core.domain.AjaxResult;
18 import com.jcdm.common.enums.BusinessType;
19 import com.jcdm.main.bs.formulaChild.domain.BsFormulaChildInfo;
20 import com.jcdm.main.bs.formulaChild.service.IBsFormulaChildInfoService;
21 import com.jcdm.common.utils.poi.ExcelUtil;
22 import com.jcdm.common.core.page.TableDataInfo;
23
24 /**
25  * 配方配置子信息Controller
26  * 
27  * @author ruimin
28  * @date 2023-12-26
29  */
30 @RestController
31 @RequestMapping("/bs/formulaChild")
32 public class BsFormulaChildInfoController extends BaseController
33 {
34     @Autowired
35     private IBsFormulaChildInfoService bsFormulaChildInfoService;
36
37     /**
38      * 查询配方配置子信息列表
39      */
40     @PreAuthorize("@ss.hasPermi('bs:formulaChild:list')")
41     @GetMapping("/list")
42     public TableDataInfo list(BsFormulaChildInfo bsFormulaChildInfo)
43     {
44         startPage();
45         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
c95cd5 46         for (BsFormulaChildInfo formulaChildInfo : list) {
47             formulaChildInfo.setSort(formulaChildInfo.getStepSort());
48             formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
49             formulaChildInfo.setImg(formulaChildInfo.getOperationSteps());
50         }
4e2a0c 51         return getDataTable(list);
52     }
53
54     /**
a36b83 55      * 检查是否可以放行
56      */
57     @GetMapping("/releaseCheck")
58     public AjaxResult releaseCheck()
59     {
60         List<BsFormulaChildInfo> i = bsFormulaChildInfoService.releaseCheck();
61         return AjaxResult.success(i.size());
62     }
63
64     /**
65      * 扫码确认
66      */
67     @GetMapping("/updateResults")
68     public AjaxResult updateResults(BsFormulaChildInfo bsFormulaChildInfo)
69     {
70         return bsFormulaChildInfoService.updateResults(bsFormulaChildInfo);
71     }
72
73     /**
4e2a0c 74      * 导出配方配置子信息列表
75      */
76     @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
77     @Log(title = "配方配置子信息", businessType = BusinessType.EXPORT)
78     @PostMapping("/export")
79     public void export(HttpServletResponse response, BsFormulaChildInfo bsFormulaChildInfo)
80     {
81         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
82         ExcelUtil<BsFormulaChildInfo> util = new ExcelUtil<BsFormulaChildInfo>(BsFormulaChildInfo.class);
83         util.exportExcel(response, list, "配方配置子信息数据");
84     }
85
86     /**
87      * 获取配方配置子信息详细信息
88      */
89     @PreAuthorize("@ss.hasPermi('bs:formulaChild:query')")
90     @GetMapping(value = "/{id}")
91     public AjaxResult getInfo(@PathVariable("id") Long id)
92     {
93         return success(bsFormulaChildInfoService.selectBsFormulaChildInfoById(id));
94     }
95
96     /**
97      * 新增配方配置子信息
98      */
99     @PreAuthorize("@ss.hasPermi('bs:formulaChild:add')")
100     @Log(title = "配方配置子信息", businessType = BusinessType.INSERT)
101     @PostMapping
102     public AjaxResult add(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
103     {
104         return toAjax(bsFormulaChildInfoService.insertBsFormulaChildInfo(bsFormulaChildInfo));
105     }
106
107     /**
108      * 修改配方配置子信息
109      */
110     @PreAuthorize("@ss.hasPermi('bs:formulaChild:edit')")
111     @Log(title = "配方配置子信息", businessType = BusinessType.UPDATE)
112     @PutMapping
113     public AjaxResult edit(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
114     {
115         return toAjax(bsFormulaChildInfoService.updateBsFormulaChildInfo(bsFormulaChildInfo));
116     }
117
118     /**
119      * 删除配方配置子信息
120      */
121     @PreAuthorize("@ss.hasPermi('bs:formulaChild:remove')")
122     @Log(title = "配方配置子信息", businessType = BusinessType.DELETE)
123     @DeleteMapping("/{ids}")
124     public AjaxResult remove(@PathVariable Long[] ids)
125     {
126         return toAjax(bsFormulaChildInfoService.deleteBsFormulaChildInfoByIds(ids));
127     }
128 }