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