提交 | 用户 | 时间
|
fb3b3e
|
1 |
package com.billion.main.bs.controller; |
吴 |
2 |
|
|
3 |
import java.util.List; |
|
4 |
import javax.servlet.http.HttpServletResponse; |
|
5 |
|
|
6 |
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
7 |
import com.billion.common.core.domain.R; |
|
8 |
import com.billion.common.utils.poi.ExcelUtil; |
|
9 |
import com.billion.main.bs.domain.BsFormulaInfo; |
|
10 |
import com.billion.main.bs.service.IBsFormulaInfoService; |
|
11 |
import org.springframework.security.access.prepost.PreAuthorize; |
|
12 |
import org.springframework.beans.factory.annotation.Autowired; |
|
13 |
import org.springframework.web.bind.annotation.GetMapping; |
|
14 |
import org.springframework.web.bind.annotation.PostMapping; |
|
15 |
import org.springframework.web.bind.annotation.PutMapping; |
|
16 |
import org.springframework.web.bind.annotation.DeleteMapping; |
|
17 |
import org.springframework.web.bind.annotation.PathVariable; |
|
18 |
import org.springframework.web.bind.annotation.RequestBody; |
|
19 |
import org.springframework.web.bind.annotation.RequestMapping; |
|
20 |
import org.springframework.web.bind.annotation.RestController; |
|
21 |
import com.billion.common.annotation.Log; |
|
22 |
import com.billion.common.core.controller.BaseController; |
|
23 |
import com.billion.common.core.domain.AjaxResult; |
|
24 |
import com.billion.common.enums.BusinessType; |
|
25 |
import com.billion.common.core.page.TableDataInfo; |
|
26 |
|
|
27 |
/** |
|
28 |
* 配方配置Controller |
|
29 |
* |
|
30 |
* @author Billion |
|
31 |
* @date 2024-11-26 |
|
32 |
*/ |
|
33 |
@RestController |
|
34 |
@RequestMapping("/formulaInfo") |
|
35 |
public class BsFormulaInfoController extends BaseController |
|
36 |
{ |
|
37 |
@Autowired |
|
38 |
private IBsFormulaInfoService bsFormulaInfoService; |
|
39 |
|
|
40 |
/** |
|
41 |
* 查询配方配置列表 |
|
42 |
*/ |
|
43 |
@PreAuthorize("@ss.hasPermi('main:info:list')") |
|
44 |
@GetMapping("/list") |
|
45 |
public TableDataInfo list(BsFormulaInfo bsFormulaInfo) |
|
46 |
{ |
|
47 |
startPage(); |
|
48 |
List<BsFormulaInfo> list = bsFormulaInfoService.selectBsFormulaInfoList(bsFormulaInfo); |
|
49 |
return getDataTable(list); |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* 导出配方配置列表 |
|
54 |
*/ |
|
55 |
@PreAuthorize("@ss.hasPermi('main:info:export')") |
|
56 |
@Log(title = "配方配置", businessType = BusinessType.EXPORT) |
|
57 |
@PostMapping("/export") |
|
58 |
public void export(HttpServletResponse response, BsFormulaInfo bsFormulaInfo) |
|
59 |
{ |
|
60 |
List<BsFormulaInfo> list = bsFormulaInfoService.selectBsFormulaInfoList(bsFormulaInfo); |
|
61 |
ExcelUtil<BsFormulaInfo> util = new ExcelUtil<BsFormulaInfo>(BsFormulaInfo.class); |
|
62 |
util.exportExcel(response, list, "配方配置数据"); |
|
63 |
} |
|
64 |
|
|
65 |
/** |
|
66 |
* 获取配方配置详细信息 |
|
67 |
*/ |
|
68 |
@PreAuthorize("@ss.hasPermi('main:info:query')") |
|
69 |
@GetMapping(value = "/{id}") |
|
70 |
public AjaxResult getInfo(@PathVariable("id") Long id) |
|
71 |
{ |
|
72 |
return success(bsFormulaInfoService.selectBsFormulaInfoById(id)); |
|
73 |
} |
|
74 |
|
|
75 |
/** |
|
76 |
* 新增配方配置 |
|
77 |
*/ |
|
78 |
@PreAuthorize("@ss.hasPermi('main:info:add')") |
|
79 |
@Log(title = "配方配置", businessType = BusinessType.INSERT) |
|
80 |
@PostMapping |
|
81 |
public AjaxResult add(@RequestBody BsFormulaInfo bsFormulaInfo) |
|
82 |
{ |
|
83 |
return toAjax(bsFormulaInfoService.insertBsFormulaInfo(bsFormulaInfo)); |
|
84 |
} |
|
85 |
|
|
86 |
/** |
|
87 |
* 修改配方配置 |
|
88 |
*/ |
|
89 |
@PreAuthorize("@ss.hasPermi('main:info:edit')") |
|
90 |
@Log(title = "配方配置", businessType = BusinessType.UPDATE) |
|
91 |
@PutMapping |
|
92 |
public AjaxResult edit(@RequestBody BsFormulaInfo bsFormulaInfo) |
|
93 |
{ |
|
94 |
return toAjax(bsFormulaInfoService.updateBsFormulaInfo(bsFormulaInfo)); |
|
95 |
} |
|
96 |
|
|
97 |
/** |
|
98 |
* 删除配方配置 |
|
99 |
*/ |
|
100 |
@PreAuthorize("@ss.hasPermi('main:info:remove')") |
|
101 |
@Log(title = "配方配置", businessType = BusinessType.DELETE) |
|
102 |
@DeleteMapping("/{ids}") |
|
103 |
public AjaxResult remove(@PathVariable Long[] ids) |
|
104 |
{ |
|
105 |
return toAjax(bsFormulaInfoService.deleteBsFormulaInfoByIds(ids)); |
|
106 |
} |
|
107 |
|
|
108 |
@GetMapping("/getOne") |
|
109 |
public R getOne(BsFormulaInfo bsFormulaInfo){ |
|
110 |
BsFormulaInfo one = bsFormulaInfoService.getOne(new LambdaQueryWrapper<BsFormulaInfo>() |
|
111 |
.eq(BsFormulaInfo::getFormulaCode, bsFormulaInfo.getFormulaCode())); |
|
112 |
return R.ok(one); |
|
113 |
} |
|
114 |
} |