春风项目四线(合箱线、总装线)
wujian
2024-01-20 b849f1f5004bbad8f47bea2f4471e6ff699fe73c
提交 | 用户 | 时间
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
717bf8 38     private static final String ZERO = "0";
W 39
fd2207 40     /**
41      * 查询配方配置子信息列表
42      */
43     @PreAuthorize("@ss.hasPermi('bs:formulaChild:list')")
44     @GetMapping("/list")
45     public TableDataInfo list(BsFormulaChildInfo bsFormulaChildInfo)
46     {
47         startPage();
48         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
49         for (BsFormulaChildInfo formulaChildInfo : list) {
50             formulaChildInfo.setSort(formulaChildInfo.getStepSort());
51             formulaChildInfo.setAddress(formulaChildInfo.getTechRequirement());
1558d8 52             formulaChildInfo.setImg(formulaChildInfo.getPicture());
fd2207 53         }
717bf8 54         list = list.stream()
W 55                 .filter(x -> !ZERO.equals(x.getSort())).sorted(Comparator.comparing(BsFormulaChildInfo::getSort)).collect(Collectors.toList());
fd2207 56         return getDataTable(list);
57     }
58
59     /**
83923e 60      * 查询工艺流程
W 61      * @param productProcessQuery query
62      * @return list
63      */
64     @PostMapping("/getProductProcess")
65     public TableDataInfo getProductProcess(@RequestBody ProductProcessQuery productProcessQuery)
66     {
67         List<BsFormulaChildInfo> list = productProcessService.getProductProcess(productProcessQuery);
68         return getDataTable(list);
69     }
70
71     /**
fd2207 72      * 导出配方配置子信息列表
73      */
74     @PreAuthorize("@ss.hasPermi('bs:formulaChild:export')")
75     @Log(title = "配方配置子信息", businessType = BusinessType.EXPORT)
76     @PostMapping("/export")
77     public void export(HttpServletResponse response, BsFormulaChildInfo bsFormulaChildInfo)
78     {
79         List<BsFormulaChildInfo> list = bsFormulaChildInfoService.selectBsFormulaChildInfoList(bsFormulaChildInfo);
80         ExcelUtil<BsFormulaChildInfo> util = new ExcelUtil<BsFormulaChildInfo>(BsFormulaChildInfo.class);
81         util.exportExcel(response, list, "配方配置子信息数据");
82     }
83
84     /**
85      * 获取配方配置子信息详细信息
86      */
87     @PreAuthorize("@ss.hasPermi('bs:formulaChild:query')")
88     @GetMapping(value = "/{id}")
89     public AjaxResult getInfo(@PathVariable("id") Long id)
90     {
91         return success(bsFormulaChildInfoService.selectBsFormulaChildInfoById(id));
92     }
93
94     /**
95      * 新增配方配置子信息
96      */
97     @PreAuthorize("@ss.hasPermi('bs:formulaChild:add')")
98     @Log(title = "配方配置子信息", businessType = BusinessType.INSERT)
99     @PostMapping
100     public AjaxResult add(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
101     {
102         return toAjax(bsFormulaChildInfoService.insertBsFormulaChildInfo(bsFormulaChildInfo));
103     }
104
105     /**
106      * 修改配方配置子信息
107      */
108     @PreAuthorize("@ss.hasPermi('bs:formulaChild:edit')")
109     @Log(title = "配方配置子信息", businessType = BusinessType.UPDATE)
110     @PutMapping
111     public AjaxResult edit(@RequestBody BsFormulaChildInfo bsFormulaChildInfo)
112     {
113         return toAjax(bsFormulaChildInfoService.updateBsFormulaChildInfo(bsFormulaChildInfo));
114     }
115
116     /**
117      * 删除配方配置子信息
118      */
119     @PreAuthorize("@ss.hasPermi('bs:formulaChild:remove')")
120     @Log(title = "配方配置子信息", businessType = BusinessType.DELETE)
121     @DeleteMapping("/{ids}")
122     public AjaxResult remove(@PathVariable Long[] ids)
123     {
124         return toAjax(bsFormulaChildInfoService.deleteBsFormulaChildInfoByIds(ids));
125     }
126 }