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