提交 | 用户 | 时间
|
c06f48
|
1 |
package com.iailab.module.model.mcs.pre.controller.admin; |
7fd198
|
2 |
|
潘 |
3 |
import com.iailab.framework.common.pojo.CommonResult; |
|
4 |
import com.iailab.framework.common.pojo.PageResult; |
|
5 |
import com.iailab.module.model.mcs.pre.dto.MmPredictItemDTO; |
|
6 |
import com.iailab.module.model.mcs.pre.service.MmPredictItemService; |
|
7 |
import com.iailab.module.model.mcs.pre.vo.CountItemtypeVO; |
|
8 |
import com.iailab.module.model.mcs.pre.vo.MmPredictItemRespVO; |
|
9 |
import org.springframework.beans.factory.annotation.Autowired; |
abba54
|
10 |
import org.springframework.security.access.prepost.PreAuthorize; |
7fd198
|
11 |
import org.springframework.web.bind.annotation.*; |
潘 |
12 |
import org.springframework.web.multipart.MultipartFile; |
|
13 |
|
|
14 |
import java.util.ArrayList; |
|
15 |
import java.util.List; |
|
16 |
import java.util.Map; |
|
17 |
|
|
18 |
import static com.iailab.framework.common.pojo.CommonResult.error; |
|
19 |
import static com.iailab.framework.common.pojo.CommonResult.success; |
|
20 |
|
|
21 |
/** |
|
22 |
* @author PanZhibao |
|
23 |
* @date 2021年04月26日 14:42 |
|
24 |
*/ |
|
25 |
@RestController |
abba54
|
26 |
@RequestMapping("/model/pre/predict-item") |
7fd198
|
27 |
public class MmPredictItemController { |
潘 |
28 |
|
|
29 |
@Autowired |
|
30 |
private MmPredictItemService mmPredictItemService; |
|
31 |
|
|
32 |
/** |
|
33 |
* 预测项列表 |
|
34 |
*/ |
|
35 |
@GetMapping("/page") |
abba54
|
36 |
@PreAuthorize("@ss.hasPermission('model:pre-predict:query')") |
7fd198
|
37 |
public CommonResult<PageResult<MmPredictItemRespVO>> page(@RequestParam Map<String, Object> params) { |
潘 |
38 |
PageResult<MmPredictItemRespVO> page = mmPredictItemService.getPageList(params); |
|
39 |
return success(page); |
|
40 |
} |
|
41 |
|
|
42 |
/** |
|
43 |
* 预测项信息 |
|
44 |
*/ |
d395d2
|
45 |
@GetMapping("/get/{id}") |
abba54
|
46 |
@PreAuthorize("@ss.hasPermission('model:pre-predict:query')") |
7fd198
|
47 |
public CommonResult<MmPredictItemDTO> info(@PathVariable("id") String id, @RequestParam Map<String, Object> params){ |
潘 |
48 |
MmPredictItemDTO predictItem = mmPredictItemService.getDetailById(id, params); |
|
49 |
return success(predictItem); |
|
50 |
} |
|
51 |
|
|
52 |
/** |
|
53 |
* 保存预测项 |
|
54 |
*/ |
d395d2
|
55 |
@PostMapping("/create") |
abba54
|
56 |
@PreAuthorize("@ss.hasPermission('model:pre-predict:create')") |
7fd198
|
57 |
public CommonResult<Boolean> save(@RequestBody MmPredictItemDTO mmPredictItemDto){ |
潘 |
58 |
int count = mmPredictItemService.check(mmPredictItemDto.getMmPredictItem()); |
|
59 |
if (count > 0) { |
|
60 |
return error(999, "名称或编号重复"); |
|
61 |
} |
|
62 |
mmPredictItemService.savePredictItem(mmPredictItemDto); |
|
63 |
return success(true); |
|
64 |
} |
|
65 |
|
|
66 |
/** |
|
67 |
* 修改预测项 |
|
68 |
*/ |
d395d2
|
69 |
@PutMapping("/update") |
abba54
|
70 |
@PreAuthorize("@ss.hasPermission('model:pre-predict:update')") |
7fd198
|
71 |
public CommonResult<Boolean> update(@RequestBody MmPredictItemDTO mmPredictItemDto){ |
潘 |
72 |
int count = mmPredictItemService.check(mmPredictItemDto.getMmPredictItem()); |
|
73 |
if (count > 0) { |
|
74 |
return error(999, "名称或编号重复"); |
|
75 |
} |
|
76 |
mmPredictItemService.update(mmPredictItemDto); |
|
77 |
return success(true); |
|
78 |
} |
|
79 |
|
|
80 |
/** |
|
81 |
* 删除预测项 |
|
82 |
*/ |
d395d2
|
83 |
@DeleteMapping("/delete") |
abba54
|
84 |
@PreAuthorize("@ss.hasPermission('model:pre-predict:delete')") |
d395d2
|
85 |
public CommonResult<Boolean> delete(@RequestParam("id") String id) { |
L |
86 |
mmPredictItemService.deleteBatch(new String[]{id}); |
7fd198
|
87 |
return success(true); |
潘 |
88 |
} |
|
89 |
|
|
90 |
/** |
|
91 |
* 预测项列表 |
|
92 |
*/ |
|
93 |
@GetMapping("/count-itemtype") |
|
94 |
public CommonResult<List<CountItemtypeVO>> countItemtype(@RequestParam Map<String, Object> params){ |
|
95 |
List<CountItemtypeVO> list = new ArrayList<>(); |
|
96 |
return success(list); |
|
97 |
} |
|
98 |
|
|
99 |
/** |
|
100 |
* 数量 |
|
101 |
*/ |
|
102 |
@GetMapping("/count") |
|
103 |
public CommonResult<Long> count() { |
|
104 |
Long count = mmPredictItemService.count(); |
|
105 |
return success(count); |
|
106 |
} |
|
107 |
|
|
108 |
/** |
|
109 |
* 上传模型 |
|
110 |
*/ |
|
111 |
@PostMapping("/uploadModel") |
|
112 |
public CommonResult<Boolean> uploadModel(@RequestParam("file") MultipartFile file) throws Exception { |
|
113 |
|
|
114 |
return success(true); |
|
115 |
} |
|
116 |
} |